From 3aab360ac188b6f8dd734d5db6beb29d21fa7b25 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 4 Oct 2008 04:29:16 +0000 Subject: [PATCH] Use set -e in multi-statement Makefile commands. git-svn-id: svn+ssh://svn.mit.edu/athena/trunk/debathena/debathena/config-package-dev@23197 728af825-273c-0410-89f9-f7d3b574a069 --- check-files.mk | 1 + debconf-divert.mk | 15 +++++++++------ debian/changelog | 6 +++++- divert.mk | 17 ++++++++++------- transform-files.mk | 1 + 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/check-files.mk b/check-files.mk index d43b0a2..e7e2ca6 100644 --- a/check-files.mk +++ b/check-files.mk @@ -66,6 +66,7 @@ $(call debian_check_files_tmp,%): $(truename) [ -n $(package) ] mkdir -p $(@D) cp "$(truename)" $@ + set -e; \ md5=$$(dpkg-query --showformat='$${Conffiles}\n' --show $(package) | \ sed -n 's,^ $(name) \([0-9a-f]*\)$$,\1 $@, p'); \ if [ -n "$$md5" ]; then \ diff --git a/debconf-divert.mk b/debconf-divert.mk index eb132c1..fbb587c 100644 --- a/debconf-divert.mk +++ b/debconf-divert.mk @@ -28,7 +28,8 @@ DEB_DEBCONF_HACK_PACKAGES += $(foreach package,$(DEB_ALL_PACKAGES), \ $(if $(wildcard debian/$(package).debconf-hack),$(package))) $(patsubst %,debian-debconf-hack/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: debian-debconf-hack/%: - ( \ + set -e; \ + { \ cat $(DEB_DEBCONF_HACK_SCRIPT); \ echo 'if [ ! -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ echo ' debconf_get $(shell cut -d' ' -f2 debian/$(cdbs_curpkg).debconf-hack) >/var/cache/$(cdbs_curpkg).debconf-save'; \ @@ -36,21 +37,23 @@ $(patsubst %,debian-debconf-hack/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: debian-debco sed 's/$$/ true/' debian/$(cdbs_curpkg).debconf-hack; \ echo 'EOF'; \ echo 'fi'; \ - ) >> $(CURDIR)/debian/$(cdbs_curpkg).preinst.debhelper - ( \ + } >> $(CURDIR)/debian/$(cdbs_curpkg).preinst.debhelper + set -e; \ + { \ cat $(DEB_DEBCONF_HACK_SCRIPT); \ echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ echo ' debconf_set > $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper - ( \ + } >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper + set -e; \ + { \ cat $(DEB_DEBCONF_HACK_SCRIPT); \ echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ echo ' debconf_set > $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper + } >> $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper $(patsubst %,binary-fixup/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: binary-fixup/%: debian-debconf-hack/% diff --git a/debian/changelog b/debian/changelog index 5c5d2c2..b296456 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,13 @@ config-package-dev (4.9) unstable; urgency=low + [ Tim Abbott ] * Fix destdir handling for multiple binary packages in DEB_TRANSFORM_FILES. - -- Tim Abbott Fri, 3 Oct 2008 23:43:49 -0400 + [ Anders Kaseorg ] + * Use set -e in multi-statement Makefile commands. + + -- Anders Kaseorg Sat, 04 Oct 2008 00:28:23 -0400 config-package-dev (4.8) unstable; urgency=low diff --git a/divert.mk b/divert.mk index e387dce..7324bd4 100644 --- a/divert.mk +++ b/divert.mk @@ -64,7 +64,8 @@ $(patsubst %,debian-divert/%,$(DEB_DIVERT_PACKAGES)) :: debian-divert/%: # Writing shell scripts in makefiles sucks. Remember to $$ shell # variables and include \ at the end of each line. # Add code to postinst to add/remove diversions as appropriate - ( \ + set -e; \ + { \ sed 's/#PACKAGE#/$(cdbs_curpkg)/g; s/#DEB_DIVERT_EXTENSION#/$(DEB_DIVERT_EXTENSION)/g' $(DEB_DIVERT_SCRIPT); \ $(if $(divert_files_all), \ echo 'if [ "$$1" = "configure" ]; then'; \ @@ -89,9 +90,10 @@ $(patsubst %,debian-divert/%,$(DEB_DIVERT_PACKAGES)) :: debian-divert/%: echo " divert_remove $(file) /usr/share/$(cdbs_curpkg)/`$(DEB_DIVERT_ENCODER) $(file)`";) \ echo 'fi'; \ ) \ - ) >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper + } >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper # Add code to prerm script to undo diversions when package is removed. - ( \ + set -e; \ + { \ sed 's/#PACKAGE#/$(cdbs_curpkg)/g; s/#DEB_DIVERT_EXTENSION#/$(DEB_DIVERT_EXTENSION)/g' $(DEB_DIVERT_SCRIPT); \ $(if $(divert_files_thispkg), \ echo 'if [ "$$1" = "remove" ]; then'; \ @@ -101,21 +103,22 @@ $(patsubst %,debian-divert/%,$(DEB_DIVERT_PACKAGES)) :: debian-divert/%: echo " undivert_unremove $(file) $(cdbs_curpkg)";) \ echo 'fi'; \ ) \ - ) >> $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper + } >> $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper # Add an encoding of the names of the diverted files to the Provides: # and Conflicts: lists. This prevents two packages diverting the same # file from being installed simultaneously (it cannot work, and this # produces a much less ugly error). Requires in debian/control: # Provides: $(diverted-files) # Conflicts: $(diverted-files) - ( \ + set -e; \ + { \ echo -n "diverted-files="; \ $(foreach file,$(divert_files_thispkg),\ echo -n "diverts-"; \ ${DEB_DIVERT_ENCODER} "$(call divert_files_replace_name,$(file))"; \ echo -n ", ";) \ - echo \ - ) >> $(CURDIR)/debian/$(cdbs_curpkg).substvars + echo; \ + } >> $(CURDIR)/debian/$(cdbs_curpkg).substvars $(patsubst %,binary-post-install/%,$(DEB_DIVERT_PACKAGES)) :: binary-post-install/%: debian-divert/% diff --git a/transform-files.mk b/transform-files.mk index b8c9a9d..c4a96d8 100644 --- a/transform-files.mk +++ b/transform-files.mk @@ -41,6 +41,7 @@ $(call debian_transform_files,%): $(call debian_check_files,%) debian/transform_$(notdir $(call undebian_transform_files,$@))) < $< > $@ $(patsubst %,binary-install/%,$(DEB_ALL_PACKAGES)) :: binary-install/%: + set -e; \ $(foreach file,$(DEB_TRANSFORM_FILES_$(cdbs_curpkg)), \ install -d debian/$(cdbs_curpkg)/$(dir $(file)); \ cp -a $(call debian_transform_files,$(file)) \ -- 2.45.0