Source: sed
Version: 4.2.2-4
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps

Hi!

While working on the “reproducible builds” effort [1], it has been
discovered that sed could not be built reproducibly.

The first attached patch will ensure a reproducible mtimes for files
shipped by the binary packges. The second patch will tell gzip to stop
recording the current time in the created gizp files.

After applying these patches, sed can be built reproducibly with the
current experimental framework.

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

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
From 1db7d62ca5c6cc5c8fbbc0396c84e5ca3dc07685 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lu...@debian.org>
Date: Thu, 1 Jan 2015 11:23:36 +0100
Subject: [PATCH 1/2] Fix mtimes before building binary packages

To enable sed to be build reproducibly, mtimes of any files
created after the date of the latest debian/changelog entry
will be changed to that date.
---
 debian/rules | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/debian/rules b/debian/rules
index c64cb86..26b3fda 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,6 +15,8 @@ CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
 CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
 LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
 
+BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')
+
 INSTALL = install
 INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
 INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
@@ -109,6 +111,8 @@ endif
 # Build the packgae
 	dpkg-shlibdeps -dPre-Depends $(tmpdir)/bin/sed
 	dpkg-gencontrol -isp
+	find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
+		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
 	dpkg --build debian/tmp ..
 
 checkroot:
-- 
1.9.1

From ed5ef291881e8ab71c6af4a34c26de22afe2110e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lu...@debian.org>
Date: Thu, 1 Jan 2015 11:21:25 +0100
Subject: [PATCH 2/2] Stop recording current time when using gzip

To enable sed to be build reproducibly, we stop recording
the current time when using gzip.
---
 debian/rules | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/debian/rules b/debian/rules
index 26b3fda..f5f777a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -88,8 +88,8 @@ endif
 	rm -f $(tmpdir)/usr/share/info/dir*
 #	mv $(tmpdir)/usr/share/doc/sed-4.1.5 $(tmpdir)$(docdir)
 #	mv $(tmpdir)/usr/share/doc/sed.html $(tmpdir)$(docdir)/
-	gzip -9 $(tmpdir)/usr/share/man/man1/*
-	gzip -9 $(tmpdir)/usr/share/info/sed.info*
+	gzip -9n $(tmpdir)/usr/share/man/man1/*
+	gzip -9n $(tmpdir)/usr/share/info/sed.info*
 
 # Install some documentation
 	install -p -o root -g root -m 644 AUTHORS BUGS README THANKS \
@@ -99,7 +99,7 @@ endif
 		$(tmpdir)$(docdir)/changelog.Debian
 	install -p -o root -g root -m 644 debian/my/sedfaq.txt $(tmpdir)$(docdir)
 	# We expect an error here for the examples-subdir
-	-gzip -9 $(tmpdir)$(docdir)/*
+	-gzip -9n $(tmpdir)$(docdir)/*
 	install -p -o root -g root -m 644 debian/copyright $(tmpdir)$(docdir)
 	install -p -o root -g root -m 644 testsuite/dc.sed $(tmpdir)$(docdir)/examples/
 
-- 
1.9.1

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to