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

wrapGAppsHook: Correct wrapProgram invocations #25183

Merged
merged 1 commit into from Apr 28, 2017

Conversation

ahmedtd
Copy link
Contributor

@ahmedtd ahmedtd commented Apr 24, 2017

This change fixes several defects in the way wrapGAppsHook selected
the executable to wrap.

Previously, it would wrap any top-level files in the target /bin and
/libexec directories, including directories and non-executable
files. In addition, it failed to wrap files in subdirectories.

Now, it uses find to iterate over these directory hierarchies,
selecting only executable files for wrapping.

Motivation for this change

Wrapping directories inside libexec broke emacs.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This change fixes several defects in the way `wrapGAppsHook` selected
the executable to wrap.

Previously, it would wrap any top-level files in the target `/bin` and
`/libexec` directories, including directories and non-executable
files.  In addition, it failed to wrap files in subdirectories.

Now, it uses `find` to iterate over these directory hierarchies,
selecting only executable files for wrapping.
@mention-bot
Copy link

@ahmedtd, thanks for your PR! By analyzing the history of the files in this pull request, we identified @vcunat, @lethalman and @peti to be potential reviewers.

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@peti peti merged commit edcff00 into NixOS:master Apr 28, 2017
@mguentner
Copy link
Contributor

This breaks at least mate-terminal and claws-mail:
nix-build -A claws-mail

find: '/nix/store/vxpdp4m7gpp0053myvq6pbf128igqp90-claws-mail-3.15.0/libexec': No such file or directory
Wrapping program /nix/store/vxpdp4m7gpp0053myvq6pbf128igqp90-claws-mail-3.15.0/bin/claws-mail
builder for ‘/nix/store/0a4gh5jkdba3wlb9hmbpbj5xmh3hr40g-claws-mail-3.15.0.drv’ failed with exit code 1
error: build of ‘/nix/store/0a4gh5jkdba3wlb9hmbpbj5xmh3hr40g-claws-mail-3.15.0.drv’ failed

nix-build -A mate.mate-terminal

 /nix/store/d56snr32kff2l1941jknkpf076h6mbwf-coreutils-8.27/bin/mkdir -p '/nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/share/mate-about'
 /nix/store/d56snr32kff2l1941jknkpf076h6mbwf-coreutils-8.27/bin/install -c -m 644 mate-version.xml '/nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/share/mate-about'
make[2]: Leaving directory '/tmp/nix-build-mate-desktop-1.18.0.drv-0/mate-desktop-1.18.0'
make[1]: Leaving directory '/tmp/nix-build-mate-desktop-1.18.0.drv-0/mate-desktop-1.18.0'
glibPreFixupPhase
hicolorPreFixupPhase
post-installation fixup
Removing /nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/share/gtk-doc
rmdir: failed to remove '/nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/share': Directory not empty
find: '/nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/libexec': No such file or directory
Wrapping program /nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/bin/mate-color-select
Wrapping program /nix/store/j6aw5qx8w2nb78lqcdjlr16m23xdv7a3-mate-desktop-1.18.0/bin/mate-about
builder for ‘/nix/store/y0641rgmdz6y1fmbg83pi6y0akikkvxk-mate-desktop-1.18.0.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/zdwiv0z0h3gc0qnmf1zw6a0n45raf5l9-mate-terminal-1.18.0.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/zdwiv0z0h3gc0qnmf1zw6a0n45raf5l9-mate-terminal-1.18.0.drv’ failed

@peti
Copy link
Member

peti commented Apr 28, 2017

Yeah, I see what happens. The patch passes those paths as arguments to find without verifying first that they actually exist. 😞 I'll revert in a minute ...

peti added a commit that referenced this pull request Apr 28, 2017
This reverts commit 8b9f153 of
#25183 because it breaks builds of
packages that don't install both a "bin" and a "libexec" directory. See
#25183 (comment) for more
details.
@ahmedtd
Copy link
Contributor Author

ahmedtd commented Apr 28, 2017

OK, I've worked up a fix, and tested it on claws-mail, mate.mate-desktop, and emacs (the original broken package that motivated the PR). All three programs build and run, and all of the applications of wrapProgram look correct.

I think this PR needs to be reopened in order for the new commits to appear here, or I can open a new PR.

@rasendubi
Copy link
Member

alarm-clock-applet seem to be broken by this PR as well. https://hydra.nixos.org/build/52065714

glibPreFixupPhase
post-installation fixup
find: '/nix/store/bmbzpmhlh458h5lwdl9x5bv7rlz2yw4f-alarm-clock-applet-0.3.4/libexec': No such file or directory
Wrapping program /nix/store/bmbzpmhlh458h5lwdl9x5bv7rlz2yw4f-alarm-clock-applet-0.3.4/bin/alarm-clock-applet

builder for ‘/nix/store/ylfyibdk8wbayn03234wa3yfjh736l6r-alarm-clock-applet-0.3.4.drv’ failed with exit code 1

@rasendubi
Copy link
Member

Oh, nevermind. It is fixed now. https://hydra.nixos.org/build/52082092

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants