forked from pool/gettext-runtime
Marcus Meissner
d45e064f4c
- reproducible.patch: generate timestamp in .pot files from SOURCE_DATE_EPOCH for reproducible builds - reproducible.patch: generate timestamp in .pot files from SOURCE_DATE_EPOCH for reproducible builds OBS-URL: https://build.opensuse.org/request/show/705693 OBS-URL: https://build.opensuse.org/package/show/Base:System/gettext-runtime?expand=0&rev=150
76 lines
2.8 KiB
Diff
76 lines
2.8 KiB
Diff
merged upstream <https://savannah.gnu.org/bugs/?54367>
|
|
|
|
Index: gettext-0.19.8.1/gettext-runtime/man/help2man
|
|
===================================================================
|
|
--- gettext-0.19.8.1.orig/gettext-runtime/man/help2man
|
|
+++ gettext-0.19.8.1/gettext-runtime/man/help2man
|
|
@@ -179,7 +179,7 @@ my ($help_text, $version_text) = map {
|
|
or die "$this_program: can't get `--$_' info from $ARGV[0]\n"
|
|
} qw(help version);
|
|
|
|
-my $date = strftime "%B %Y", localtime;
|
|
+my $date = strftime "%B %Y", gmtime($ENV{SOURCE_DATE_EPOCH} || time);
|
|
(my $program = $ARGV[0]) =~ s!.*/!!;
|
|
my $package = $program;
|
|
my $version;
|
|
Index: gettext-0.19.8.1/gettext-tools/man/help2man
|
|
===================================================================
|
|
--- gettext-0.19.8.1.orig/gettext-tools/man/help2man
|
|
+++ gettext-0.19.8.1/gettext-tools/man/help2man
|
|
@@ -179,7 +179,7 @@ my ($help_text, $version_text) = map {
|
|
or die "$this_program: can't get `--$_' info from $ARGV[0]\n"
|
|
} qw(help version);
|
|
|
|
-my $date = strftime "%B %Y", localtime;
|
|
+my $date = strftime "%B %Y", gmtime($ENV{SOURCE_DATE_EPOCH} || time);
|
|
(my $program = $ARGV[0]) =~ s!.*/!!;
|
|
my $package = $program;
|
|
my $version;
|
|
Index: gettext-0.19.8.1/gettext-tools/src/xgettext.c
|
|
===================================================================
|
|
--- gettext-0.19.8.1.orig/gettext-tools/src/xgettext.c
|
|
+++ gettext-0.19.8.1/gettext-tools/src/xgettext.c
|
|
@@ -3714,6 +3714,9 @@ construct_header ()
|
|
char *msgstr;
|
|
char *comment;
|
|
static lex_pos_ty pos = { __FILE__, __LINE__ };
|
|
+ char *source_date_epoch;
|
|
+ unsigned long long epoch;
|
|
+ char *endptr;
|
|
|
|
if (package_name != NULL)
|
|
{
|
|
@@ -3734,7 +3738,31 @@ the MSGID_BUGS_ADDRESS variable there; o
|
|
specify an --msgid-bugs-address command line option.\n\
|
|
")));
|
|
|
|
- time (&now);
|
|
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
|
+ if (source_date_epoch) {
|
|
+ errno = 0;
|
|
+ epoch = strtoull(source_date_epoch, &endptr, 10);
|
|
+ if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
|
|
+ || (errno != 0 && epoch == 0)) {
|
|
+ fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", strerror(errno));
|
|
+ exit(EXIT_FAILURE);
|
|
+ }
|
|
+ if (endptr == source_date_epoch) {
|
|
+ fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", endptr);
|
|
+ exit(EXIT_FAILURE);
|
|
+ }
|
|
+ if (*endptr != '\0') {
|
|
+ fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", endptr);
|
|
+ exit(EXIT_FAILURE);
|
|
+ }
|
|
+ if (epoch > ULONG_MAX) {
|
|
+ fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: value must be smaller than or equal to %lu but was found to be: %llu \n", ULONG_MAX, epoch);
|
|
+ exit(EXIT_FAILURE);
|
|
+ }
|
|
+ now = epoch;
|
|
+ } else {
|
|
+ now = time(NULL);
|
|
+ }
|
|
timestring = po_strftime (&now);
|
|
|
|
msgstr = xasprintf ("\
|