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"}: 2 3 /* 4 [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html). ··· 21 22 1. > Error: /tmp/brBrGenML1rc_15642 :cannot open file !! 23 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. 28 29 2. > touch: cannot touch '/tmp/BrGenML1_latest_print_info': Permission denied 30 31 - TODO: Address. 32 33 3. > perl: warning: Falling back to the standard locale ("C"). 34 ··· 40 perl: warning: Setting locale failed. 41 42 TODO: Address. 43 */ 44 45 stdenv.mkDerivation rec { ··· 55 tar xfvz data.tar.gz 56 ''; 57 58 - buildInputs = [ cups perl brgenml1lpr ]; 59 buildPhase = ":"; 60 61 patchPhase = '' ··· 67 --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #" \ 68 --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};" 69 70 - # Fixing issue #2. 71 substituteInPlace $WRAPPER \ 72 --replace "\`cp " "\`cp -p " \ 73 --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \ ··· 78 --replace "/etc/cups/ppd" "$out/share/cups/model" 79 ''; 80 81 installPhase = '' 82 - CUPSFILTER=$out/lib/cups/filter 83 - CUPSPPD=$out/share/cups/model 84 85 - CUPSWRAPPER=opt/brother/Printers/BrGenML1/cupswrapper 86 - mkdir -p $out/$CUPSWRAPPER 87 - cp -rp $CUPSWRAPPER/* $out/$CUPSWRAPPER 88 89 - mkdir -p $CUPSFILTER 90 - ln -s $out/$CUPSWRAPPER/brother_lpdwrapper_BrGenML1 $CUPSFILTER 91 92 - mkdir -p $CUPSPPD 93 - ln -s $out/$CUPSWRAPPER/brother-BrGenML1-cups-en.ppd $CUPSPPD 94 ''; 95 96 dontPatchELF = true; 97 98 meta = { 99 description = "Brother BrGenML1 CUPS wrapper driver";
··· 1 + { stdenv, fetchurl, makeWrapper, cups, perl, coreutils, gnused, gnugrep 2 + , brgenml1lpr, debugLvl ? "0"}: 3 4 /* 5 [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html). ··· 22 23 1. > Error: /tmp/brBrGenML1rc_15642 :cannot open file !! 24 25 + Fixed. 26 27 2. > touch: cannot touch '/tmp/BrGenML1_latest_print_info': Permission denied 28 29 + Fixed. 30 31 3. > perl: warning: Falling back to the standard locale ("C"). 32 ··· 38 perl: warning: Setting locale failed. 39 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`. 52 */ 53 54 stdenv.mkDerivation rec { ··· 64 tar xfvz data.tar.gz 65 ''; 66 67 + nativeBuildInputs = [ makeWrapper ]; 68 + buildInputs = [ cups perl coreutils gnused gnugrep brgenml1lpr ]; 69 + 70 + configurePhase = ":"; 71 buildPhase = ":"; 72 73 patchPhase = '' ··· 79 --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #" \ 80 --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};" 81 82 + # Fixing issue #1 and #2. 83 substituteInPlace $WRAPPER \ 84 --replace "\`cp " "\`cp -p " \ 85 --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \ ··· 90 --replace "/etc/cups/ppd" "$out/share/cups/model" 91 ''; 92 93 + 94 installPhase = '' 95 + CUPSFILTER_DIR=$out/lib/cups/filter 96 + CUPSPPD_DIR=$out/share/cups/model 97 + CUPSWRAPPER_DIR=opt/brother/Printers/BrGenML1/cupswrapper 98 99 + mkdir -p $out/$CUPSWRAPPER_DIR 100 + cp -rp $CUPSWRAPPER_DIR/* $out/$CUPSWRAPPER_DIR 101 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 110 111 + mkdir -p $CUPSPPD_DIR 112 + ln -s $out/$CUPSWRAPPER_DIR/brother-BrGenML1-cups-en.ppd $CUPSPPD_DIR 113 ''; 114 115 dontPatchELF = true; 116 + dontStrip = true; 117 118 meta = { 119 description = "Brother BrGenML1 CUPS wrapper driver";
+1 -1
pkgs/top-level/all-packages.nix
··· 15793 15794 beep = callPackage ../misc/beep { }; 15795 15796 - brgenml1lpr = callPackage ../misc/cups/drivers/brgenml1lpr {}; 15797 15798 brgenml1cupswrapper = callPackage ../misc/cups/drivers/brgenml1cupswrapper {}; 15799
··· 15793 15794 beep = callPackage ../misc/beep { }; 15795 15796 + brgenml1lpr = callPackage_i686 ../misc/cups/drivers/brgenml1lpr {}; 15797 15798 brgenml1cupswrapper = callPackage ../misc/cups/drivers/brgenml1cupswrapper {}; 15799