Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

brgenml1cupswrapper: fix regression and improvements

`cp`, `grep`, `chmod`, `sed` executables
no longer found when upgrading from nixos
15.09 to 16.03. Fixed by use of wrapper
script that brings these executables into
`PATH`.

Also fix lpd binaries on 64 bits machines
by use of `callPackage_i686`.

+38 -18
+37 -17
pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix
··· 1 - { stdenv, fetchurl, cups, perl, brgenml1lpr, debugLvl ? "0"}: 1 + { stdenv, fetchurl, makeWrapper, cups, perl, coreutils, gnused, gnugrep 2 + , brgenml1lpr, debugLvl ? "0"}: 2 3 3 4 /* 4 5 [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html). ··· 21 22 22 23 1. > Error: /tmp/brBrGenML1rc_15642 :cannot open file !! 23 24 24 - This is a non fatal issue. The job will still be printed. However, not sure 25 - what kind of information could be lost. 26 - 27 - There should be a more elegant way to patch this. 25 + Fixed. 28 26 29 27 2. > touch: cannot touch '/tmp/BrGenML1_latest_print_info': Permission denied 30 28 31 - TODO: Address. 29 + Fixed. 32 30 33 31 3. > perl: warning: Falling back to the standard locale ("C"). 34 32 ··· 40 38 perl: warning: Setting locale failed. 41 39 42 40 TODO: Address. 41 + 42 + 4. Since nixos 16.03 release, in `brother_lpdwrapper_BrGenML1`: 43 + 44 + > sh: grep: command not found 45 + sh: chmod: command not found 46 + sh: cp: command not found 47 + Error: /tmp/brBrGenML1rc_1850 :cannot open file !! 48 + sh: sed: command not found 49 + 50 + Fixed by use of a wrapper that brings `coreutils`, `gnused`, `gnugrep` 51 + in `PATH`. 43 52 */ 44 53 45 54 stdenv.mkDerivation rec { ··· 55 64 tar xfvz data.tar.gz 56 65 ''; 57 66 58 - buildInputs = [ cups perl brgenml1lpr ]; 67 + nativeBuildInputs = [ makeWrapper ]; 68 + buildInputs = [ cups perl coreutils gnused gnugrep brgenml1lpr ]; 69 + 70 + configurePhase = ":"; 59 71 buildPhase = ":"; 60 72 61 73 patchPhase = '' ··· 67 79 --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #" \ 68 80 --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};" 69 81 70 - # Fixing issue #2. 82 + # Fixing issue #1 and #2. 71 83 substituteInPlace $WRAPPER \ 72 84 --replace "\`cp " "\`cp -p " \ 73 85 --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \ ··· 78 90 --replace "/etc/cups/ppd" "$out/share/cups/model" 79 91 ''; 80 92 93 + 81 94 installPhase = '' 82 - CUPSFILTER=$out/lib/cups/filter 83 - CUPSPPD=$out/share/cups/model 95 + CUPSFILTER_DIR=$out/lib/cups/filter 96 + CUPSPPD_DIR=$out/share/cups/model 97 + CUPSWRAPPER_DIR=opt/brother/Printers/BrGenML1/cupswrapper 84 98 85 - CUPSWRAPPER=opt/brother/Printers/BrGenML1/cupswrapper 86 - mkdir -p $out/$CUPSWRAPPER 87 - cp -rp $CUPSWRAPPER/* $out/$CUPSWRAPPER 99 + mkdir -p $out/$CUPSWRAPPER_DIR 100 + cp -rp $CUPSWRAPPER_DIR/* $out/$CUPSWRAPPER_DIR 88 101 89 - mkdir -p $CUPSFILTER 90 - ln -s $out/$CUPSWRAPPER/brother_lpdwrapper_BrGenML1 $CUPSFILTER 102 + mkdir -p $CUPSFILTER_DIR 103 + # Fixing issue #4. 104 + makeWrapper \ 105 + $out/$CUPSWRAPPER_DIR/brother_lpdwrapper_BrGenML1 \ 106 + $CUPSFILTER_DIR/brother_lpdwrapper_BrGenML1 \ 107 + --prefix PATH : ${coreutils}/bin \ 108 + --prefix PATH : ${gnused}/bin \ 109 + --prefix PATH : ${gnugrep}/bin 91 110 92 - mkdir -p $CUPSPPD 93 - ln -s $out/$CUPSWRAPPER/brother-BrGenML1-cups-en.ppd $CUPSPPD 111 + mkdir -p $CUPSPPD_DIR 112 + ln -s $out/$CUPSWRAPPER_DIR/brother-BrGenML1-cups-en.ppd $CUPSPPD_DIR 94 113 ''; 95 114 96 115 dontPatchELF = true; 116 + dontStrip = true; 97 117 98 118 meta = { 99 119 description = "Brother BrGenML1 CUPS wrapper driver";
+1 -1
pkgs/top-level/all-packages.nix
··· 15793 15793 15794 15794 beep = callPackage ../misc/beep { }; 15795 15795 15796 - brgenml1lpr = callPackage ../misc/cups/drivers/brgenml1lpr {}; 15796 + brgenml1lpr = callPackage_i686 ../misc/cups/drivers/brgenml1lpr {}; 15797 15797 15798 15798 brgenml1cupswrapper = callPackage ../misc/cups/drivers/brgenml1cupswrapper {}; 15799 15799