Bug#1098251: node-svgdotjs-svg.js: please make the build reproducible

Chris Lamb lamby at debian.org
Tue Feb 18 11:37:47 GMT 2025


Source: node-svgdotjs-svg.js
Version: 3.2.4-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
node-svgdotjs-svg.js could not be built reproducibly.

This is because it embeds the current time into the files. For instance:

│ │ ├── ./usr/share/nodejs/@svgdotjs/svg.js/dist/svg.esm.js
│ │ │ │ ├── js-beautify {}
│ │ │ │ │ @@ -2,15 +2,15 @@
│ │ │ │ │   * @svgdotjs/svg.js - A lightweight library for manipulating and animating SVG.
│ │ │ │ │   * @version 3.2.4
│ │ │ │ │   * https://svgjs.dev/
│ │ │ │ │   *
│ │ │ │ │   * @copyright Wout Fierens <wout at mick-wout.com>
│ │ │ │ │   * @license MIT
│ │ │ │ │   *
│ │ │ │ │ - * BUILT: Sun Mar 22 2026 21:02:15 GMT-1200 (GMT-12:00)
│ │ │ │ │ + * BUILT: Tue Feb 18 2025 16:43:48 GMT+1400 (GMT+14:00)
│ │ │ │ │   */

A patch is attached that will generate this value via SOURCE_DATE_EPOCH,
as well as ensure that the timezone is determinstic.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/debian/patches/reproducible-build.patch	1970-01-01 01:00:00.000000000 +0100
--- b/debian/patches/reproducible-build.patch	2025-02-18 11:34:35.594494237 +0000
@@ -0,0 +1,15 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby at debian.org>
+Last-Update: 2025-02-18
+
+--- node-svgdotjs-svg.js-3.2.4.orig/.config/rollup.config.js
++++ node-svgdotjs-svg.js-3.2.4/.config/rollup.config.js
+@@ -7,7 +7,7 @@ import terserModule from "/usr/share/nod
+ const terser = terserModule.terser
+ // import filesize from 'rollup-plugin-filesize'
+ 
+-const buildDate = Date()
++const buildDate = new Date(process.env.SOURCE_DATE_EPOCH ? (process.env.SOURCE_DATE_EPOCH * 1000) : new Date().getTime());
+ 
+ const headerLong = `/*!
+ * ${pkg.name} - ${pkg.description}
--- a/debian/patches/series	2025-02-18 11:18:03.885670825 +0000
--- b/debian/patches/series	2025-02-18 11:34:34.202488412 +0000
@@ -1 +1,2 @@
 debian-rollup.patch
+reproducible-build.patch
--- a/debian/rules	2025-02-18 11:18:03.885670825 +0000
--- b/debian/rules	2025-02-18 11:36:01.434849743 +0000
@@ -14,7 +14,7 @@
 override_dh_auto_build:
 	mkdir -p node_modules
 	ln -s /usr/share/nodejs/rollup node_modules/rollup
-	npm run rollup
+	TZ=UTC npm run rollup
 
 override_dh_installdocs:
 	dh_installdocs


More information about the Reproducible-bugs mailing list