]> andersk Git - config-package-dev.git/commitdiff
* Fix a quoting bug that failed to disallow transformation of generated
authorAnders Kaseorg <andersk@mit.edu>
Sat, 6 Nov 2010 23:20:29 +0000 (23:20 +0000)
committerAnders Kaseorg <andersk@mit.edu>
Sat, 6 Nov 2010 23:20:29 +0000 (23:20 +0000)
    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.)

git-svn-id: svn+ssh://svn.mit.edu/athena/trunk/debathena/debathena/config-package-dev@24906 728af825-273c-0410-89f9-f7d3b574a069

check-files.mk
config-package.mk
debian/changelog
divert.mk
divert.sh.in
examples/debathena-bin-example-1.1/debian/rules

index e7e2ca6d24cc41fb34a99b1b92b6f4edbdd9902f..70a58205f157e80c461c9c99a2fee36a5e1a193c 100644 (file)
@@ -63,7 +63,7 @@ $(call debian_check_files_tmp,%): name = $(call debian_check_files_check,$(targe
 $(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; \
index 2f6711266719ec88c1690aea66539e6333e4926b..eed82e68fefa271cea242125161cdf5adf6f423e 100644 (file)
 # 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.
-#
-#   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_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.
 #
 # 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
index e11d49f51b5a85b8d3e1594cf51837c61e071b30..685a7ecc76fc311cb1dd276fc965b1eb7af06ea4 100644 (file)
@@ -1,12 +1,20 @@
 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
 
index 7324bd4564a377f396bd5d88bf9ed86b078ba508..ffa4d3116edd8de2fa346ba3300e68fe703dbd70 100644 (file)
--- a/divert.mk
+++ b/divert.mk
@@ -53,6 +53,10 @@ endif
 # 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 @@ $(patsubst %,debian-divert/%,$(DEB_DIVERT_PACKAGES)) :: debian-divert/%:
            $(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
index b705812712a6906ad563292b8302a0b44b951f1e..7e7659ee79efbb2ba4e460d2f6aa1d88f348edb8 100644 (file)
@@ -107,3 +107,27 @@ undivert_unremove()
     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
+}
index 50a8249540928a7c1dc8c192ec7020b95f4617e0..7a2191489e42457b7feb1afa5180da63f6a8a6f6 100755 (executable)
@@ -13,12 +13,11 @@ DEB_DIVERT_FILES_debathena-bin-example += /usr/share/man/man1/less.debathena.1.g
 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
This page took 0.356325 seconds and 5 git commands to generate.