Package: libdist-zilla-perl / 6.012-1

SOURCE_DATE_EPOCH_support.patch Patch series | download
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 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: 2018-04-16

--- a/lib/Dist/Zilla.pm
+++ b/lib/Dist/Zilla.pm
@@ -438,7 +438,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
@@ -87,7 +87,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;