Source: grunt
Version: 1.0.1-5
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps toolchain
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

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
libjquery-tablesorter that set a "pkg.banner" such as:

  <%= grunt.template.today("mm-dd-yyyy")


Patch attached.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb, Debian Project Leader
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff --git a/lib/grunt/template.js b/lib/grunt/template.js
index d1967df..15e1fe1 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.
-- 
Pkg-javascript-devel mailing list
Pkg-javascript-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-javascript-devel

Reply via email to