* Jochen Sprickerhof <[email protected]> [2026-07-13 17:22]:
Source: rakudo
Version: 2024.09-4
Severity: normal
Tags: patch
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: randomness

Hi,

Rakudo captures the file timestamp into the metadata when compiling
modules. This is normally fine except fore files that are touched by
debian/patches. Examples:

https://reproduce.debian.net/all/api/v1/builds/176802/artifacts/336780/diffoscope
https://reproduce.debian.net/all/api/v1/builds/180915/artifacts/344761/diffoscope
https://reproduce.debian.net/all/api/v1/builds/180660/artifacts/344452/diffoscope
https://reproduce.debian.net/all/api/v1/builds/177031/artifacts/337508/diffoscope


dpkg can't clamp the timestamp to a specific date as that could break
make, so instead I propose to use $SOURCE_DATE_EPOCH in the metadata
instead. The attached patch implements this.

Guillem proposed to only clamp newer timestamps, alternative patch attached.

Obviously there is a third option to drop the time entry as it seems to be optionsl. I don't know how it is used, so I leave the decision to the maintainer.

Cheers Jochen
From db4cb1925d12c8ba4ac642df07c657995bb02265 Mon Sep 17 00:00:00 2001
From: Jochen Sprickerhof <[email protected]>
Date: Mon, 13 Jul 2026 17:10:36 +0200
Subject: [PATCH] Clamp timestamp in metadata with SOURCE_DATE_EPOCH

---
 ...p-in-metadata-with-SOURCE_DATE_EPOCH.patch | 35 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 debian/patches/0005-Clamp-timestamp-in-metadata-with-SOURCE_DATE_EPOCH.patch

diff --git a/debian/patches/0005-Clamp-timestamp-in-metadata-with-SOURCE_DATE_EPOCH.patch b/debian/patches/0005-Clamp-timestamp-in-metadata-with-SOURCE_DATE_EPOCH.patch
new file mode 100644
index 00000000..c3fcfd17
--- /dev/null
+++ b/debian/patches/0005-Clamp-timestamp-in-metadata-with-SOURCE_DATE_EPOCH.patch
@@ -0,0 +1,35 @@
+From: Jochen Sprickerhof <[email protected]>
+Date: Mon, 13 Jul 2026 16:04:36 +0200
+Subject: Clamp timestamp in metadata with SOURCE_DATE_EPOCH
+
+This makes it reproducible.
+---
+ src/core.c/CompUnit/Repository/Installation.rakumod | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/core.c/CompUnit/Repository/Installation.rakumod b/src/core.c/CompUnit/Repository/Installation.rakumod
+index 8eab364..7953e1f 100644
+--- a/src/core.c/CompUnit/Repository/Installation.rakumod
++++ b/src/core.c/CompUnit/Repository/Installation.rakumod
+@@ -264,13 +264,20 @@ sub MAIN(*@, *%) {
+             my $destination = $sources-dir.add($id);
+             my $handle      = $dist.content($file);
+             my $content     = $handle.open(:bin).slurp(:close);
++            my $time = try { $file.IO.modified.Num} // 0;
++
++            if %*ENV<SOURCE_DATE_EPOCH> -> $source_date_epoch {
++                if $time > $source_date_epoch.Num {
++                    $time = $source_date_epoch.Num;
++                }
++            }
+ 
+             self!add-short-name($name, $dist, $id,
+               nqp::sha1(nqp::join("\n", nqp::split("\r\n",
+                 $content.decode('iso-8859-1')))));
+             %provides{ $name } = ~$file => {
+                 :file($id),
+-                :time(try $file.IO.modified.Num),
++                :time($time),
+             };
+             note("Installing {$name} for {$dist.meta<name>}") if $verbose and $name ne $dist.meta<name>;
+             $destination.spurt($content);
diff --git a/debian/patches/series b/debian/patches/series
index 89868a84..05dbac28 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ fix-script-path
 fix-perf-test
 fix-test
 fix-compiler-id
+0005-Clamp-timestamp-in-metadata-with-SOURCE_DATE_EPOCH.patch
-- 
2.53.0

Attachment: signature.asc
Description: PGP signature

Reply via email to