patchPpdFilesHook: fix path (and use getExe') (#472356)

This commit is contained in:
Heitor Augusto
2025-12-19 21:30:09 +00:00
committed by GitHub
2 changed files with 10 additions and 7 deletions
@@ -5,7 +5,7 @@ fixupOutputHooks+=(_patchPpdFileCommands4fixupOutputHooks)
# Install a hook for the `fixupPhase`:
# If the variable `ppdFileCommands` contains a list of
# executable names, the hook calls `patchPpdFileCommands`
# on each output's `/share/cups/model` and `/share/ppds`
# on each output's `/share/cups/model` and `/share/ppd`
# directories in order to replace calls to those executables.
_patchPpdFileCommands4fixupOutputHooks () {
@@ -13,8 +13,8 @@ _patchPpdFileCommands4fixupOutputHooks () {
if [[ -d $prefix/share/cups/model ]]; then
patchPpdFileCommands "$prefix/share/cups/model" $ppdFileCommands
fi
if [[ -d $prefix/share/ppds ]]; then
patchPpdFileCommands "$prefix/share/ppds" $ppdFileCommands
if [[ -d $prefix/share/ppd ]]; then
patchPpdFileCommands "$prefix/share/ppd" $ppdFileCommands
fi
}
+7 -4
View File
@@ -1,4 +1,5 @@
{
lib,
replaceVars,
diffutils,
stdenv,
@@ -6,6 +7,8 @@
}:
let
inherit (lib.meta) getExe';
input = replaceVars ./test.ppd {
keep = "cmp";
patch = "cmp";
@@ -15,9 +18,9 @@ let
output = replaceVars ./test.ppd {
keep = "cmp";
patch = "${diffutils}/bin/cmp";
patch = getExe' diffutils "cmp";
pathkeep = "/bin/cmp";
pathpatch = "${diffutils}/bin/cmp";
pathpatch = getExe' diffutils "cmp";
};
in
@@ -33,10 +36,10 @@ stdenv.mkDerivation {
ppdFileCommands = [ "cmp" ];
preFixup = ''
install -D "${input}" "${placeholder "out"}/share/cups/model/test.ppd"
install -D "${input}" "${placeholder "out"}/share/ppds/test.ppd"
install -D "${input}" "${placeholder "out"}/share/ppd/test.ppd"
'';
postFixup = ''
diff --color --report-identical-files "${output}" "${placeholder "out"}/share/cups/model/test.ppd"
diff --color --report-identical-files "${output}" "${placeholder "out"}/share/ppds/test.ppd"
diff --color --report-identical-files "${output}" "${placeholder "out"}/share/ppd/test.ppd"
'';
}