Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ptags: init at 0.3.2 #85112

Merged
merged 1 commit into from May 8, 2020
Merged

ptags: init at 0.3.2 #85112

merged 1 commit into from May 8, 2020

Conversation

Pamplemousse
Copy link
Member

Motivation for this change

Make ptags available via nix.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@Pamplemousse
Copy link
Member Author

Pamplemousse commented Apr 13, 2020

Why [WIP]?

This is the first time I try to bundle a Rust package for nix...
And I would accept a bit of help as I encountered 2 1 problem with this expression:

Custom --target flags

ptags uses different --target flags depending on the targeted platform, but buildRustPackage have default ones, resulting in the build failing because of the duplicate flag.

#### Failing tests

The tests are failing, and I could not figure out why...

See the error details
running 18 tests
test bin::tests::test_run_config ... ok
test bin::tests::test_run_completion ... ok
test bin::tests::test_run_fail ... ok
test bin::tests::test_run ... FAILED
test cmd_ctags::tests::test_call_exclude ... FAILED
test bin::tests::test_run_opt ... FAILED
test cmd_ctags::tests::test_call ... FAILED
test cmd_ctags::tests::test_ctags_fail ... FAILED
test cmd_ctags::tests::test_call_with_opt ... FAILED
test cmd_ctags::tests::test_get_tags_header ... FAILED
test cmd_git::tests::test_command_fail ... ok
test cmd_ctags::tests::test_command_fail ... FAILED
test cmd_git::tests::test_get_files ... FAILED
test cmd_git::tests::test_get_files_exclude_lfs_cd ... FAILED
test cmd_git::tests::test_get_files_exclude_lfs ... FAILED
test cmd_git::tests::test_get_files_include_submodule ... FAILED
test cmd_git::tests::test_git_fail ... ok
test cmd_git::tests::test_get_files_include_untracked ... FAILED

failures:

---- bin::tests::test_run stdout ----
thread 'bin::tests::test_run' panicked at 'assertion failed: ret.is_ok()', src/bin.rs:323:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- cmd_ctags::tests::test_call_exclude stdout ----
Call : cd .; git ls-files --cached --exclude-standard
thread 'cmd_ctags::tests::test_call_exclude' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_ctags.rs:232:21

---- bin::tests::test_run_opt stdout ----
Call : cd .; git ls-files --cached --exclude-standard
thread 'bin::tests::test_run_opt' panicked at 'assertion failed: ret.is_ok()', src/bin.rs:331:9

---- cmd_ctags::tests::test_call stdout ----
thread 'cmd_ctags::tests::test_call' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_ctags.rs:199:21

---- cmd_ctags::tests::test_ctags_fail stdout ----
thread 'cmd_ctags::tests::test_ctags_fail' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_ctags.rs:264:21

---- cmd_ctags::tests::test_call_with_opt stdout ----
thread 'cmd_ctags::tests::test_call_with_opt' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_ctags.rs:212:21

---- cmd_ctags::tests::test_get_tags_header stdout ----
thread 'cmd_ctags::tests::test_get_tags_header' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/cmd_ctags.rs:276:22

---- cmd_ctags::tests::test_command_fail stdout ----
thread 'cmd_ctags::tests::test_command_fail' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_ctags.rs:252:21

---- cmd_git::tests::test_get_files stdout ----
thread 'cmd_git::tests::test_get_files' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_git.rs:207:21

---- cmd_git::tests::test_get_files_exclude_lfs_cd stdout ----
thread 'cmd_git::tests::test_get_files_exclude_lfs_cd' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd src; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_git.rs:229:21

---- cmd_git::tests::test_get_files_exclude_lfs stdout ----
thread 'cmd_git::tests::test_get_files_exclude_lfs' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_git.rs:215:21

---- cmd_git::tests::test_get_files_include_submodule stdout ----
thread 'cmd_git::tests::test_get_files_include_submodule' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard --recurse-submodules", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_git.rs:240:21

---- cmd_git::tests::test_get_files_include_untracked stdout ----
thread 'cmd_git::tests::test_get_files_include_untracked' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorMessage { msg: ExecFailed { cmd: "cd .; git ls-files --cached --exclude-standard --other", err: "fatal: not a git repository (or any of the parent directories): .git\n" } }', src/cmd_git.rs:259:21


failures:
    bin::tests::test_run
    bin::tests::test_run_opt
    cmd_ctags::tests::test_call
    cmd_ctags::tests::test_call_exclude
    cmd_ctags::tests::test_call_with_opt
    cmd_ctags::tests::test_command_fail
    cmd_ctags::tests::test_ctags_fail
    cmd_ctags::tests::test_get_tags_header
    cmd_git::tests::test_get_files
    cmd_git::tests::test_get_files_exclude_lfs
    cmd_git::tests::test_get_files_exclude_lfs_cd
    cmd_git::tests::test_get_files_include_submodule
    cmd_git::tests::test_get_files_include_untracked

test result: FAILED. 5 passed; 13 failed; 0 ignored; 0 measured; 0 filtered out

Thank you :)

@jonringer
Copy link
Contributor

Call : cd .; git ls-files --cached --exclude-standard

looks like a lot of these tests call shell code on programs that don't exist.

I think you could just make the checkPhase:

  checkPhase = ''
    $out/bin/ptags --help > /dev/null
  '';

just to make sure it's not trivially broken @bhipple

pkgs/development/tools/misc/ptags/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/ptags/default.nix Outdated Show resolved Hide resolved
@Pamplemousse
Copy link
Member Author

@bhipple any idea about the "--target flag problem"?

The default builds and works fine on NixOS, but I could not test for other platforms.

@Pamplemousse Pamplemousse changed the title [WIP] ptags: init at 0.3.2 ptags: init at 0.3.2 Apr 20, 2020
@Pamplemousse
Copy link
Member Author

@bhipple I had a look at your solution to make git ls-files work, using fetchSubmodules and leaveDotGit.
When looking for documentation about these options, I have found interesting arguments about avoiding using leaveDotGit as it might break the deterministic nature of the builds.

I think the safer approach here is to simply run the binary as a sanity check.

@bhipple
Copy link
Contributor

bhipple commented May 8, 2020

Agreed, best to leave out leaveDotGit -- otherwise the build can see the newer commits/tags and potentially be polluted in an impure way.

@GrahamcOfBorg build ptags

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Result of nixpkgs-review pr 85112 1

1 package built: - ptags

@jonringer jonringer merged commit bf7332d into NixOS:master May 8, 2020
@Pamplemousse Pamplemousse deleted the ptags branch May 8, 2020 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants