debian/rules: Checksum only the source name and version from debian/changelog

Checksumming the whole of debian/changelog when deciding whether to
run gencontrol.py results in (a) frequent changes to control.md5sum
and (b) the need to invoke various targets twice during development.

I originally made this change to address (a), which would be an
annoyance if and when we start using dgit.  However, fixing (b) is a
nice benefit regardless of whether we do that.
This commit is contained in:
Ben Hutchings 2018-10-03 03:02:18 +01:00
parent bac0d015fd
commit c1578ede72
2 changed files with 14 additions and 5 deletions

2
debian/changelog vendored
View File

@ -5,6 +5,8 @@ linux (4.19~rc7-1~exp2) UNRELEASED; urgency=medium
* udeb: Define mtd-core-modules package to contain MTD core if not built-in
* udeb: Move MTD core from nic-modules to mtd-core-modules
* debian/changelog: Move older entries to changelog.old
* debian/rules: Checksum only the source name and version from
debian/changelog
[ Karsten Merker ]
* [riscv64] Build a kernel image and udebs for riscv64 (Closes: #908161)

17
debian/rules vendored
View File

@ -5,6 +5,7 @@ SOURCE := $(shell dpkg-parsechangelog -SSource)
VERSION := $(shell dpkg-parsechangelog -SVersion)
VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,')
VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -rne 's,.*\+b([0-9]+)$$,\1,p')
VERSION_SOURCE := $(patsubst %+b$(VERSION_BINNMU),%,$(VERSION))
include /usr/share/dpkg/architecture.mk
@ -91,17 +92,23 @@ clean: debian/control
rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/lib/python/debian_linux/__pycache__ $$(find debian -maxdepth 1 -type d -name 'linux-*') debian/*-modules-*-di* debian/kernel-image-*-di* debian/xen-linux-system-* debian/*-tmp
dh_clean
CONTROL_FILES = debian/changelog $(wildcard debian/templates/*.in)
CONTROL_FILES = $(BUILD_DIR)/version-info $(wildcard debian/templates/*.in)
CONTROL_FILES += debian/config/defines $(wildcard debian/config/*/defines) $(wildcard debian/config/*/*/defines)
CONTROL_FILES += debian/installer/kernel-versions debian/installer/package-list
# debian/bin/gencontrol.py uses debian/changelog as input, but the
# output only depends on the source name and version. To avoid
# frequent changes to debian/control.md5sum, include only those fields
# in the checksum.
$(BUILD_DIR)/version-info: debian/changelog
mkdir -p $(@D)
printf >$@ 'Source: %s\nVersion: %s\n' $(SOURCE) $(VERSION_SOURCE)
debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES)
ifeq ($(wildcard debian/control.md5sum),)
$(MAKE) -f debian/rules debian/control-real
else ifeq ($(VERSION_BINNMU),)
md5sum --check debian/control.md5sum --status || \
$(MAKE) -f debian/rules debian/control-real
else
grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
md5sum --check debian/control.md5sum --status || \
$(MAKE) -f debian/rules debian/control-real
endif