[25332] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r24906 - in trunk/debathena/debathena/config-package-dev: . debian examples/debathena-bin-example-1.1/debian

daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Sat Nov 6 19:20:58 2010

Date: Sat, 6 Nov 2010 19:20:30 -0400
From: Anders Kaseorg <andersk@MIT.EDU>
Message-Id: <201011062320.oA6NKUgE015890@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: andersk
Date: 2010-11-06 19:20:29 -0400 (Sat, 06 Nov 2010)
New Revision: 24906

Modified:
   trunk/debathena/debathena/config-package-dev/check-files.mk
   trunk/debathena/debathena/config-package-dev/config-package.mk
   trunk/debathena/debathena/config-package-dev/debian/changelog
   trunk/debathena/debathena/config-package-dev/divert.mk
   trunk/debathena/debathena/config-package-dev/divert.sh.in
   trunk/debathena/debathena/config-package-dev/examples/debathena-bin-example-1.1/debian/rules
Log:
In config-package-dev:
  * Fix a quoting bug that failed to disallow transformation of generated
    conffiles.  (Patch from Evan Broder.)
  * Remove DEB_UNDIVERT_VERSION_file and DEB_UNREMOVE_VERSION_file, and
    instead test for the undiverted file in the postinst.  (Patch from
    Evan Broder.)


Modified: trunk/debathena/debathena/config-package-dev/check-files.mk
===================================================================
--- trunk/debathena/debathena/config-package-dev/check-files.mk	2010-11-04 17:24:10 UTC (rev 24905)
+++ trunk/debathena/debathena/config-package-dev/check-files.mk	2010-11-06 23:20:29 UTC (rev 24906)
@@ -63,7 +63,7 @@
 $(call debian_check_files_tmp,%): truename = $(shell /usr/sbin/dpkg-divert --truename $(name))
 $(call debian_check_files_tmp,%): package = $(shell dpkg -S $(name) | grep -v "^diversion by" | cut -f1 -d:)
 $(call debian_check_files_tmp,%): $(truename)
-	[ -n $(package) ]
+	[ -n "$(package)" ]
 	mkdir -p $(@D)
 	cp "$(truename)" $@
 	set -e; \

Modified: trunk/debathena/debathena/config-package-dev/config-package.mk
===================================================================
--- trunk/debathena/debathena/config-package-dev/config-package.mk	2010-11-04 17:24:10 UTC (rev 24905)
+++ trunk/debathena/debathena/config-package-dev/config-package.mk	2010-11-06 23:20:29 UTC (rev 24906)
@@ -85,24 +85,17 @@
 # DEB_DIVERT_FILES.
 #
 # DEB_UNDIVERT_FILES_package += /path/file.divert
-# DEB_UNDIVERT_VERSION_/path/file.divert = 1.0-1
 #
 #   List of absolute paths to files whose diversions caused by
-# DEB_DIVERT_FILES are to be removed upon installing this package.
-# This is primarily useful for removing a now-unecessary diversion
-# provided by a previous version of this package on an upgrade.
+# DEB_DIVERT_FILES are to be removed upon installing this package, if
+# the diversions have been made on the target system.  This is
+# primarily useful for removing a now-unecessary diversion provided by
+# a previous version of this package on an upgrade.
 #
-#   The DEB_UNDIVERT_VERSION_file variable should be set to the
-# version number of this package at which you added
-# DEB_UNDIVERT_FILES_path/file.divert; it is used to avoid attempting
-# to remove the diversions again on future upgrades.
-#
 # DEB_UNREMOVE_FILES_package += /path/file
-# DEB_UNREMOVE_VERSION_/path/file = 1.0-1
 #
 #   This works like DEB_UNDIVERT_FILES_package, except that it only
-# removes the diversion (not a symlink) and the version number is
-# specified with DEB_UNREMOVE_VERSION_/path/file.
+# removes the diversion (not a symlink).
 
 ifndef _cdbs_rules_config_package
 _cdbs_rules_config_package = 1

Modified: trunk/debathena/debathena/config-package-dev/debian/changelog
===================================================================
--- trunk/debathena/debathena/config-package-dev/debian/changelog	2010-11-04 17:24:10 UTC (rev 24905)
+++ trunk/debathena/debathena/config-package-dev/debian/changelog	2010-11-06 23:20:29 UTC (rev 24906)
@@ -1,13 +1,21 @@
 config-package-dev (4.12) unstable; urgency=low
 
+  [ Tim Abbott ]
   * Allow specifying DEB_TRANSFORM_SCRIPT_$package_$file in case you want
     multiple binary packages transforming the same file differently.
     (Thanks to Evan Broder for this patch).
   * Add a decode script for undoing the file to virtual package name
     transformation. (Thanks to Patrick Hurst for writing decode).
 
- -- Tim Abbott <tabbott@mit.edu>  Sun, 09 May 2010 14:14:50 -0400
+  [ Anders Kaseorg ]
+  * Fix a quoting bug that failed to disallow transformation of generated
+    conffiles.  (Patch from Evan Broder.)
+  * Remove DEB_UNDIVERT_VERSION_file and DEB_UNREMOVE_VERSION_file, and
+    instead test for the undiverted file in the postinst.  (Patch from
+    Evan Broder.)
 
+ -- Anders Kaseorg <andersk@mit.edu>  Sat, 06 Nov 2010 19:02:52 -0400
+
 config-package-dev (4.11) unstable; urgency=low
 
   * Fix marking transform scripts as executable when

Modified: trunk/debathena/debathena/config-package-dev/divert.mk
===================================================================
--- trunk/debathena/debathena/config-package-dev/divert.mk	2010-11-04 17:24:10 UTC (rev 24905)
+++ trunk/debathena/debathena/config-package-dev/divert.mk	2010-11-06 23:20:29 UTC (rev 24906)
@@ -53,6 +53,10 @@
 # foo.divert.divert-orig
 divert_files_replace_name = $(shell echo $(1) | perl -pe 's/(.*)\Q$(DEB_DIVERT_EXTENSION)\E/$$1$(2)/')
 
+# Transform a full path into the path it should be diverted to if it's
+# removed
+remove_files_name = /usr/share/$(cdbs_curpkg)/$(shell $(DEB_DIVERT_ENCODER) $(1))
+
 debian-divert/%: package = $(subst debian-divert/,,$@)
 debian-divert/%: divert_files = $(DEB_DIVERT_FILES_$(package)) $(DEB_TRANSFORM_FILES_$(package))
 debian-divert/%: divert_remove_files = $(DEB_REMOVE_FILES_$(package))
@@ -70,24 +74,14 @@
 	    $(if $(divert_files_all), \
 		echo 'if [ "$$1" = "configure" ]; then'; \
 		$(foreach file,$(divert_undivert_files), \
-		    $(if $(DEB_UNDIVERT_VERSION_$(file)),,\
-			echo "ERROR!  Missing undivert version for $(file)!">&2; exit 1;) \
-		    echo -n "    if [ -n \"\$$2\" ] && dpkg --compare-versions \"\$$2\" '<<' "; \
-		    echo "'$(DEB_UNDIVERT_VERSION_$(file))'; then"; \
-		    echo "        undivert_unlink $(call divert_files_replace_name,$(file), )"; \
-		    echo "    fi";) \
+		    echo "    check_undivert_unlink $(call divert_files_replace_name,$(file), )"; )\
 		$(foreach file,$(divert_unremove_files), \
-		    $(if $(DEB_UNREMOVE_VERSION_$(file)),,\
-			echo "ERROR!  Missing unremove version for $(file)!">&2; exit 1;) \
-		    echo -n "    if [ -n \"\$$2\" ] && dpkg --compare-versions \"\$$2\" '<<' "; \
-		    echo "'$(DEB_UNREMOVE_VERSION_$(file))'; then"; \
-		    echo "        undivert_unremove $(file)"; \
-		    echo "    fi";) \
+		    echo "    check_undivert_unremove $(file) $(call remove_files_name,$(file))"; )\
 		$(foreach file,$(divert_files), \
 		    echo "    divert_link $(call divert_files_replace_name,$(file), )";) \
 		$(foreach file,$(divert_remove_files), \
 		    mkdir -p debian/$(cdbs_curpkg)/usr/share/$(cdbs_curpkg); \
-		    echo "    divert_remove $(file) /usr/share/$(cdbs_curpkg)/`$(DEB_DIVERT_ENCODER) $(file)`";) \
+		    echo "    divert_remove $(file) $(call remove_files_name,$(file))";) \
 		echo 'fi'; \
 	    ) \
 	} >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper

Modified: trunk/debathena/debathena/config-package-dev/divert.sh.in
===================================================================
--- trunk/debathena/debathena/config-package-dev/divert.sh.in	2010-11-04 17:24:10 UTC (rev 24905)
+++ trunk/debathena/debathena/config-package-dev/divert.sh.in	2010-11-06 23:20:29 UTC (rev 24906)
@@ -107,3 +107,27 @@
     undivert_unlink_divert "$file"
 }
 
+check_undivert_unlink()
+{
+    prefix=$1
+    suffix=$2
+
+    file=$prefix$suffix
+    ourfile=$prefix$ours$suffix
+    theirfile=$prefix$theirs$suffix
+
+    if dpkg-divert --list "$package" | \
+	grep -xFq "diversion of $file to $theirfile by $package"; then
+	undivert_unlink "$prefix" "$suffix"
+    fi
+}
+
+check_undivert_unremove()
+{
+    file=$1
+    removedfile=$2
+    if dpkg-divert --list "$package" | \
+	grep -xFq "diversion of $file to $removedfile by $package"; then
+	undivert_unremove "$file"
+    fi
+}

Modified: trunk/debathena/debathena/config-package-dev/examples/debathena-bin-example-1.1/debian/rules
===================================================================
--- trunk/debathena/debathena/config-package-dev/examples/debathena-bin-example-1.1/debian/rules	2010-11-04 17:24:10 UTC (rev 24905)
+++ trunk/debathena/debathena/config-package-dev/examples/debathena-bin-example-1.1/debian/rules	2010-11-06 23:20:29 UTC (rev 24906)
@@ -13,12 +13,11 @@
 DEB_DH_LINK_debathena-bin-example += \
 	/usr/share/man/man1/less.debathena-orig.1.gz /usr/share/man/man1/less.debathena.1.gz
 
-# Remove elinks diversion on upgrade from version(s) prior to 1.1
+# Remove elinks diversion on upgrade if it was previously in place on
+# the target system
 DEB_UNDIVERT_FILES_debathena-bin-example += /usr/bin/elinks.debathena
-DEB_UNDIVERT_VERSION_/usr/bin/elinks.debathena = 1.1
 # and the man page
 DEB_UNDIVERT_FILES_debathena-bin-example += /usr/share/man/man1/elinks.debathena.1.gz
-DEB_UNDIVERT_VERSION_/usr/share/man/man1/elinks.debathena.1.gz = 1.1
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/rules/config-package.mk


home help back first fref pref prev next nref lref last post