Package: taggrepper
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: fileordering umask
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org,
spectran...@riseup.net

Dear Maintainer,

While working on the "reproducible builds" effort [1], we have noticed
that taggrepper could not be built reproducibly.
Specifically, the permissions of some directories are influenced by the
umask and the order of the md5sums file can vary.

The attached patch fixes those issues.

Best,
Valerie

[1]: https://wiki.debian.org/ReproducibleBuilds

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.4.0-rc8-touchpad (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

--- rules	2016-12-03 11:26:39.675091955 -0500
+++ rules	2016-12-03 13:30:25.447018646 -0500
@@ -72,6 +72,8 @@
 install: checkroot build
 	$(checkdir)
 	$(MAKE) DESTDIR=$(CURDIR)/$(PACKAGE_DIR) install
+	# fix directory permissions
+	find '$(PACKAGE_DIR)' -type d -print0 | xargs -0r chmod 0755
 
 # Build architecture-independent files here.
 binary-indep: checkroot build install
@@ -97,7 +99,7 @@
 endif
 	dpkg-shlibdeps $(PACKAGE_DIR)/usr/bin/taggrepper
 	$(INSTALL_DIR) $(PACKAGE_DIR)/DEBIAN
-	cd $(PACKAGE_DIR) && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
+	cd $(PACKAGE_DIR) && find * -type f ! -regex '^DEBIAN/.*' -print0 | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
 	dpkg-gencontrol -p$(PACKAGE_NAME) -P$(PACKAGE_DIR)
 	find $(PACKAGE_DIR) -newermt "@$$SOURCE_DATE_EPOCH" -print0 | \
 		xargs -0r touch --no-dereference --date="@$$SOURCE_DATE_EPOCH"

Reply via email to