Source: courier
Version: 0.76.1-1
Severity: wishlist
Tags: patch upstream
User: reproducible-builds@lists.alioth.debian.org
Usertags: environment timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Dear Maintainer,

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

The attached patch honours the SOURCE_DATE_EPOCH environment variable
[2] to set the imapd version string from the last debian/changelog date,
and sets the shell to /bin/sh whatever SHELL is.
Once applied, courier can be built reproducibly in our current
experimental framework.

Regards,
Alexis Bienvenüe.

 [1]: https://wiki.debian.org/ReproducibleBuilds
 [2]: https://reproducible-builds.org/specs/source-date-epoch/

diff -Nru courier-0.76.1/debian/changelog courier-0.76.1/debian/changelog
--- courier-0.76.1/debian/changelog	2016-05-09 15:26:49.000000000 +0200
+++ courier-0.76.1/debian/changelog	2016-05-11 15:23:45.000000000 +0200
@@ -1,3 +1,10 @@
+courier (0.76.1-1.0~reproducible1) UNRELEASED; urgency=medium
+
+  * Always use /bin/sh as SHELL, to get reproducible build.
+  * Use SOURCE_DATE_EPOCH for imapd version string.
+
+ -- Alexis Bienvenüe <p...@passoire.fr>  Wed, 11 May 2016 15:23:44 +0200
+
 courier (0.76.1-1) unstable; urgency=medium
 
   * Imported Upstream version 0.76.1
diff -Nru courier-0.76.1/debian/patches/0026-use-SOURCE_DATE_EPOCH-for-imapd-version.patch courier-0.76.1/debian/patches/0026-use-SOURCE_DATE_EPOCH-for-imapd-version.patch
--- courier-0.76.1/debian/patches/0026-use-SOURCE_DATE_EPOCH-for-imapd-version.patch	1970-01-01 01:00:00.000000000 +0100
+++ courier-0.76.1/debian/patches/0026-use-SOURCE_DATE_EPOCH-for-imapd-version.patch	2016-05-11 14:32:30.000000000 +0200
@@ -0,0 +1,20 @@
+Description: Use SOURCE_DATE_EPOCH for imapd version
+ Use the environment variable SOURCE_DATE_EPOCH (if set) for imapd
+ PROGRAMVERSION, to make the build reproducible.
+ See https://reproducible-builds.org/specs/source-date-epoch/
+Author: Alexis Bienvenüe <p...@passoire.fr>
+
+--- courier-0.76.1.orig/libs/imap/configure.ac
++++ courier-0.76.1/libs/imap/configure.ac
+@@ -340,8 +340,9 @@ courier)
+ 	;;
+ esac
+ 
+-date=`date`
+-AC_DEFINE_UNQUOTED(PROGRAMVERSION, "$package/${target_cpu}-${target_vendor}-${target_os}/$date",
++SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
++BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "+%F %R" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+%F %R" 2>/dev/null || date -u "+%F %R")
++AC_DEFINE_UNQUOTED(PROGRAMVERSION, "$package/${target_cpu}-${target_vendor}-${target_os}/$BUILD_DATE",
+ 		       [ Source code version ])
+ 
+ AC_ARG_WITH(trashquota, [ --with-trashquota       Count deleted messages as part of the quota],
diff -Nru courier-0.76.1/debian/patches/series courier-0.76.1/debian/patches/series
--- courier-0.76.1/debian/patches/series	2016-05-09 15:26:49.000000000 +0200
+++ courier-0.76.1/debian/patches/series	2016-05-11 14:30:51.000000000 +0200
@@ -22,3 +22,4 @@
 0022-mkesmtpdcert-should-use-certsdir.patch
 0024-Fix-missing-AC_PROG_SYSCONFTOOL-macro-on-autoreconf.patch
 0025-Dynamically-resolver-mailuid-and-mailgid-on-runtime-.patch
+0026-use-SOURCE_DATE_EPOCH-for-imapd-version.patch
diff -Nru courier-0.76.1/debian/rules courier-0.76.1/debian/rules
--- courier-0.76.1/debian/rules	2016-05-09 15:26:49.000000000 +0200
+++ courier-0.76.1/debian/rules	2016-05-11 11:03:30.000000000 +0200
@@ -83,7 +83,7 @@
 		--disable-root-check
 
 override_dh_auto_configure:
-	dh_auto_configure -- $(COMMON_CONFIGURE)
+	CONFIG_SHELL=/bin/sh dh_auto_configure -- $(COMMON_CONFIGURE)
 
 override_dh_auto_install:
 	INSTALL_IGNORE_UMASK=1 dh_auto_install -- install
_______________________________________________
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