auto-patchelf: add support for __structuredAttrs#272752
auto-patchelf: add support for __structuredAttrs#272752ConnorBaker merged 3 commits intoNixOS:stagingfrom
Conversation
|
Can we have a test for this? 😃 |
|
ran into this issue earlier... I'll try to find what package it was and get a minimal repo. |
I’d love to write one! Unfortunately I don’t know how to write tests for Nix things, much less bash in Nix things. Do you have a reference you’d recommend that I could look at? That or any docs for how to do so would be greatly appreciated! |
|
Oh, if you wanted to test expected failures, I recently played with running And expected successes don't even need a VM: you could e.g. generate a handful of derivations building dummy libraries. Then you pass them as buildInputs to another |
|
Yeah, see |
Turns out I had a different issue with |
d19a6d9 to
45901c4
Compare
|
I'm stuck :( I don't have more time to devote to figuring out how to make tests for this. I've spent on the order of about eight hours struggling to figure out how to get this working (using #272752 (comment) as a guide), but wasn't able to produce anything which even evaluated. I agree that there should be tests for this, but given that there aren't any already I can use as a reference, I don't think I have the skill or time necessary to write them. Is the lack of tests a blocker for merging? |
|
Ah sorry no I don't think a VM test is necessary. We can just use a Nix derivation that uses both
|
|
@infinisil thanks a lot for the detailed instructions! I set up something in e92f2dc following your advice. I built If I remove the |
|
Oh I see, that's not a great test case then, because most code paths aren't actually exercised. I looked around a bit more and found { stdenv
, fetchurl
, autoPatchelfHook
, dpkg
, freetype
}:
stdenv.mkDerivation {
name = "auto-patchelf-test";
src = fetchurl {
url = "https://tonelib.net/download/221222/ToneLib-Jam-amd64.deb";
sha256 = "sha256-c6At2lRPngQPpE7O+VY/Hsfw+QfIb3COIuHfbqqIEuM=";
};
unpackCmd = "dpkg -x $curSrc source";
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
installPhase = ''
mv usr $out
'';
buildInputs = [
freetype
];
autoPatchelfIgnoreMissingDeps = [
"libGL.so.1"
"libasound.so.2"
];
runtimeDependencies = [
"/some/dep"
# This might only work with __structuredAttrs!
"/a dep with a space"
];
}You'll have to add an |
e92f2dc to
0b3b622
Compare
|
@infinisil done in the last commit (update via force push). This test looks more solid 🙂 and indeed the test fails if I add the path with spaces when |
0b3b622 to
2fc8a3a
Compare
2fc8a3a to
418bceb
Compare
This commit adds a test for the newly added support for __structuredAttrs in autoPatchelf(hook). It copied a reasonably small-closure binary derivation that makes use of autoPatchelf, stripped it down for the purpose of the test, and check that autoPatchelf correctly set the interpreter and runpath whether __structuredAttrs is set to true or not.
418bceb to
00d0418
Compare
|
OfBorg failure (https://gist.github.com/GrahamcOfBorg/06df46e68204b4ce5b6d11e05b9fe30f) is unrelated and caused by the python package Thank you @yannham for writing the test cases and dragging this over the finish line! |
|
Successfully created backport PR for |
|
Is this really safe for 23.11, i.e. sufficiently compatible? (PR #275923) |
…edAttrs-autoPatchelf cudaPackages: __structuredAttrs works with autoPatchelf since #272752
Description of changes
As discovered in #256324,
autoPatchelfdoesn't work correctly when__structuredAttrsis true. This patch fixes that.This PR is tagged with a CUDA label because it being merged allows refactoring the work-around hack in #256324 where
autoPatchelfIgnoreMissingDepswas moved insideenvto ensure it was not treated as an array.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.