diff --git a/pkgs/test/auto-patchelf-structured-log/default.nix b/pkgs/test/auto-patchelf-structured-log/default.nix new file mode 100644 index 000000000000..b75e5cb58ca1 --- /dev/null +++ b/pkgs/test/auto-patchelf-structured-log/default.nix @@ -0,0 +1,53 @@ +{ + lib, + stdenv, + fetchurl, + + auto-patchelf, + dpkg, + freetype, + jq, +}: + +stdenv.mkDerivation { + name = "auto-patchelf-structured-log-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 + auto-patchelf + jq + ]; + + installPhase = '' + auto-patchelf \ + --paths ./usr/bin/ToneLib-Jam \ + --libs ${lib.getLib freetype}/lib \ + --structured-logs > log.jsonl || true + + # Expect 1 SetInterpreter line + jq -e -s '[.[] | select(has("SetInterpreter"))] | length == 1' log.jsonl + + # We expect 3 Dependency lines + jq -e -s '[.[] | select(has("Dependency"))] | length == 3' log.jsonl + + # Expect the last line to set the rpath as expected + jq -e -s 'last == { + "SetRpath": { + "file": "usr/bin/ToneLib-Jam", + "rpath": "${lib.getLib freetype}/lib" + } + }' log.jsonl + + cp log.jsonl $out + ''; + +} diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 3823ce88bc80..efcd4963136d 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -227,6 +227,8 @@ in buildFHSEnv = recurseIntoAttrs (callPackages ./buildFHSEnv { }); + auto-patchelf-structured-log = callPackage ./auto-patchelf-structured-log { }; + auto-patchelf-hook = callPackage ./auto-patchelf-hook { }; auto-patchelf-hook-preserve-origin = callPackage ./auto-patchelf-hook-preserve-origin { };