Source: node-promise Version: 8.0.1-1 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: randomness X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that node-promise could not be built reproducibly as it uses random numbers as throwaway identifiers. Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
--- a/debian/patches/reproducible-build.patch 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/reproducible-build.patch 2018-01-03 18:22:12.685911282 +0000 @@ -0,0 +1,25 @@ +Description: Make the build reproducible +Author: Chris Lamb <la...@debian.org> +Last-Update: 2018-01-03 + +--- node-promise-8.0.1.orig/build.js ++++ node-promise-8.0.1/build.js +@@ -5,16 +5,12 @@ var rimraf = require('rimraf'); + var acorn = require('acorn'); + var walk = require('acorn/dist/walk'); + +-var ids = []; ++var idx = 0; + var names = {}; + + function getIdFor(name) { + if (name in names) return names[name]; +- var id; +- do { +- id = '_' + Math.floor(Math.random() * 100); +- } while (ids.indexOf(id) !== -1) +- ids.push(id); ++ var id = '_' + idx++; + names[name] = id; + return id; + } --- a/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/series 2018-01-03 18:22:11.685904510 +0000 @@ -0,0 +1 @@ +reproducible-build.patch