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

Bug#1054411: libopenni2-0: move udev rules to /usr



Package: libopenni2-0
Version: 2.2.0.33+dfsg-15
Tags: patch moreinfo
User: helmutg@debian.org
Usertags: dep17p7

Hi Jochen,

I set out to add dh-sequence-movetousr to openni2 and I ended up not
doing it. It is one file that is to be moved and that file happens to
trigger a DEP17P7 problem. For this reason, I added a DEP17M10
mitigation via protective diversions. I note that this is quite
repetitive in maintainer scripts and wonder whether there should be some
automation. On the flip side I expect a low two-digit number of cases
where this is needed. It also needs a lintian override.

When combining this unconditional mitigation with dh_movetousr, there is
a risk of keeping the mitigation when performing the backport reverting
the move. When doing that, the file will end up missing after an upgrade
(because the unpack would be diverted and then removed). So the
automatic reversion of dh_movetousr is actually harmful here. Moreover
if we'd then do another version of openni2 and backport that (again
reverting the move), the upgrade from that backport to trixie would also
be broken, because the version check in preinst no longer matches. So
instead, I am unconditionally moving the file here even in
bookworm-backports. As far as I understand it, udev processes both
locations, so this is fine and if it does not, bookworm is eventually
merged anyway. I also explicitly made it work such that if
dh_installudev moves, it'll not FTBFS.

So I think this is how it works best, but maybe this is not the final
solution and hence I'm tagging it moreinfo. What do you think?

Helmut
diff -Nru openni2-2.2.0.33+dfsg/debian/changelog openni2-2.2.0.33+dfsg/debian/changelog
--- openni2-2.2.0.33+dfsg/debian/changelog	2021-02-05 20:15:35.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/changelog	2023-10-23 14:41:21.000000000 +0200
@@ -1,3 +1,9 @@
+openni2 (2.2.0.33+dfsg-16) UNRELEASED; urgency=medium
+
+  * Move files to /usr. (Closes: #-1)
+
+ -- Helmut Grohne <helmut@subdivi.de>  Mon, 23 Oct 2023 14:41:21 +0200
+
 openni2 (2.2.0.33+dfsg-15) unstable; urgency=medium
 
   * Add patch for Java 17 (Closes: #982019)
diff -Nru openni2-2.2.0.33+dfsg/debian/control openni2-2.2.0.33+dfsg/debian/control
--- openni2-2.2.0.33+dfsg/debian/control	2020-12-03 19:21:15.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/control	2023-10-23 14:41:21.000000000 +0200
@@ -7,7 +7,7 @@
 Build-Depends: debhelper-compat (= 13),
                freeglut3-dev,
                libusb-1.0-0-dev,
-               python3,
+               python3:any,
                doxygen,
                graphviz,
                libjpeg-dev,
diff -Nru openni2-2.2.0.33+dfsg/debian/libopenni2-0.lintian-overrides openni2-2.2.0.33+dfsg/debian/libopenni2-0.lintian-overrides
--- openni2-2.2.0.33+dfsg/debian/libopenni2-0.lintian-overrides	1970-01-01 01:00:00.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/libopenni2-0.lintian-overrides	2023-10-23 14:41:21.000000000 +0200
@@ -0,0 +1,2 @@
+# DEP17P7 mitigation
+diversion-for-unknown-file lib/udev/rules.d/60-libopenni2-0.rules [*]
diff -Nru openni2-2.2.0.33+dfsg/debian/libopenni2-0.postinst openni2-2.2.0.33+dfsg/debian/libopenni2-0.postinst
--- openni2-2.2.0.33+dfsg/debian/libopenni2-0.postinst	1970-01-01 01:00:00.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/libopenni2-0.postinst	2023-10-23 14:39:34.000000000 +0200
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if test "$1" = configure && test -n "$(dpkg-divert --list /lib/udev/rules.d/60-libopenni2-0.rules)"; then
+	rm -f /lib/udev/rules.d/60-libopenni2-0.rules.usr-is-merged
+	dpkg-divert --no-rename --package usr-is-merged --remove /lib/udev/rules.d/60-libopenni2-0.rules
+fi
+
+#DEBHELPER#
diff -Nru openni2-2.2.0.33+dfsg/debian/libopenni2-0.postrm openni2-2.2.0.33+dfsg/debian/libopenni2-0.postrm
--- openni2-2.2.0.33+dfsg/debian/libopenni2-0.postrm	1970-01-01 01:00:00.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/libopenni2-0.postrm	2023-10-23 14:41:21.000000000 +0200
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if test "$1" = abort-upgrade -o "$1" = upgrade-failed -o "$1" = remove && test -n "$(dpkg-divert --list /lib/udev/rules.d/60-libopenni2-0.rules)"; then
+	rm -f /lib/udev/rules.d/60-libopenni2-0.rules.usr-is-merged
+	dpkg-divert --no-rename --package usr-is-merged --remove /lib/udev/rules.d/60-libopenni2-0.rules
+fi
+
+#DEBHELPER#
diff -Nru openni2-2.2.0.33+dfsg/debian/libopenni2-0.preinst openni2-2.2.0.33+dfsg/debian/libopenni2-0.preinst
--- openni2-2.2.0.33+dfsg/debian/libopenni2-0.preinst	1970-01-01 01:00:00.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/libopenni2-0.preinst	2023-10-23 14:41:21.000000000 +0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+if test "$1" = upgrade && dpkg --compare-versions "$2" lt 2.2.0.33+dfsg-16; then
+	dpkg-divert --no-rename --package usr-is-merged --divert /lib/udev/rules.d/60-libopenni2-0.rules.usr-is-merged --add /lib/udev/rules.d/60-libopenni2-0.rules
+fi
+
+#DEBHELPER#
diff -Nru openni2-2.2.0.33+dfsg/debian/rules openni2-2.2.0.33+dfsg/debian/rules
--- openni2-2.2.0.33+dfsg/debian/rules	2020-12-03 19:11:13.000000000 +0100
+++ openni2-2.2.0.33+dfsg/debian/rules	2023-10-23 14:41:21.000000000 +0200
@@ -8,5 +8,8 @@
 	cd Source/Documentation && python3 ./Runme.py
 	cd Bin/*-Release/ && mv NiViewer NiViewer2
 
+execute_after_dh_installudev:
+	set -e; if test -d debian/libopenni2-0/lib/udev/rules.d; then mv debian/libopenni2-0/lib/udev debian/libopenni2-0/usr/lib; fi
+
 override_dh_shlibdeps:
 	dh_shlibdeps -- --ignore-missing-info

Reply to: