[Pkg-javascript-commits] [grunt] 01/06: make reproducible builds

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Sep 14 15:35:31 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository grunt.

commit 0dba69f3677f5c2f2c4ae2a7f09a1f4608d80943
Author: Pirate Praveen <praveen at debian.org>
Date:   Thu Sep 14 20:19:15 2017 +0530

    make reproducible builds
---
 debian/patches/reproducible-build.patch | 36 +++++++++++++++++++++++++++++++++
 debian/patches/series                   |  1 +
 2 files changed, 37 insertions(+)

diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch
new file mode 100644
index 0000000..a7a072d
--- /dev/null
+++ b/debian/patches/reproducible-build.patch
@@ -0,0 +1,36 @@
+From bf7c4be2840033ee6ef2efd85d086c81ee2504ee Mon Sep 17 00:00:00 2001
+From: Chris Lamb <chris at chris-lamb.co.uk>
+Date: Sun, 9 Jul 2017 09:40:54 +0100
+Subject: [PATCH] Use SOURCE_DATE_EPOCH to render dates in template.
+
+Whilst working on the Reproducible Builds effort [0], we noticed
+that grunt can generate non-reproducible output. This is affecting the
+reproducibility status other packages (such as jquery-tablesorter) that
+set a "pkg.banner" such as:
+
+   <%= grunt.template.today("mm-dd-yyyy")
+
+ [0] https://reproducible-builds.org/
+
+Signed-off-by: Chris Lamb <chris at chris-lamb.co.uk>
+---
+ lib/grunt/template.js | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/grunt/template.js b/lib/grunt/template.js
+index d1967df9..15e1fe10 100644
+--- a/lib/grunt/template.js
++++ b/lib/grunt/template.js
+@@ -10,7 +10,11 @@ template.date = require('dateformat');
+ 
+ // Format today's date.
+ template.today = function(format) {
+-  return template.date(new Date(), format);
++  var now = new Date();
++  if (process.env.SOURCE_DATE_EPOCH) {
++    now = new Date((process.env.SOURCE_DATE_EPOCH * 1000) + (now.getTimezoneOffset() * 60000));
++  }
++  return template.date(now, format);
+ };
+ 
+ // Template delimiters.
diff --git a/debian/patches/series b/debian/patches/series
index 950be83..f8a2927 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 fix-nodejs.patch
 add-root-variable.patch
 adapt-gruntfile.patch
+reproducible-build.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/grunt.git



More information about the Pkg-javascript-commits mailing list