File: SOURCE_DATE_EPOCH_support.patch

package info (click to toggle)
libdist-zilla-perl 6.008-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,644 kB
  • ctags: 532
  • sloc: perl: 6,886; makefile: 9; sh: 6
file content (28 lines) | stat: -rw-r--r-- 1,094 bytes parent folder | 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
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.
Author: Axel Beckert <abe@debian.org>
Forwarded: not yet

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