[Pkg-javascript-devel] Bug#892425: node-package-preamble: please make the output reproducible

Chris Lamb lamby at debian.org
Fri Mar 9 02:19:26 UTC 2018


Source: node-package-preamble
Version: 0.1.0-1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: toolchain timestamps
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that node-package-preamble generates output that is not
reproducible which is affecting the reproducibility of (at least)
5 packages.

Patch attached.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/bin/preamble b/bin/preamble
index a563140..be96d96 100755
--- a/bin/preamble
+++ b/bin/preamble
@@ -3,12 +3,17 @@
 var os = require("os"),
     fs = require("fs");
 
+var now = new Date();
+if (process.env.SOURCE_DATE_EPOCH) {
+  now = new Date((process.env.SOURCE_DATE_EPOCH * 1000) + (now.getTimezoneOffset() * 60000));
+}
+
 fs.readFile("package.json", "utf8", function(error, text) {
   if (error) throw error;
   var json = JSON.parse(text);
   process.stdout.write("// " + (json.homepage || json.name)
       + " Version " + json.version + "."
-      + " Copyright " + (new Date).getFullYear()
+      + " Copyright " + now.getFullYear()
       + " " + json.author.name + (/\.$/.test(json.author.name) ? "" : ".")
       + os.EOL);
 });


More information about the Pkg-javascript-devel mailing list