[Pkg-javascript-devel] Bug#867753: grunt: please make the output reproducible

Chris Lamb lamby at debian.org
Sun Jul 9 08:38:05 UTC 2017


Source: grunt
Version: 1.0.1-5
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps toolchain
X-Debbugs-Cc: reproducible-bugs at 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
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
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.


More information about the Pkg-javascript-devel mailing list