Skip to content

Commit 7483860

Browse files
committed
{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.
1 parent f4f8903 commit 7483860

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

nixos/tests/cups-pdf.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
machine.wait_until_succeeds(f"su - alice -c 'pdfinfo /var/spool/cups-pdf-{name}/users/alice/*.pdf'")
3838
machine.succeed(f"cp /var/spool/cups-pdf-{name}/users/alice/*.pdf /tmp/{name}.pdf")
3939
machine.copy_from_vm(f"/tmp/{name}.pdf", "")
40-
run(f"${hostPkgs.imagemagickBig}/bin/convert -density 300 $out/{name}.pdf $out/{name}.jpeg", shell=True, check=True)
40+
run(f"${lib.getExe hostPkgs.imagemagickBig} -density 300 $out/{name}.pdf $out/{name}.jpeg", shell=True, check=True)
4141
assert text.encode() in run(f"${lib.getExe hostPkgs.tesseract} $out/{name}.jpeg stdout", shell=True, check=True, capture_output=True).stdout
4242
'';
4343

pkgs/by-name/cu/cups-pdf-to-pdf/package.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ stdenv.mkDerivation {
2121
buildInputs = [ cups ];
2222

2323
postPatch = ''
24-
sed -r 's|(gscall, size, ")cp |\1${coreutils}/bin/cp |' cups-pdf.c -i
24+
substituteInPlace cups-pdf.c \
25+
--replace-fail '"cp ' '"${lib.getExe' coreutils "cp"} '
2526
'';
2627

2728
# gcc command line is taken from original cups-pdf's README file

0 commit comments

Comments
 (0)