Source: node-marked-man
Version: 0.2.0-1
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 node-marked-man generated reproducible output. In particular,
it uses the current timestamp which varies between builds.

Patch attached that uses SOURCE_DATE_EPOCH[1] if that is exported
in the environment.

 [0] https://reproducible-builds.org/
 [1] https://reproducible-builds.org/specs/source-date-epoch/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb, Debian Project Leader
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff --git a/lib/marked-man.js b/lib/marked-man.js
index 71e58d2..e34d089 100644
--- a/lib/marked-man.js
+++ b/lib/marked-man.js
@@ -414,6 +414,9 @@ function rparseHeader(str, options) {
 }
 function manDate(date) {
   date = new Date(date);
+  if (process.env.SOURCE_DATE_EPOCH) {
+    date = new Date(process.env.SOURCE_DATE_EPOCH * 1000);
+  }
   var month = ["January", "February", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"][date.getMonth()];
   return month + " " + date.getFullYear();
 }

Reply via email to