Source: coquelicot
Version: 0.9.2-4
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

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

With the attached patch, coquelicot can be built reproducibly in our
current experimental framework.

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

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
From 6a8cd4d8ea70e33e77da6ad55e631ff30e6b440a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lu...@debian.org>
Date: Mon, 26 Jan 2015 16:38:08 +0100
Subject: [PATCH] Use debian/changelog date as gem build time

In order to make the build reproducible, we use the time of the latest
debian/changelog entry when creating the gem for AGPLv3 compatibility.
---
 debian/rules | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/debian/rules b/debian/rules
index 12a4572..c408a60 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,13 +17,15 @@ create-static-gemspec:
 override_dh_auto_install:
 	# Create the Gem that we ship as source code (for AGPL compliance)
 	cp --preserve=all /usr/share/javascript/jquery/jquery.min.js public/javascripts/jquery.min.js
-	ruby -rrubygems -rrubygems/package -rfileutils -rtmpdir -e ' \
+	ruby -rrubygems -rrubygems/package -rfileutils -rtmpdir -rtimecop -e ' \
 		debian_version = `dpkg-parsechangelog | sed -n -e "s/^Version: //p"`.strip; \
 		_, upstream_version, debian_revision = debian_version.match(/^(.*)-(.*)$$/).to_a; \
 		upstream_version.gsub!(/~/, "0."); \
 		upstream_version.gsub!(/[^0-9a-zA-Z.]/, ""); \
 		debian_revision.gsub!(/~/, "0."); \
 		debian_revision.gsub!(/[^0-9a-zA-Z.]/, ""); \
+		time_str = `dpkg-parsechangelog --show-field=Date`.strip; \
+		build_time = Time.at(`LC_ALL=C date --date="#{time_str}" +%s`.strip.to_i); \
 		spec = Gem::Specification.load("debian/coquelicot.gemspec"); \
 		if spec.version.to_s != upstream_version; \
 		  $$stderr.puts "Please refresh the static gemspec:"; \
@@ -49,7 +51,9 @@ override_dh_auto_install:
 		    FileUtils.cp src, dest; \
 		  end; \
 		  Dir.chdir("#{tmpdir}") do \
-		    Gem::Package.build spec; \
+		    Timecop.freeze(build_time) do; \
+		      Gem::Package.build spec; \
+		    end; \
 		  end; \
 		  FileUtils.mkdir_p "debian/coquelicot/usr/share/coquelicot/public"; \
 		  FileUtils.cp "#{tmpdir}/coquelicot-#{spec.version}.gem", \
-- 
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