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

btrbk: Fix shebangs #97465

Closed
wants to merge 1 commit into from
Closed

btrbk: Fix shebangs #97465

wants to merge 1 commit into from

Conversation

kampka
Copy link
Contributor

@kampka kampka commented Sep 8, 2020

Motivation for this change

This packages need bash in buildDeps in order to have it patched
correctly by patchShebangs().
In addition, wrapProgram generates the wrong shebang when cross-building
which needs to be corrected manually.

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 via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • 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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@kampka
Copy link
Contributor Author

kampka commented Sep 8, 2020

@GrahamcOfBorg build btrbk

Copy link
Contributor

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

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

https://github.com/NixOS/nixpkgs/pull/97465
1 package built:
btrbk

@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [ asciidoc asciidoctor makeWrapper ];

buildInputs = with perlPackages; [ perl DateCalc ];
buildInputs = with perlPackages; [ perl DateCalc bash ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
buildInputs = with perlPackages; [ perl DateCalc bash ];
buildInputs = [ perlPackages.perl perlPackages.DateCalc bash ];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went for option number 3

@drewrisinger
Copy link
Contributor

If you made changes, I'm not seeing them updated on the web.

@kampka
Copy link
Contributor Author

kampka commented Sep 9, 2020

I made some more improvements to the package.
It should now work better for cross-platform installations, eg. nixops

@kampka kampka force-pushed the btrbk branch 3 times, most recently from b475585 to 589b1af Compare September 9, 2020 18:42
@kampka
Copy link
Contributor Author

kampka commented Sep 9, 2020

@GrahamcOfBorg build btrbk

Copy link
Contributor

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

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

  • Diff LGTM
  • Commits LGTM
  • Builds via nix-review
https://github.com/NixOS/nixpkgs/pull/97465
1 package built:
btrbk

pkgs/tools/backup/btrbk/default.nix Show resolved Hide resolved
'';

preFixup = ''
wrapProgram $out/sbin/btrbk \
--set PERL5LIB $PERL5LIB \
--prefix PATH ':' "${stdenv.lib.makeBinPath [ btrfs-progs bash mbuffer openssh ]}"
substituteInPlace $out/sbin/btrbk --replace "${buildPackages.bash}" "${bash}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have to perform this substitution? i.e., why did the file in $out end up with buildPackages.bash?

Is it because now bash is in buildDeps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is that cross-building will cause wrapProgram to run on the build host and the @shell@ placeholder with ${buildPackages.bash} instead of ${pkgs.bash} which is imo. a bug in wrapProgram

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Yeah this is not very pretty, but I guess we can live with it.

@asymmetric
Copy link
Contributor

Thanks for the PR! In general LGTM, but I have a couple of questions.

@SuperSandro2000
Copy link
Member

@kampka please fix the merge conflict.

@kampka
Copy link
Contributor Author

kampka commented Dec 29, 2020

@kampka please fix the merge conflict.

@SuperSandro2000 PR is fine and can be merged as is.


buildInputs = with perlPackages; [ perl DateCalc ];
buildInputs = [ bash ] ++ (with perlPackages; [ perl DateCalc ]);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
buildInputs = [ bash ] ++ (with perlPackages; [ perl DateCalc ]);
buildInputs = (with perlPackages; [ perl DateCalc ]);

I don't think this is needed because we do not compile against it.

Copy link
Member

Choose a reason for hiding this comment

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

Ping

@SuperSandro2000
Copy link
Member

@SuperSandro2000 PR is fine and can be merged as is.

No, it is not. GitHub complains about a merge conflict.

@kampka
Copy link
Contributor Author

kampka commented Dec 29, 2020

@SuperSandro2000 PR is fine and can be merged as is.

No, it is not. GitHub complains about a merge conflict.

git merge -X theirs

Either pick it or leave it, I don't intend to follow up on PRs any more if they break because nobody can be bothered to push a button in time.

@symphorien
Copy link
Member

I wonder if adding strictDeps = true is enough to solve the problem. patchShebangs is smart enough to distinguish what is in PATH for build and what would be in PATH on the target.

 * Use asciidoc from buildPackages, eases cross-platform builds
 * Add bash to buildDeps for patchShebangs to apply it
 * Fix wrapProgram shebang in cross-platform builds
 * Add specific deps for btrbk and ssh filter script to PATH
@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Jan 10, 2021

Either pick it or leave it

Then we close it. or I just solve it for you.

I don't intend to follow up on PRs any more if they break because nobody can be bothered to push a button in time.

I take this as a mild offense.

@stale
Copy link

stale bot commented Jul 20, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 20, 2021
@kampka kampka closed this Jan 5, 2022
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

5 participants