Subject: [PATCH] Use SOURCE_DATE_EPOCH fore metadata to make it reproducible

From: Jochen Sprickerhof <[email-masked]>
Date: Mon, 13 Jul 2026 17:10:36 +0200

---
 ...EPOCH-fore-metadata-to-make-it-repro.patch | 32 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 debian/patches/0005-Use-SOURCE_DATE_EPOCH-fore-metadata-to-make-it-repro.patch

diff --git a/debian/patches/0005-Use-SOURCE_DATE_EPOCH-fore-metadata-to-make-it-repro.patch b/debian/patches/0005-Use-SOURCE_DATE_EPOCH-fore-metadata-to-make-it-repro.patch
new file mode 100644
index 00000000..85d63163
--- /dev/null
+++ b/debian/patches/0005-Use-SOURCE_DATE_EPOCH-fore-metadata-to-make-it-repro.patch
@@ -0,0 +1,32 @@
+From: Jochen Sprickerhof <[email-masked]>
+Date: Mon, 13 Jul 2026 16:04:36 +0200
+Subject: Use SOURCE_DATE_EPOCH fore metadata to make it reproducible
+
+---
+ src/core.c/CompUnit/Repository/Installation.rakumod | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/core.c/CompUnit/Repository/Installation.rakumod b/src/core.c/CompUnit/Repository/Installation.rakumod
+index 8eab364..fdf762a 100644
+--- a/src/core.c/CompUnit/Repository/Installation.rakumod
++++ b/src/core.c/CompUnit/Repository/Installation.rakumod
+@@ -264,13 +264,18 @@ 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 {
++                $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..b5c81784 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-Use-SOURCE_DATE_EPOCH-fore-metadata-to-make-it-repro.patch
-- 
2.53.0