Reproducible ocaml-source package (Closes: #779086)
authorStephane Glondu <steph@glondu.net>
Wed, 12 Aug 2015 12:11:12 +0000 (14:11 +0200)
committerStephane Glondu <steph@glondu.net>
Wed, 12 Aug 2015 12:11:26 +0000 (14:11 +0200)
Patch from Chris Lamb.

debian/rules

index 095e19219e7db454cd588a63d16700907dae2eb4..b29587ae6746ba87bc86dbf0ad29a21931249476 100755 (executable)
@@ -38,6 +38,8 @@ SRCTARBALL = $(PACKAGE)-source-$(OCAML_ABI).tar
 TESTDIR := debian/test-build
 TESTRULES := debian/rules DEB_TEST_BUILD_PREFIX=$(CURDIR)/$(TESTDIR)
 
+BUILD_DATE := $(shell dpkg-parsechangelog --show-field=Date)
+
 ifeq (,$(DEB_TEST_BUILD_PREFIX))
 ifneq (,$(findstring ocaml-source,$(ALL_PACKAGES)))
   TARBALL_TARGET = debian/$(SRCTARBALL)
@@ -110,7 +112,11 @@ $(TARBALL_TARGET): $(UPSTREAM_TARBALL)
 # Copy debian/patches
        cp -a debian/patches debian/$(DISTDIR)/debian-patches
 # Create the tarball and cleanup
-       tar -C debian -cf $@ $(DISTDIR)
+       cd debian && find $(DISTDIR) -not -type d -print0 | \
+               LC_ALL=C sort --zero-terminated | \
+               tar --create --null --files-from=- \
+                       --file=$(abspath $@) --mtime="$(BUILD_DATE)" \
+                       --owner=root --group=root --numeric-owner
        rm -Rf debian/$(DISTDIR)
 endif