{nixos/tests/}/cups-pdf: use `getExe` and `substituteInPlace`

With `lib.getExe`, we also use "magick" instead of "convert`,
and thereby avoid the ImageMagick warning message:

> WARNING: The convert command is deprecated in IMv7, use "magick" instead of "convert" or "magick convert"

The replacement string for the
`cp` command is shortened.
This is a bit risky since an update might inadvertently
introduce a similar string that is then also replaced.
However, the leading double-quote and
trailing space seem safe enough to me.

Yarny0 74838606 f4f89032

Changed files
+3 -2
nixos
tests
pkgs
by-name
cu
cups-pdf-to-pdf
+1 -1
nixos/tests/cups-pdf.nix
···
machine.wait_until_succeeds(f"su - alice -c 'pdfinfo /var/spool/cups-pdf-{name}/users/alice/*.pdf'")
machine.succeed(f"cp /var/spool/cups-pdf-{name}/users/alice/*.pdf /tmp/{name}.pdf")
machine.copy_from_vm(f"/tmp/{name}.pdf", "")
-
run(f"${hostPkgs.imagemagickBig}/bin/convert -density 300 $out/{name}.pdf $out/{name}.jpeg", shell=True, check=True)
+
run(f"${lib.getExe hostPkgs.imagemagickBig} -density 300 $out/{name}.pdf $out/{name}.jpeg", shell=True, check=True)
assert text.encode() in run(f"${lib.getExe hostPkgs.tesseract} $out/{name}.jpeg stdout", shell=True, check=True, capture_output=True).stdout
'';
+2 -1
pkgs/by-name/cu/cups-pdf-to-pdf/package.nix
···
buildInputs = [ cups ];
postPatch = ''
-
sed -r 's|(gscall, size, ")cp |\1${coreutils}/bin/cp |' cups-pdf.c -i
+
substituteInPlace cups-pdf.c \
+
--replace-fail '"cp ' '"${lib.getExe' coreutils "cp"} '
'';
# gcc command line is taken from original cups-pdf's README file