cups-pdf: misc improvements in package, module, vmtest#387364
Conversation
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/5289 |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/5323 |
90b6687 to
14fe270
Compare
|
Pushed a rebase due to #380990 |
There was a problem hiding this comment.
imageMagickBig.meta.mainProgram is "magick", so we can use the non-prime getExe here:
| run(f"${lib.getExe' hostPkgs.imagemagickBig "magick"} -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) |
There was a problem hiding this comment.
Would it be practical to use substituteInPlace and --replace-fail instead of sed here? Generally, this is preferred over using sed.
Something like:
| sed -r 's|(gscall, size, ")cp |\1${lib.getExe' coreutils "cp"} |' cups-pdf.c -i | |
| substituteInPlace cups-pdf.c \ | |
| --replace-fail \ | |
| 'gscall, size, "cp ' \ | |
| 'gscall, size, "${lib.getExe' coreutils "cp"} ' |
or maybe even:
| sed -r 's|(gscall, size, ")cp |\1${lib.getExe' coreutils "cp"} |' cups-pdf.c -i | |
| substituteInPlace cups-pdf.c \ | |
| --replace-fail \ | |
| '"cp ' \ | |
| '"${lib.getExe' coreutils "cp"} ' |
There was a problem hiding this comment.
Done. Reducing the "discovery string" is a bit risky, but your suggestion still looks passable to me (I've also added an explanation to this effect to the commit message).
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.
14fe270 to
ce5e427
Compare
|
Rebased and applied suggestions by @MattSturgeon . Package still builds, |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/5390 |
cups-pdf-to-pdfpackage: removewith lib;frommeta, drop unusedrec, uselib.getExeandsubstituteInPlacecups-pdfvm test: migrate torunTest, uselib.getExe', avoid deprecated${pkgs.imageMagick}/bin/convertprogramThings done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"tries to rebuild 3000+ package and was therefore skipped.Add a 👍 reaction to pull requests you find important.