summary refs log tree commit diff
path: root/pkgs/misc/cups/drivers
diff options
context:
space:
mode:
authorRaymond Gauthier <jraygauthier@gmail.com>2016-04-15 23:50:05 -0400
committerRaymond Gauthier <jraygauthier@gmail.com>2016-04-16 00:25:17 -0400
commitdbe2c50a662d47b15c13ff6ce676b2d51164b529 (patch)
tree27e36393b6b0d595bd3dc47d99d70dda01b334f8 /pkgs/misc/cups/drivers
parent63be2a75159af6ec891f2788ce1a9dca65765b30 (diff)
downloadnixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.tar
nixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.tar.gz
nixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.tar.bz2
nixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.tar.lz
nixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.tar.xz
nixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.tar.zst
nixpkgs-dbe2c50a662d47b15c13ff6ce676b2d51164b529.zip
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`.
Diffstat (limited to 'pkgs/misc/cups/drivers')
-rw-r--r--pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix60
1 files changed, 40 insertions, 20 deletions
diff --git a/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix b/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix
index e4ac510dd14..3623f78eb20 100644
--- a/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix
+++ b/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, cups, perl, brgenml1lpr, debugLvl ? "0"}:
+{ stdenv, fetchurl, makeWrapper, cups, perl, coreutils, gnused, gnugrep
+, brgenml1lpr, debugLvl ? "0"}:
 
 /*
     [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
@@ -21,14 +22,11 @@
 
      1.  >  Error: /tmp/brBrGenML1rc_15642 :cannot open file !!
 
-        This is a non fatal issue. The job will still be printed. However, not sure
-        what kind of information could be lost.
-
-        There should be a more elegant way to patch this.
+        Fixed.
 
      2.  >  touch: cannot touch '/tmp/BrGenML1_latest_print_info': Permission denied
 
-        TODO: Address.
+        Fixed.
 
      3.  >  perl: warning: Falling back to the standard locale ("C").
     
@@ -40,6 +38,17 @@
             perl: warning: Setting locale failed.
 
         TODO: Address.
+
+     4. Since nixos 16.03 release, in `brother_lpdwrapper_BrGenML1`:
+
+        > sh: grep: command not found
+          sh: chmod: command not found
+          sh: cp: command not found
+          Error: /tmp/brBrGenML1rc_1850 :cannot open file !!
+          sh: sed: command not found
+
+        Fixed by use of a wrapper that brings `coreutils`, `gnused`, `gnugrep`
+        in `PATH`.
 */
 
 stdenv.mkDerivation rec {
@@ -55,7 +64,10 @@ stdenv.mkDerivation rec {
     tar xfvz data.tar.gz
   '';
 
-  buildInputs = [ cups perl brgenml1lpr ];
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ cups perl coreutils gnused gnugrep brgenml1lpr ];
+
+  configurePhase = ":";
   buildPhase = ":";
 
   patchPhase = ''
@@ -67,7 +79,7 @@ stdenv.mkDerivation rec {
       --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #" \
       --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
 
-    # Fixing issue #2.
+    # Fixing issue #1 and #2.
     substituteInPlace $WRAPPER \
       --replace "\`cp " "\`cp -p " \
       --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \
@@ -78,22 +90,30 @@ stdenv.mkDerivation rec {
       --replace "/etc/cups/ppd" "$out/share/cups/model"
   '';
 
-  installPhase = ''
-    CUPSFILTER=$out/lib/cups/filter
-    CUPSPPD=$out/share/cups/model
-
-    CUPSWRAPPER=opt/brother/Printers/BrGenML1/cupswrapper
-    mkdir -p $out/$CUPSWRAPPER
-    cp -rp $CUPSWRAPPER/* $out/$CUPSWRAPPER
 
-    mkdir -p $CUPSFILTER
-    ln -s $out/$CUPSWRAPPER/brother_lpdwrapper_BrGenML1 $CUPSFILTER
-
-    mkdir -p $CUPSPPD
-    ln -s $out/$CUPSWRAPPER/brother-BrGenML1-cups-en.ppd $CUPSPPD
+  installPhase = ''
+    CUPSFILTER_DIR=$out/lib/cups/filter
+    CUPSPPD_DIR=$out/share/cups/model
+    CUPSWRAPPER_DIR=opt/brother/Printers/BrGenML1/cupswrapper
+
+    mkdir -p $out/$CUPSWRAPPER_DIR
+    cp -rp $CUPSWRAPPER_DIR/* $out/$CUPSWRAPPER_DIR
+
+    mkdir -p $CUPSFILTER_DIR
+    # Fixing issue #4.
+    makeWrapper \
+      $out/$CUPSWRAPPER_DIR/brother_lpdwrapper_BrGenML1 \
+      $CUPSFILTER_DIR/brother_lpdwrapper_BrGenML1 \
+      --prefix PATH : ${coreutils}/bin \
+      --prefix PATH : ${gnused}/bin \
+      --prefix PATH : ${gnugrep}/bin
+
+    mkdir -p $CUPSPPD_DIR
+    ln -s $out/$CUPSWRAPPER_DIR/brother-BrGenML1-cups-en.ppd $CUPSPPD_DIR
   '';
 
   dontPatchELF = true;
+  dontStrip = true;
 
   meta = {
     description = "Brother BrGenML1 CUPS wrapper driver";