File: reproducible_build.patch

package info (click to toggle)
libmarpa-r2-perl 12.000000-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,660 kB
  • sloc: perl: 42,628; ansic: 23,387; sh: 4,363; makefile: 157
file content (32 lines) | stat: -rw-r--r-- 1,321 bytes parent folder | download | duplicates (4)
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
31
32
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Honour SOURCE_DATE_EPOCH for embedded timestamp
 When the environment variable SOURCE_DATE_EPOCH is set, use it instead of the
 current time for the embedded build timestamp.
 .
 The specification of SOURCE_DATE_EPOCH is available here:
 https://reproducible-builds.org/specs/source-date-epoch/
 .
 In the case it is not defined, fall back to current time in UTC.
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=115614
Bug: https://rt.cpan.org/Ticket/Display.html?id=115614

--- a/inc/Marpa/R2/Build_Me.pm
+++ b/inc/Marpa/R2/Build_Me.pm
@@ -83,7 +83,7 @@
 
 ##no critic(ValuesAndExpressions::RequireInterpolationOfMetachars)
     $text .= q{use vars qw($TIMESTAMP)} . qq{;\n};
-    $text .= q{$TIMESTAMP='} . localtime()->datetime . qq{';\n};
+    $text .= q{$TIMESTAMP='} . (gmtime($ENV{SOURCE_DATE_EPOCH} || time()))->datetime . qq{';\n};
 ##use critic
 
     for my $package (@use_packages) {
@@ -104,7 +104,7 @@
 
 ##no critic(ValuesAndExpressions::RequireInterpolationOfMetachars)
     $text .= q{use vars qw($TIMESTAMP)} . qq{;\n};
-    $text .= q{$TIMESTAMP='} . localtime()->datetime . qq{';\n};
+    $text .= q{$TIMESTAMP='} . (gmtime($ENV{SOURCE_DATE_EPOCH} || time()))->datetime . qq{';\n};
 ##use critic
 
     for my $package (@use_packages) {