Bug#794248: cortado: please make the build reproducible

Dhole dhole at openmailbox.org
Fri Jul 31 17:06:53 UTC 2015


Source: cortado
Version: 0.6.0-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds at lists.alioth.debian.org

Hi,

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

The attached patch replaces the build date found in several .class files
(generated by ant) by the timestamp of the latest debian/changelog
entry. Once applied, cortado can be built reproducibly in our current
experimental framework.

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


Regards,
-- 
Dhole
-------------- next part --------------
diff -Nru cortado-0.6.0/debian/changelog cortado-0.6.0/debian/changelog
--- cortado-0.6.0/debian/changelog	2013-09-24 05:47:39.000000000 +0200
+++ cortado-0.6.0/debian/changelog	2015-07-31 17:12:51.000000000 +0200
@@ -1,3 +1,11 @@
+cortado (0.6.0-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Replace build date with last entry timestamp from debian/changelog
+    to make the package build reproduciblu.
+
+ -- Eduard Sanou <dhole at openmailbox.org>  Fri, 31 Jul 2015 17:12:28 +0200
+
 cortado (0.6.0-2) unstable; urgency=low
 
   * Team upload.
diff -Nru cortado-0.6.0/debian/patches/replace_timestamp.patch cortado-0.6.0/debian/patches/replace_timestamp.patch
--- cortado-0.6.0/debian/patches/replace_timestamp.patch	1970-01-01 01:00:00.000000000 +0100
+++ cortado-0.6.0/debian/patches/replace_timestamp.patch	2015-07-31 17:13:15.000000000 +0200
@@ -0,0 +1,53 @@
+Description: Replace timestamp
+ .
+ cortado (0.6.0-2.1) UNRELEASED; urgency=medium
+ .
+   * Non-maintainer upload.
+   * Replace build date with last entry timestamp from debian/changelog
+     to make the package build reproduciblu.
+Author: Eduard Sanou <dhole at openmailbox.org>
+
+---
+
+--- cortado-0.6.0.orig/build.xml
++++ cortado-0.6.0/build.xml
+@@ -83,7 +83,7 @@ Cortado ANT build file
+ 
+   <target name="configure" depends="scripts">
+     <tstamp>
+-      <format property="DATE" timezone="GMT" pattern="yyyy-MM-dd HH:mm:ss" />
++      <format property="DATE" timezone="UTC" pattern="yyyy-MM-dd HH:mm:ss" />
+     </tstamp>
+    <exec executable="sh" outputproperty="REVISION">
+      <arg line="${src}/../scripts/get-revision" />
+@@ -94,15 +94,18 @@ Cortado ANT build file
+    <condition property="real_version" value="${REVISION}" else="${product.version}">
+     <equals arg1="${product.version}" arg2="GIT"/>
+    </condition>
+-    <echo file="${src}/com/fluendo/player/Configure.java" append="false"
++  <!-- Enable build date to be set externally -->
++  <property environment="env"/>
++  <property name="env.BUILD_DATE" value="${DATE}"/>
++   <echo file="${src}/com/fluendo/player/Configure.java" append="false"
+ >
+ package com.fluendo.player;
+ 
+ class Configure
+ {
+-  public String buildInfo = "Built on ${DATE} GMT (version ${real_version}) in ${build.type} mode.";
++  public String buildInfo = "Built on ${env.BUILD_DATE} UTC (version ${real_version}) in ${build.type} mode.";
+ 
+-  public String buildDate = "${DATE} GMT";
++  public String buildDate = "${env.BUILD_DATE} UTC";
+   public String buildVersion = "${real_version}";
+   public String buildType = "${build.type}";
+   public String revision = "${REVISION}";
+@@ -113,7 +116,7 @@ class Configure
+ }
+     </echo>
+     <echo
+->Built on ${DATE} (version ${real_version}) in ${build.type} mode.</echo>
++>Built on ${env.BUILD_DATE} (version ${real_version}) in ${build.type} mode.</echo>
+     
+   </target>
+ 
diff -Nru cortado-0.6.0/debian/patches/series cortado-0.6.0/debian/patches/series
--- cortado-0.6.0/debian/patches/series	2013-09-24 05:47:39.000000000 +0200
+++ cortado-0.6.0/debian/patches/series	2015-07-31 17:13:01.000000000 +0200
@@ -1 +1,2 @@
 01_fix_build.diff
+replace_timestamp.patch
diff -Nru cortado-0.6.0/debian/rules cortado-0.6.0/debian/rules
--- cortado-0.6.0/debian/rules	2013-09-24 05:47:39.000000000 +0200
+++ cortado-0.6.0/debian/rules	2015-07-31 17:12:20.000000000 +0200
@@ -3,6 +3,9 @@
 include /usr/share/cdbs/1/class/ant.mk
 include /usr/share/cdbs/1/rules/debhelper.mk
 
+export SOURCE_DATE_EPOCH = $(shell date -d "$$(dpkg-parsechangelog --count 1 -SDate)" +%s)
+export BUILD_DATE = $(shell date -u -d @$(SOURCE_DATE_EPOCH) +"%Y-%m-%d %H:%M:%S")
+
 JAVA_HOME = /usr/lib/jvm/default-java
 
 DEB_ANT_INSTALL_TARGET = install_applet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20150731/7b4d6318/attachment.sig>


More information about the pkg-java-maintainers mailing list