mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
{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.
This commit is contained in:
parent
f4f89032a1
commit
74838606a0
2 changed files with 3 additions and 2 deletions
|
@ -37,7 +37,7 @@
|
|||
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
|
||||
'';
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ stdenv.mkDerivation {
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue