Package: debhelper
Version: 9.20150101
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain fileordering

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that some packages could not be built reproducibly because the
maintainer scripts generated by dh_usrlocal would vary depending on
filesystem ordering.

The attached patch sort the directory lists to provide a stable output.

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

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
From 76a130d2d3f95f46c8bec093e96bbbac4469b980 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lu...@debian.org>
Date: Sat, 10 Jan 2015 10:11:31 +0000
Subject: [PATCH] dh_usrlocal: output dir list in a stable order

We now sort the directory lists in order to guarantee a stable output.
This was preventing some packages to build reproducibly.
---
 dh_usrlocal | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dh_usrlocal b/dh_usrlocal
index 4ccc601..b395dc6 100755
--- a/dh_usrlocal
+++ b/dh_usrlocal
@@ -101,9 +101,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		my $ebs = $bs x 2; # Escape the backslash from the shell
 		# This constructs the body of a 'sed' c\ expression which
 		# is parsed by the shell in double-quotes
-		my $dirs = join("$ebs\n", @dirs);
+		my $dirs = join("$ebs\n", sort @dirs);
 		pop @justdirs; # don't remove directories directly in /usr/local
-		my $justdirs = join("$ebs\n", @justdirs);
+		my $justdirs = join("$ebs\n", sort @justdirs);
 		if (! $dh{NOSCRIPTS}) { 
 			autoscript($package,"postinst", "postinst-usrlocal",
 				   "/#DIRS#/ c${ebs}\n${dirs}");
-- 
2.1.4

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