File: SOURCE_DATE_EPOCH_support.patch

package info (click to toggle)
libdist-zilla-perl 6.033-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,928 kB
  • sloc: perl: 7,282; makefile: 4; sh: 1
file content (30 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Add support for SOURCE_DATE_EPOCH
 This allows one to use Dist::Zilla in reproducible builds. One package
 that will benefit from this patch is librun-parts-perl.
Forwarded: not yet
Author: Axel Beckert <abe@debian.org>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2022-12-22

--- a/lib/Dist/Zilla.pm
+++ b/lib/Dist/Zilla.pm
@@ -441,7 +441,7 @@
     # rjbs, 2008-06-13
     my $stash = $_[0]->stash_named('%Rights');
     my $year  = $stash && $stash->copyright_year;
-    return( $year // (localtime)[5] + 1900 );
+    return( $year // (localtime($ENV{SOURCE_DATE_EPOCH} || time))[5] + 1900 );
   }
 );
 
--- a/lib/Dist/Zilla/Plugin/DistINI.pm
+++ b/lib/Dist/Zilla/Plugin/DistINI.pm
@@ -89,7 +89,7 @@
     $content .= sprintf "author  = %s\n", $_ for @{ $zilla->authors };
     $content .= sprintf "license = %s\n", $license;
     $content .= sprintf "copyright_holder = %s\n", $zilla->copyright_holder;
-    $content .= sprintf "copyright_year   = %s\n", (localtime)[5] + 1900;
+    $content .= sprintf "copyright_year   = %s\n", (localtime($ENV{SOURCE_DATE_EPOCH} || time))[5] + 1900;
     $content .= "\n";
 
     $content .= $postlude;