[Reproducible-builds] Bug#787126: nis: please make the build reproducible

Dhole dhole at openmailbox.org
Thu May 28 21:09:13 UTC 2015


Source: nis
Version: 3.17-34
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that nis could not be built reproducibly.

The attached patch removes extra timestamps from the gzipped docs and
fixes the files mtime before building the binary packages. Once applied,
nis can be built reproducibly in our current experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds
-- 
Dhole
-------------- next part --------------
diff --git a/nis-3.17/debian/rules b/nis-3.17/debian/rules
index fd15d77..11b3fa2 100755
--- a/nis-3.17/debian/rules
+++ b/nis-3.17/debian/rules
@@ -15,6 +15,7 @@ YPBIND=ypbind-mt-1.20.1
 SHELL=/bin/bash
 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+BUILD_DATE=$(shell dpkg-parsechangelog --show-field Date)
 
 ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
         CFLAGS = "-O2 -Wall -g"
@@ -132,13 +133,13 @@ binary-arch:	build checkroot
 	install -g root -m 755 debian/reportbug-script $(DEBDIR)/usr/share/bug/nis/script
 
 	# Documentation.
-	gzip -9f $(DEBDIR)/usr/share/man/man*/*
+	gzip -9fn $(DEBDIR)/usr/share/man/man*/*
 	install -g root -m 644 debian/nis.debian.howto $(DEBDIR)/usr/share/doc/nis
 	install -g root -m 644 debian/changelog \
 		$(DEBDIR)/usr/share/doc/nis/changelog.Debian
 	install -g root -m 644 $(YPSERV)/ChangeLog \
 		$(DEBDIR)/usr/share/doc/nis/changelog
-	gzip -9f $(DEBDIR)/usr/share/doc/nis/* || true
+	gzip -9fn $(DEBDIR)/usr/share/doc/nis/* || true
 	install -g root -m 644 debian/COPYRIGHT \
 	  $(DEBDIR)/usr/share/doc/$(p)/copyright
 	install -g root -m 644 debian/nis.default \
@@ -157,6 +158,8 @@ binary-arch:	build checkroot
 	# Use some binaries to generate the dependencies.
 	dpkg-shlibdeps `find $(DEBDIR) -type f -exec file '{}' ';' | grep ELF | awk -F: '{print $$1}'`
 	dpkg-gencontrol -isp
+	find $(DEBDIR) -depth -newermt '$(BUILD_DATE)' -print0 | \
+		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
 	dpkg --build $(DEBDIR) ..
 	rm -rf $(DEBDIR)
 


More information about the Reproducible-builds mailing list