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

@Pamplemousse Pamplemousse commented Apr 13, 2020

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 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

@jonringer jonringer commented Apr 13, 2020

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 Pamplemousse force-pushed the Pamplemousse:ptags branch from 4b7415e to a57e85e Apr 14, 2020
@Pamplemousse
Copy link
Member Author

@Pamplemousse Pamplemousse commented Apr 14, 2020

@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 force-pushed the Pamplemousse:ptags branch from a4002d5 to 6f9d007 Apr 20, 2020
@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

@Pamplemousse Pamplemousse commented Apr 20, 2020

@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.

@Pamplemousse Pamplemousse requested a review from bhipple Apr 22, 2020
@bhipple
Copy link
Contributor

@bhipple 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

@bhipple
bhipple approved these changes May 8, 2020
@Pamplemousse Pamplemousse requested a review from jonringer May 8, 2020
Copy link
Contributor

@jonringer jonringer left a comment

LGTM

Result of nixpkgs-review pr 85112 1

1 package built: - ptags

@jonringer jonringer merged commit bf7332d into NixOS:master May 8, 2020
16 checks passed
16 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="6f9d007"; rev="6f9d007805d78091c0e801dec7eeeaea616059d5"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
ptags on aarch64-linux Success
Details
ptags on x86_64-linux Success
Details
@Pamplemousse Pamplemousse deleted the Pamplemousse:ptags branch May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.