Ticket #549: config-package-dev_trac549.diff
File config-package-dev_trac549.diff, 5.3 KB (added by broder, 15 years ago) |
---|
-
divert.mk
53 53 # foo.divert.divert-orig 54 54 divert_files_replace_name = $(shell echo $(1) | perl -pe 's/(.*)\Q$(DEB_DIVERT_EXTENSION)\E/$$1$(2)/') 55 55 56 # Transform a full path into the path it should be diverted to if it's 57 # removed 58 remove_files_name = /usr/share/$(cdbs_curpkg)/$(shell $(DEB_DIVERT_ENCODER) $(1)) 59 56 60 debian-divert/%: package = $(subst debian-divert/,,$@) 57 61 debian-divert/%: divert_files = $(DEB_DIVERT_FILES_$(package)) $(DEB_TRANSFORM_FILES_$(package)) 58 62 debian-divert/%: divert_remove_files = $(DEB_REMOVE_FILES_$(package)) … … 70 74 $(if $(divert_files_all), \ 71 75 echo 'if [ "$$1" = "configure" ]; then'; \ 72 76 $(foreach file,$(divert_undivert_files), \ 73 $(if $(DEB_UNDIVERT_VERSION_$(file)),,\ 74 echo "ERROR! Missing undivert version for $(file)!">&2; exit 1;) \ 75 echo -n " if [ -n \"\$$2\" ] && dpkg --compare-versions \"\$$2\" '<<' "; \ 76 echo "'$(DEB_UNDIVERT_VERSION_$(file))'; then"; \ 77 echo " undivert_unlink $(call divert_files_replace_name,$(file), )"; \ 78 echo " fi";) \ 77 echo " check_undivert_unlink $(call divert_files_replace_name,$(file), )"; )\ 79 78 $(foreach file,$(divert_unremove_files), \ 80 $(if $(DEB_UNREMOVE_VERSION_$(file)),,\ 81 echo "ERROR! Missing unremove version for $(file)!">&2; exit 1;) \ 82 echo -n " if [ -n \"\$$2\" ] && dpkg --compare-versions \"\$$2\" '<<' "; \ 83 echo "'$(DEB_UNREMOVE_VERSION_$(file))'; then"; \ 84 echo " undivert_unremove $(file)"; \ 85 echo " fi";) \ 79 echo " check_undivert_unremove $(file) $(call remove_files_name,$(file))"; )\ 86 80 $(foreach file,$(divert_files), \ 87 81 echo " divert_link $(call divert_files_replace_name,$(file), )";) \ 88 82 $(foreach file,$(divert_remove_files), \ 89 83 mkdir -p debian/$(cdbs_curpkg)/usr/share/$(cdbs_curpkg); \ 90 echo " divert_remove $(file) /usr/share/$(cdbs_curpkg)/`$(DEB_DIVERT_ENCODER) $(file)`";) \84 echo " divert_remove $(file) $(call remove_files_name,$(file))";) \ 91 85 echo 'fi'; \ 92 86 ) \ 93 87 } >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper -
config-package.mk
85 85 # DEB_DIVERT_FILES. 86 86 # 87 87 # DEB_UNDIVERT_FILES_package += /path/file.divert 88 # DEB_UNDIVERT_VERSION_/path/file.divert = 1.0-189 88 # 90 89 # List of absolute paths to files whose diversions caused by 91 # DEB_DIVERT_FILES are to be removed upon installing this package. 92 # This is primarily useful for removing a now-unecessary diversion 93 # provided by a previous version of this package on an upgrade. 90 # DEB_DIVERT_FILES are to be removed upon installing this package, if 91 # the diversions have been made on the target system. This is 92 # primarily useful for removing a now-unecessary diversion provided by 93 # a previous version of this package on an upgrade. 94 94 # 95 # The DEB_UNDIVERT_VERSION_file variable should be set to the96 # version number of this package at which you added97 # DEB_UNDIVERT_FILES_path/file.divert; it is used to avoid attempting98 # to remove the diversions again on future upgrades.99 #100 95 # DEB_UNREMOVE_FILES_package += /path/file 101 # DEB_UNREMOVE_VERSION_/path/file = 1.0-1102 96 # 103 97 # This works like DEB_UNDIVERT_FILES_package, except that it only 104 # removes the diversion (not a symlink) and the version number is 105 # specified with DEB_UNREMOVE_VERSION_/path/file. 98 # removes the diversion (not a symlink). 106 99 107 100 ifndef _cdbs_rules_config_package 108 101 _cdbs_rules_config_package = 1 -
divert.sh.in
107 107 undivert_unlink_divert "$file" 108 108 } 109 109 110 check_undivert_unlink() 111 { 112 prefix=$1 113 suffix=$2 114 115 file=$prefix$suffix 116 ourfile=$prefix$ours$suffix 117 theirfile=$prefix$theirs$suffix 118 119 if dpkg-divert --list "$package" | \ 120 grep -xFq "diversion of $file to $theirfile by $package"; then 121 undivert_unlink "$prefix" "$suffix" 122 fi 123 } 124 125 check_undivert_unremove() 126 { 127 file=$1 128 removedfile=$2 129 if dpkg-divert --list "$package" | \ 130 grep -xFq "diversion of $file to $removedfile by $package"; then 131 undivert_unremove "$file" 132 fi 133 } -
examples/debathena-bin-example-1.1/debian/rules
13 13 DEB_DH_LINK_debathena-bin-example += \ 14 14 /usr/share/man/man1/less.debathena-orig.1.gz /usr/share/man/man1/less.debathena.1.gz 15 15 16 # Remove elinks diversion on upgrade from version(s) prior to 1.1 16 # Remove elinks diversion on upgrade if it was previously in place on 17 # the target system 17 18 DEB_UNDIVERT_FILES_debathena-bin-example += /usr/bin/elinks.debathena 18 DEB_UNDIVERT_VERSION_/usr/bin/elinks.debathena = 1.119 19 # and the man page 20 20 DEB_UNDIVERT_FILES_debathena-bin-example += /usr/share/man/man1/elinks.debathena.1.gz 21 DEB_UNDIVERT_VERSION_/usr/share/man/man1/elinks.debathena.1.gz = 1.122 21 23 22 include /usr/share/cdbs/1/rules/debhelper.mk 24 23 include /usr/share/cdbs/1/rules/config-package.mk