Skip to content

Commit ef239ab

Browse files
committed
Fixes for reproducible source package
Fix handling non-top level "debian" dir. Force files to be not older than latest changelog entry - otherwise source archive would include git checkout time (not reproducible). Set GIT_TARBALL_NAME, so Makefile.generic will create the orig tarball, instead of duplicating the call here. Fixes QubesOS/qubes-issues#1244
1 parent 7e6c887 commit ef239ab

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

Makefile.debian

+5-16
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ PACKAGE_LIST = $(DEBIAN_BUILD_DIRS)
5050
DIST_BUILD_DIR = /home/user
5151

5252
ifneq (1,$(NO_ARCHIVE))
53-
GIT_TARBALL_NAME ?= ../$(shell $(DEBIAN_PARSER) changelog --package-release-name $(ORIG_SRC)/$(firstword $(DEBIAN_BUILD_DIRS))/changelog 2>/dev/null).orig.tar.gz
53+
ifeq ($(shell cat $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/source/format 2>/dev/null),3.0 (quilt))
54+
GIT_TARBALL_NAME ?= $(DEBIAN_BUILD_DIRS)/../../$(shell $(DEBIAN_PARSER) changelog --package-release-name $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/changelog 2>/dev/null).orig.tar.xz
55+
endif
5456
endif
5557

5658
### Variables determined by package's Makefile.builder
@@ -216,21 +218,6 @@ endif
216218
rm -rf $(CHROOT_DIR)/$(DIST_SRC)/rpm/*
217219
rm -rf $(CHROOT_DIR)/$(DIST_SRC)/pkgs/*
218220

219-
# Create orig.tar.xz if needed
220-
if [ "$(shell cat $(CHROOT_DEBIAN_DIR)/source/format)" = "3.0 (quilt)" ]; then \
221-
cd $(CHROOT_DIR)/$(DIST_SRC); \
222-
if ! ls $(CHROOT_DIR)/$(DIST_SRC)/../$(release_name).orig.* 2>/dev/null >&1; then \
223-
SOURCE_DATE_EPOCH=$(shell $(DEBIAN_PARSER) changelog \
224-
--source-date-epoch $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/changelog); \
225-
find . -path ./debian -prune -o -print0 |\
226-
grep -zv '^\./\.git\|~$$' |\
227-
LC_ALL=C sort -z |\
228-
tar --no-recursion --null -T - \
229-
--owner=0 --group=0 --numeric-owner \
230-
--mtime="@$${SOURCE_DATE_EPOCH}" -cJf ../$(release_name).orig.tar.xz; \
231-
fi; \
232-
fi
233-
234221
ifneq (,$(INCREMENT_DEVEL_VERSIONS))
235222
# Break the hardlink - keep modified debian/changelog only inside of chroot
236223
cp $(CHROOT_DEBIAN_DIR)/changelog $(CHROOT_DEBIAN_DIR)/changelog.copy
@@ -256,6 +243,8 @@ else
256243
cd $(CHROOT_DIR)/$(DIST_SRC)/$(PACKAGE)/..; export LC_ALL=C DEBFULLNAME=Builder DEBEMAIL=user@localhost; \
257244
debchange -t -l+$(DIST_TAG)u "Build for $(DIST)"; debchange -t --force-distribution -r -D $(DIST) $(DIST)
258245
$(DEBIAN_PLUGIN_DIR)/scripts/clamp-changelog-entry-date $(CHROOT_DEBIAN_DIR)/changelog
246+
find $(CHROOT_DIR)/$(DIST_SRC) \! -newer $(CHROOT_DEBIAN_DIR)/changelog \
247+
-exec touch --no-dereference --reference=$(CHROOT_DEBIAN_DIR)/changelog {} +
259248
endif
260249

261250
sudo $(CHROOT_ENV) chroot $(CHROOT_DIR) su $(RUN_AS_USER) -c 'cd $(DIST_SRC_DEBIAN_DIR)/..; export LC_ALL=C; dpkg-buildpackage -sa -uc -us'

0 commit comments

Comments
 (0)