Package: open-infrastructure-system-build
Version: 20190301-lts1-5
Severity: serious
Tags: patch
User: helm...@ebian.org
Usertags: dep17

Hi,

I'm sorry to tell you that my earlier patches for duplicating diversions
affected by the /usr-move are subtly wrong. There are known failures in
live-build which uses very similar code. The full story can be found at
https://lists.debian.org/debian-devel/2025/01/msg00125.html.

As a result, I'm attaching an updated upstream/0002-usr-move.patch
(meant to replace the current one). Main changes:
 * Pass --rename to one diversion call only depending on whether the
   affected file presently is aliased or not.
 * Bump the removal markers back to forky, because this code will likely
   be used to install trixie for a while and thus may be affected during
   the forky cycle still.
 * Update more references of the aliased names to the canonical names.

I have little clue to how test these changes and there are no
autopkgtests either. Would you be able to give them a try before
uploading? They are quite similar to how its done in other affected
packages though.

Helmut
--- open-infrastructure-system-tools-20190301-lts1.orig/system-build/scripts/build/chroot_dpkg
+++ open-infrastructure-system-tools-20190301-lts1/system-build/scripts/build/chroot_dpkg
@@ -41,15 +41,28 @@
 		Create_lockfile .lock
 
 		# Create custom start-stop-daemon program
-		Chroot chroot dpkg-divert --rename --quiet --add /sbin/start-stop-daemon
+		# begin-remove-after: released:forky
+		# In the bookworm to trixie upgrade, dpkg moves
+		# start-stop-daemon from /sbin to /usr/sbin. Duplicate the
+		# diversion to cover both. DEP17 P3 M18
+		if Chroot chroot dpkg -S /sbin/start-stop-daemon >/dev/null 2>&1; then
+			Chroot chroot dpkg-divert --rename --quiet --add --divert /sbin/start-stop-daemon.distrib.usr-is-merged
+			Chroot chroot dpkg-divert --no-rename --quiet --add /usr/sbin/start-stop-daemon
+		else
+		# end-remove-after
+		Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/start-stop-daemon
+		# begin-remove-after: released:forky
+			Chroot chroot dpkg-divert --no-rename --quiet --add --divert /sbin/start-stop-daemon.distrib.usr-is-merged
+		fi
+		# end-remove-after
 
-cat > chroot/sbin/start-stop-daemon << EOF
+cat > chroot/usr/sbin/start-stop-daemon << EOF
 #!/bin/sh
 
 exit 0
 EOF
 
-		chmod 755 chroot/sbin/start-stop-daemon
+		chmod 755 chroot/usr/sbin/start-stop-daemon
 
 		# Disable dpkg syncing
 
@@ -71,7 +84,7 @@
 		;;
 
 	remove)
-		Echo_message "Deconfiguring file /sbin/start-stop-daemon"
+		Echo_message "Deconfiguring file /usr/sbin/start-stop-daemon"
 
 		# Checking lock file
 		Check_lockfile .lock
@@ -89,8 +102,11 @@
 		Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/flash-kernel
 
 		# Remove custom start-stop-daemon program
-		rm -f chroot/sbin/start-stop-daemon
+		rm -f chroot/usr/sbin/start-stop-daemon
+		# begin-remove-after: released:forky
 		Chroot chroot dpkg-divert --rename --quiet --remove /sbin/start-stop-daemon
+		# end-remove-after
+		Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/start-stop-daemon
 
 		# Remove dpkg sync configuration
 		rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build
--- open-infrastructure-system-tools-20190301-lts1.orig/system-build/scripts/build/chroot_hostname
+++ open-infrastructure-system-tools-20190301-lts1/system-build/scripts/build/chroot_hostname
@@ -14,7 +14,7 @@
 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
 
 # Setting static variables
-DESCRIPTION="$(Echo 'manage /bin/hostname')"
+DESCRIPTION="$(Echo 'manage /usr/bin/hostname')"
 HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"
 
@@ -44,17 +44,30 @@
 		echo "localhost.localdomain" > chroot/etc/hostname
 
 		# Create custom hostname
-		Echo_message "Configuring file /bin/hostname"
+		Echo_message "Configuring file /usr/bin/hostname"
 
-		Chroot chroot dpkg-divert --rename --quiet --add /bin/hostname
+		# begin-remove-after: released:forky
+		# In the bookworm to trixie upgrade, hostname moves hostname
+		# from /bin to /usr/bin. Duplicate the diversion to cover both.
+		# DEP17 P3 M18
+		if Chroot chroot dpkg -S /bin/hostname >/dev/null 2>&1; then
+			Chroot chroot dpkg-divert --rename --quiet --add --divert /bin/hostname.distrib.usr-is-merged /bin/hostname
+			Chroot chroot dpkg-divert --no-rename --quiet --add /usr/bin/hostname
+		else
+		# end-remove-after
+		Chroot chroot dpkg-divert --rename --quiet --add /usr/bin/hostname
+		# begin-remove-after: released:forky
+			Chroot chroot dpkg-divert --no-rename --quiet --add --divert /bin/hostname.distrib.usr-is-merged /bin/hostname
+		fi
+		# end-remove-after
 
-cat > chroot/bin/hostname << EOF
+cat > chroot/usr/bin/hostname << EOF
 #!/bin/sh
 
 echo "localhost.localdomain"
 EOF
 
-		chmod 755 chroot/bin/hostname
+		chmod 755 chroot/usr/bin/hostname
 
 		# Creating stage file
 		Create_stagefile .build/chroot_hostname
@@ -75,11 +88,14 @@
 			cp -a config/includes.chroot/etc/hostname chroot/etc/hostname
 		fi
 
-		Echo_message "Deconfiguring file /bin/hostname"
+		Echo_message "Deconfiguring file /usr/bin/hostname"
 
 		# Remove custom hostname
-		rm -f chroot/bin/hostname
+		rm -f chroot/usr/bin/hostname
+		# begin-remove-after: released:forky
 		Chroot chroot dpkg-divert --rename --quiet --remove /bin/hostname
+		# end-remove-after
+		Chroot chroot dpkg-divert --rename --quiet --remove /usr/bin/hostname
 
 		# Removing stage file
 		rm -f .build/chroot_hostname

Reply via email to