From d45e064f4cb59298efeda21b133aeca2cae3330f8205ddc6b250b1305274b0c8 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 31 May 2019 13:15:43 +0000 Subject: [PATCH] Accepting request 705693 from home:msmeissn:branches:Base:System - 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 --- gettext-csharp.spec | 2 +- gettext-java.spec | 2 +- gettext-runtime-mini.changes | 6 +++++ gettext-runtime-mini.spec | 4 +-- gettext-runtime.changes | 6 +++++ gettext-runtime.spec | 2 +- reproducible.patch | 47 ++++++++++++++++++++++++++++++++++++ 7 files changed, 64 insertions(+), 5 deletions(-) diff --git a/gettext-csharp.spec b/gettext-csharp.spec index 80a153f..aaab6a6 100644 --- a/gettext-csharp.spec +++ b/gettext-csharp.spec @@ -1,7 +1,7 @@ # # spec file for package gettext-csharp # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/gettext-java.spec b/gettext-java.spec index fef665d..71136f4 100644 --- a/gettext-java.spec +++ b/gettext-java.spec @@ -1,7 +1,7 @@ # # spec file for package gettext-java # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/gettext-runtime-mini.changes b/gettext-runtime-mini.changes index 61c134f..8f0a90f 100644 --- a/gettext-runtime-mini.changes +++ b/gettext-runtime-mini.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat May 25 11:53:33 UTC 2019 - Marcus Meissner + +- reproducible.patch: generate timestamp in .pot files from SOURCE_DATE_EPOCH + for reproducible builds + ------------------------------------------------------------------- Mon Mar 4 11:28:14 UTC 2019 - Dominique Leuenberger diff --git a/gettext-runtime-mini.spec b/gettext-runtime-mini.spec index 8c82b5f..dbc5b7b 100644 --- a/gettext-runtime-mini.spec +++ b/gettext-runtime-mini.spec @@ -1,7 +1,7 @@ # -# spec file for package gettext-runtime +# spec file for package gettext-runtime-mini # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/gettext-runtime.changes b/gettext-runtime.changes index 61c134f..8f0a90f 100644 --- a/gettext-runtime.changes +++ b/gettext-runtime.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat May 25 11:53:33 UTC 2019 - Marcus Meissner + +- reproducible.patch: generate timestamp in .pot files from SOURCE_DATE_EPOCH + for reproducible builds + ------------------------------------------------------------------- Mon Mar 4 11:28:14 UTC 2019 - Dominique Leuenberger diff --git a/gettext-runtime.spec b/gettext-runtime.spec index eadeb2d..b523fbc 100644 --- a/gettext-runtime.spec +++ b/gettext-runtime.spec @@ -1,7 +1,7 @@ # # spec file for package gettext-runtime # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/reproducible.patch b/reproducible.patch index f63593b..8e2a2b6 100644 --- a/reproducible.patch +++ b/reproducible.patch @@ -26,3 +26,50 @@ Index: gettext-0.19.8.1/gettext-tools/man/help2man (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 ("\