[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1060769: foo2zjs: mitigate empty directory loss for usrmerge (DEP17 P6)



Source: foo2zjs
Version: 20200505dfsg0-2
Severity: normal
Tags: patch
User: helmutg@debian.org
Usertags: dep17p6

For the currently ongoing UsrMerge effort [1], paths installed into
/lib should move to /usr/lib.

printer-driver-foo2zjs installs the empty directory
/lib/firmware/hp. On a naive move to /usr, this directory would be
lost on upgrades (the "DEP17 P6" problem).

Please find a patch attached to install the relevant paths into /usr,
and a mitigation for the lost directory. I've chosen the postinst
way, as your package already had a postinst dealing with this path.

Note: this should not be backported to bookworm. If you intend to
backport, please revert the entire patch for the backport.

If your package will change for the t64 transition or otherwise
rename/split/move its binaries (packages) during trixie, please
then upload to experimental and get in touch with the UsrMerge
driver, please see the wiki [1].

Chris

[1] https://wiki.debian.org/UsrMerge
diff -Nru foo2zjs-20200505dfsg0/debian/changelog foo2zjs-20200505dfsg0/debian/changelog
--- foo2zjs-20200505dfsg0/debian/changelog	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/changelog	2024-01-13 23:36:22.000000000 +0100
@@ -1,3 +1,12 @@
+foo2zjs (20200505dfsg0-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Install into UsrMerged-layout (udev files, firmware directory).
+    Restore /usr/lib/firmware/hp as an empty directory in postinst if it
+    is lost on upgrades. (DEP17 P6) (Closes: #-1)
+
+ -- Chris Hofstaedtler <zeha@debian.org>  Sat, 13 Jan 2024 23:36:22 +0100
+
 foo2zjs (20200505dfsg0-2) unstable; urgency=medium
 
   * Remove myself from Uploaders
diff -Nru foo2zjs-20200505dfsg0/debian/NEWS foo2zjs-20200505dfsg0/debian/NEWS
--- foo2zjs-20200505dfsg0/debian/NEWS	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/NEWS	2024-01-13 23:36:22.000000000 +0100
@@ -1,7 +1,7 @@
 foo2zjs (20090908dfsg-2) unstable; urgency=low
 
   Starting with this version all HP firmwares are looked for into
-  /lib/firmware/hp/ instead of upstream /usr/share/foo2zjs/firmware/
+  /usr/lib/firmware/hp/ instead of upstream /usr/share/foo2zjs/firmware/
   (thus solving bug #517957).
 
   The upstream /usr/bin/getweb and /lib/udev/hplj1000 scripts have
diff -Nru foo2zjs-20200505dfsg0/debian/patches/0012-Use-the-same-firmware-folder-for-all-HP-LJ-printers.patch foo2zjs-20200505dfsg0/debian/patches/0012-Use-the-same-firmware-folder-for-all-HP-LJ-printers.patch
--- foo2zjs-20200505dfsg0/debian/patches/0012-Use-the-same-firmware-folder-for-all-HP-LJ-printers.patch	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/patches/0012-Use-the-same-firmware-folder-for-all-HP-LJ-printers.patch	2024-01-13 23:36:22.000000000 +0100
@@ -2,6 +2,8 @@
 Date: Tue, 4 Oct 2016 11:43:55 +0200
 Subject: Use the same firmware folder for all HP LJ printers
 
+[zeha@d.o 2024-01-13: changed to /usr/ for UsrMerge layout]
+
 ---
  hplj1000      |  6 ------
  hplj10xx.conf | 10 +++++-----
@@ -58,7 +60,7 @@
      match "vendor" "0x03f0";
      match "product" "0x3d17";
 -    action "cat /usr/share/foo2xqx/firmware/sihpP1005.dl > /dev/$device-name";
-+    action "cat /lib/firmware/hp/sihpP1005.dl > /dev/$device-name";
++    action "cat /usr/lib/firmware/hp/sihpP1005.dl > /dev/$device-name";
  };
  
  # Firmware download HP LaserJet P1006 printer
@@ -66,7 +68,7 @@
      match "vendor" "0x03f0";
      match "product" "0x3e17";
 -    action "cat /usr/share/foo2xqx/firmware/sihpP1006.dl > /dev/$device-name";
-+    action "cat /lib/firmware/hp/sihpP1006.dl > /dev/$device-name";
++    action "cat /usr/lib/firmware/hp/sihpP1006.dl > /dev/$device-name";
  };
  
  # Firmware download HP LaserJet P1007 printer
@@ -74,7 +76,7 @@
      match "vendor" "0x03f0";
      match "product" "0x4817";
 -    action "cat /usr/share/foo2xqx/firmware/sihpP1005.dl > /dev/$device-name";
-+    action "cat /lib/firmware/hp/sihpP1005.dl > /dev/$device-name";
++    action "cat /usr/lib/firmware/hp/sihpP1005.dl > /dev/$device-name";
  };
  
  # Firmware download HP LaserJet P1008 printer
@@ -82,7 +84,7 @@
      match "vendor" "0x03f0";
      match "product" "0x4917";
 -    action "cat /usr/share/foo2xqx/firmware/sihpP1006.dl > /dev/$device-name";
-+    action "cat /lib/firmware/hp/sihpP1006.dl > /dev/$device-name";
++    action "cat /usr/lib/firmware/hp/sihpP1006.dl > /dev/$device-name";
  };
  
  # Firmware download HP LaserJet P1505 printer
@@ -90,7 +92,7 @@
      match "vendor" "0x03f0";
      match "product" "0x3f17";
 -    action "cat /usr/share/foo2xqx/firmware/sihpP1505.dl > /dev/$device-name";
-+    action "cat /lib/firmware/hp/sihpP1505.dl > /dev/$device-name";
++    action "cat /usr/lib/firmware/hp/sihpP1505.dl > /dev/$device-name";
  };
  
  # Firmware download HP LaserJet 1000 printer
diff -Nru foo2zjs-20200505dfsg0/debian/patches/0013-Firmware-directory-is-lib-firmware-hp-Closes-517957.patch foo2zjs-20200505dfsg0/debian/patches/0013-Firmware-directory-is-lib-firmware-hp-Closes-517957.patch
--- foo2zjs-20200505dfsg0/debian/patches/0013-Firmware-directory-is-lib-firmware-hp-Closes-517957.patch	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/patches/0013-Firmware-directory-is-lib-firmware-hp-Closes-517957.patch	2024-01-13 23:36:22.000000000 +0100
@@ -1,6 +1,8 @@
 From: Didier Raboud <odyx@debian.org>
 Date: Tue, 4 Oct 2016 11:43:56 +0200
-Subject: Firmware directory is /lib/firmware/hp/ (Closes: #517957)
+Subject: Firmware directory is /usr/lib/firmware/hp/ (Closes: #517957)
+
+[zeha@d.o 2024-01-13: changed to /usr/ for UsrMerge layout]
 
 ---
  arm2hpdl.1in      | 2 +-
@@ -18,7 +20,7 @@
  .SH FILES
  .BR /usr/bin/arm2hpdl,
 -.BR /usr/share/foo2*/firmware/
-+.BR /lib/firmware/hp/*
++.BR /usr/lib/firmware/hp/*
  .SH SEE ALSO
  .BR foo2zjs (1)
  .SH "AUTHOR"
@@ -31,7 +33,7 @@
      inputname=$1
      outputname=$2
 -    $ARM2HPDL $inputname > /usr/share/foo2zjs/firmware/$outputname
-+    $ARM2HPDL $inputname > /lib/firmware/hp/$outputname
++    $ARM2HPDL $inputname > /usr/lib/firmware/hp/$outputname
      rm $inputname
  }
  
@@ -44,7 +46,7 @@
  # Directory to find downloadable HP firmware files sihpMMMM.dl
  #
 -FWDIR=/usr/share/foo2zjs/firmware
-+FWDIR=/lib/firmware/hp
++FWDIR=/usr/lib/firmware/hp
  
  #
  # Program used to determine USB printer id information
@@ -57,7 +59,7 @@
  DES:HP LaserJet 1020;
  
 -# cp /usr/share/foo2zjs/firmware/sihp1020.dl /dev/usb/lp0
-+# cp /lib/firmware/hp/sihp1020.dl /dev/usb/lp0
++# cp /usr/lib/firmware/hp/sihp1020.dl /dev/usb/lp0
  
  # usb_printerid /dev/usb/lp0
  GET_DEVICE_ID string:
@@ -66,7 +68,7 @@
  .SH FILES
  .BR /usr/bin/usb_printerid,
 -.BR /usr/share/foo2*/firmware/*
-+.BR /lib/firmware/hp/*
++.BR /usr/lib/firmware/hp/*
  .SH SEE ALSO
  .BR arm2hpdl (1)
  .SH "AUTHOR"
diff -Nru foo2zjs-20200505dfsg0/debian/patches/0028-Install-udev-rules-into-usrmerged-layout.patch foo2zjs-20200505dfsg0/debian/patches/0028-Install-udev-rules-into-usrmerged-layout.patch
--- foo2zjs-20200505dfsg0/debian/patches/0028-Install-udev-rules-into-usrmerged-layout.patch	1970-01-01 01:00:00.000000000 +0100
+++ foo2zjs-20200505dfsg0/debian/patches/0028-Install-udev-rules-into-usrmerged-layout.patch	2024-01-13 23:36:22.000000000 +0100
@@ -0,0 +1,16 @@
+From: Chris Hofstaedtler <zeha@debian.org>
+Date: Sat, 13 Jan 2024 23:45:13 +0100
+Subject: Install udev rules into usrmerged layout
+
+diff -u a/Makefile b/Makefile
+--- foo2zjs-20200505dfsg0.orig/Makefile
++++ foo2zjs-20200505dfsg0/Makefile
+@@ -943,7 +943,7 @@ install-gui:
+ 
+ USBDIR=/etc/hotplug/usb
+ UDEVDIR=/etc/udev/rules.d
+-LIBUDEVDIR=/lib/udev/rules.d
++LIBUDEVDIR=/usr/lib/udev/rules.d
+ RULES=hplj10xx.rules
+ #UDEVD=/sbin/udevd
+ # For FreeBSD 8.0
diff -Nru foo2zjs-20200505dfsg0/debian/patches/series foo2zjs-20200505dfsg0/debian/patches/series
--- foo2zjs-20200505dfsg0/debian/patches/series	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/patches/series	2024-01-13 23:36:22.000000000 +0100
@@ -25,3 +25,4 @@
 0025-Re-enable-manual-duplex-printing-for-Samsung-CLP-300.patch
 0026-Specify-FOOMATICDB-when-calling-foomatic-ppfile.patch
 0027-getweb-use-quirinux.org-mirror-as-the-original-site-.patch
+0028-Install-udev-rules-into-usrmerged-layout.patch
diff -Nru foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs-common.install foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs-common.install
--- foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs-common.install	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs-common.install	2024-01-13 23:36:22.000000000 +0100
@@ -1,7 +1,7 @@
 PPD/* usr/share/ppd/foo2zjs/
 debian/printer-driver-foo2zjs-common.ppd-updater /usr/share/cups/ppd-updaters/
 getweb usr/sbin
-hplj1000 lib/udev
+hplj1000 usr/lib/udev
 hplj1020.desktop usr/share/applications/
 hplj1020_icon.png usr/share/pixmaps
 usr/bin/foo2ddst-wrapper
diff -Nru foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.dirs foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.dirs
--- foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.dirs	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.dirs	2024-01-13 23:36:22.000000000 +0100
@@ -1 +1 @@
-/lib/firmware/hp/
+/usr/lib/firmware/hp/
diff -Nru foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.links foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.links
--- foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.links	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.links	2024-01-13 23:36:22.000000000 +0100
@@ -1,10 +1,10 @@
-lib/udev/hplj1000 lib/udev/hplj1005
-lib/udev/hplj1000 lib/udev/hplj1018
-lib/udev/hplj1000 lib/udev/hplj1020
-lib/udev/hplj1000 lib/udev/hpljP1005
-lib/udev/hplj1000 lib/udev/hpljP1006
-lib/udev/hplj1000 lib/udev/hpljP1007
-lib/udev/hplj1000 lib/udev/hpljP1008
-lib/udev/hplj1000 lib/udev/hpljP1505
-lib/udev/hplj1000 lib/udev/hpljP1505n
+usr/lib/udev/hplj1000 usr/lib/udev/hplj1005
+usr/lib/udev/hplj1000 usr/lib/udev/hplj1018
+usr/lib/udev/hplj1000 usr/lib/udev/hplj1020
+usr/lib/udev/hplj1000 usr/lib/udev/hpljP1005
+usr/lib/udev/hplj1000 usr/lib/udev/hpljP1006
+usr/lib/udev/hplj1000 usr/lib/udev/hpljP1007
+usr/lib/udev/hplj1000 usr/lib/udev/hpljP1008
+usr/lib/udev/hplj1000 usr/lib/udev/hpljP1505
+usr/lib/udev/hplj1000 usr/lib/udev/hpljP1505n
 usr/bin/psicc usr/bin/foo2zjs-icc2ps
diff -Nru foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.lintian-overrides foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.lintian-overrides
--- foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.lintian-overrides	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.lintian-overrides	2024-01-13 23:36:22.000000000 +0100
@@ -1,5 +1,5 @@
 # That's on purpose, getweb can go fetch these from the web
-package-contains-empty-directory lib/firmware/hp/
+package-contains-empty-directory usr/lib/firmware/hp/
 
 # Manpages are shipped in printer-driver-foo2zjs-common
 no-manual-page usr/bin/arm2hpdl
diff -Nru foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.postinst foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.postinst
--- foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.postinst	2021-09-02 14:45:45.000000000 +0200
+++ foo2zjs-20200505dfsg0/debian/printer-driver-foo2zjs.postinst	2024-01-13 23:36:22.000000000 +0100
@@ -3,9 +3,15 @@
 set -e
 
 if [ "$1" = configure ]; then
+    # Empty directory can be lost on upgrades from bookworm or earlier. (DEP17 P6)
+    if ! test -e /usr/lib/firmware/hp ; then
+        mkdir -p /usr/lib/firmware/hp
+    fi
+    # End
+
     # Move user-downloaded firmware files
     if ls /usr/share/foo2zjs/firmware/*.dl >/dev/null 2>/dev/null; then
-	mv /usr/share/foo2zjs/firmware/*.dl /lib/firmware/hp/ 2>/dev/null
+	mv /usr/share/foo2zjs/firmware/*.dl /usr/lib/firmware/hp/ 2>/dev/null
     fi
 fi
 

Reply to: