[Piuparts-commits] [piuparts] 03/06: scripts-debug-{remove, purge}: generalize, multiarch support

Holger Levsen holger at layer-acht.org
Tue Dec 20 18:54:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 45c10644399df5860b5ed7891f084616dca06d15
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Dec 20 17:00:17 2016 +0100

    scripts-debug-{remove,purge}: generalize, multiarch support
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 .../scripts-debug-prerm/pre_remove_prerm_set-x     | 17 -------------
 .../scripts-debug-purge/post_remove_postrm_set-x   | 29 ++++++++++++++--------
 .../pre_remove_prerm_postrm_set-x                  | 28 +++++++++++++++++++++
 debian/changelog                                   |  2 ++
 debian/piuparts.maintscript                        |  1 +
 5 files changed, 50 insertions(+), 27 deletions(-)

diff --git a/custom-scripts/scripts-debug-prerm/pre_remove_prerm_set-x b/custom-scripts/scripts-debug-prerm/pre_remove_prerm_set-x
deleted file mode 100755
index 3fa53e1..0000000
--- a/custom-scripts/scripts-debug-prerm/pre_remove_prerm_set-x
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-set -e
-
-for target in ${PIUPARTS_OBJECTS%%=*}
-do
-	pkg=${target}
-	prerm=/var/lib/dpkg/info/$pkg.prerm
-	if [ -f $prerm ]; then
-		if head -n 1 $prerm | grep -qE '/bin/(ba)?sh' ; then
-			echo "DEBUG PRERM REMOVE: enabling 'set -x' in $pkg.prerm"
-			sed -i '2 i set -x' $prerm
-		else
-			echo "Unsupported script type in $prerm:"
-			head -n 1 $prerm
-		fi
-	fi
-done
diff --git a/custom-scripts/scripts-debug-purge/post_remove_postrm_set-x b/custom-scripts/scripts-debug-purge/post_remove_postrm_set-x
index 31f7428..a5449fd 100755
--- a/custom-scripts/scripts-debug-purge/post_remove_postrm_set-x
+++ b/custom-scripts/scripts-debug-purge/post_remove_postrm_set-x
@@ -1,17 +1,26 @@
 #!/bin/sh
 set -e
 
-for target in ${PIUPARTS_OBJECTS%%=*}
-do
-	pkg=${target}
-	postrm=/var/lib/dpkg/info/$pkg.postrm
-	if [ -f $postrm ]; then
-		if head -n 1 $postrm | grep -qE '/bin/(ba)?sh' ; then
-			echo "DEBUG POSTRM PURGE: enabling 'set -x' in $pkg.postrm"
-			sed -i '2 i set -x' $postrm
+set_minus_x()
+{
+	local script=$1
+
+	if [ -f $script ]; then
+		if head -n 1 $script | grep -qE '/bin/(ba)?sh' ; then
+			echo "DEBUG PURGE: enabling 'set -x' in ${script##*/}"
+			sed -i '2 i set -x' $script
 		else
-			echo "Unsupported script type in $postrm:"
-			head -n 1 $postrm
+			echo "Unsupported script type in $script:"
+			head -n 1 $script
 		fi
 	fi
+}
+
+arch=$(dpkg --print-architecture)
+
+for target in ${PIUPARTS_OBJECTS%%=*}
+do
+	pkg=${target}
+	set_minus_x /var/lib/dpkg/info/$pkg.postrm
+	set_minus_x /var/lib/dpkg/info/$pkg:$arch.postrm
 done
diff --git a/custom-scripts/scripts-debug-remove/pre_remove_prerm_postrm_set-x b/custom-scripts/scripts-debug-remove/pre_remove_prerm_postrm_set-x
new file mode 100755
index 0000000..67adb8c
--- /dev/null
+++ b/custom-scripts/scripts-debug-remove/pre_remove_prerm_postrm_set-x
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -e
+
+set_minus_x()
+{
+	local script=$1
+
+	if [ -f $script ]; then
+		if head -n 1 $script | grep -qE '/bin/(ba)?sh' ; then
+			echo "DEBUG REMOVE: enabling 'set -x' in ${script##*/}"
+			sed -i '2 i set -x' $script
+		else
+			echo "Unsupported script type in $script:"
+			head -n 1 $script
+		fi
+	fi
+}
+
+arch=$(dpkg --print-architecture)
+
+for target in ${PIUPARTS_OBJECTS%%=*}
+do
+	pkg=${target}
+	set_minus_x /var/lib/dpkg/info/$pkg.prerm
+	set_minus_x /var/lib/dpkg/info/$pkg.postrm
+	set_minus_x /var/lib/dpkg/info/$pkg:$arch.prerm
+	set_minus_x /var/lib/dpkg/info/$pkg:$arch.postrm
+done
diff --git a/debian/changelog b/debian/changelog
index 6f3a192..bbd3ec2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ piuparts (0.74) UNRELEASED; urgency=medium
   * pre_install_database-server: Use default-mysql-* from stretch onwards.
   * scripts/post-{install,purge}-exceptions: Wait for dkms progress indicator
     to terminate.
+  * custom-scripts/scripts-debug-{remove,purge}: Improved debugging of
+    maintainer scripts during package removal.
   * known_problems/debsums_mismatch_*.conf: Report missing symlinks and
     directories.
 
diff --git a/debian/piuparts.maintscript b/debian/piuparts.maintscript
index 99f6131..926c699 100644
--- a/debian/piuparts.maintscript
+++ b/debian/piuparts.maintscript
@@ -2,3 +2,4 @@ rm_conffile /etc/piuparts/piuparts.conf 0.45~
 rm_conffile /etc/piuparts/scripts-leftovers/post_purge_dbconfig_cleanup 0.47~
 mv_conffile /etc/piuparts/scripts/post_install_find_bad_permissions /etc/piuparts/scripts/pre_remove_50_find_bad_permissions 0.47~
 rm_conffile /etc/piuparts/scripts/post_remove_extras 0.61~
+rm_conffile /etc/piuparts/scripts-debug-prerm/pre_remove_prerm_set-x 0.74~

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list