Source: cvm
Version: 0.96-1.2
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps fileordering umask
X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that cvm could not be built reproducibly.
Build timestamps are embedded in gzip headers, 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.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/implicit b/debian/implicit
index 57a444a..b009aa1 100644
--- a/debian/implicit
+++ b/debian/implicit
@@ -35,7 +35,7 @@ deb-checkuid:
 	    debian/$*/usr/share/doc/$*/changelog'
 	@test -s debian/$*/usr/share/doc/$*/changelog || \
 	  sh -cx 'rm -f debian/$*/usr/share/doc/$*/changelog'
-	@gzip -9 debian/$*/usr/share/doc/$*/changelog*
+	@gzip -9n debian/$*/usr/share/doc/$*/changelog*
 %.deb-docs-docs:
 	@for i in `cat debian/$*.docs 2>/dev/null || :`; do \
 	  sh -cx "install -m0644 $$i debian/$*/usr/share/doc/$*/" || exit 1; \
@@ -46,7 +46,7 @@ deb-checkuid:
 	@if test -r debian/$*.NEWS.Debian; then \
 	  sh -cx 'install -m0644 debian/$*.NEWS.Debian \
 	    debian/$*/usr/share/doc/$*/NEWS.Debian && \
-	      gzip -9 debian/$*/usr/share/doc/$*/NEWS.Debian'; \
+	      gzip -9n debian/$*/usr/share/doc/$*/NEWS.Debian'; \
 	fi
 %.deb-docs-examples:
 	@rm -rf debian/$*/usr/share/doc/$*/examples
@@ -79,7 +79,7 @@ deb-checkuid:
 	: debian/$*/DEBIAN/md5sums
 	@rm -f debian/$*/DEBIAN/md5sums
 	@cd debian/$* && find * -path 'DEBIAN' -prune -o \
-	  -type f -exec md5sum {} >>DEBIAN/md5sums \;
+	  -type f -exec md5sum {} \; | LC_ALL=C sort >>DEBIAN/md5sums
 %.deb-DEBIAN: %.deb-checkdir %.deb-DEBIAN-base %.deb-DEBIAN-scripts \
 	  %.deb-DEBIAN-md5sums
 	: debian/$*/DEBIAN/ ok
diff --git a/debian/rules b/debian/rules
index db4c430..addac7d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -90,24 +90,26 @@ install: deb-checkdir deb-checkuid build-stamp
 	 cvm-qmail.8 cvm-testclient.8 cvm-unix.8 cvm-vmailmgr.8; do \
 	  install -m0644 debian/$$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
 	done
-	gzip -9 '$(DIR)'/usr/share/man/man8/*.8
+	gzip -9n '$(DIR)'/usr/share/man/man8/*.8
 	install -d -m0755 '$(DIR)'/usr/share/man/man7
 	install -m0644 debian/cvm-sql.7 '$(DIR)'/usr/share/man/man7/
-	gzip -9 '$(DIR)'/usr/share/man/man7/*.7
+	gzip -9n '$(DIR)'/usr/share/man/man7/*.7
 	# cvm-mysql
 	install -d -m0755 '$(DIR)'-mysql/usr/bin
 	mv '$(DIR)'/usr/bin/cvm-mysql* '$(DIR)'-mysql/usr/bin/
 	install -d -m0755 '$(DIR)'-mysql/usr/share/man/man8
 	install -m0644 debian/cvm-mysql.8 '$(DIR)'-mysql/usr/share/man/man8/
-	gzip -9 '$(DIR)'-mysql/usr/share/man/man8/*.8
+	gzip -9n '$(DIR)'-mysql/usr/share/man/man8/*.8
 	# cvm-pgsql
 	install -d -m0755 '$(DIR)'-pgsql/usr/bin
 	mv '$(DIR)'/usr/bin/cvm-pgsql* '$(DIR)'-pgsql/usr/bin/
 	install -d -m0755 '$(DIR)'-pgsql/usr/share/man/man8
 	install -m0644 debian/cvm-pgsql.8 '$(DIR)'-pgsql/usr/share/man/man8/
-	gzip -9 '$(DIR)'-pgsql/usr/share/man/man8/*.8
+	gzip -9n '$(DIR)'-pgsql/usr/share/man/man8/*.8
 	# changelog
 	rm -f changelog && ln -s ChangeLog changelog
+	# fix directory permissions
+	find '$(DIR)' '$(LDIR)'-dev -type d -print0 | xargs -0r chmod 0755
 
 binary: binary-indep binary-arch
 binary-indep:

Attachment: signature.asc
Description: PGP signature

Reply via email to