Hello community,

here is the log from the commit of package dc3dd for openSUSE:Factory checked 
in at 2017-01-18 21:56:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dc3dd (Old)
 and      /work/SRC/openSUSE:Factory/.dc3dd.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "dc3dd"

Changes:
--------
--- /work/SRC/openSUSE:Factory/dc3dd/dc3dd.changes      2015-01-06 
09:06:59.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.dc3dd.new/dc3dd.changes 2017-01-18 
21:56:29.307978930 +0100
@@ -1,0 +2,5 @@
+Tue Jan 17 10:06:36 UTC 2017 - bwiedem...@suse.com
+
+- Add reproducible.patch to allow for reproducible builds
+
+-------------------------------------------------------------------

New:
----
  reproducible.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ dc3dd.spec ++++++
--- /var/tmp/diff_new_pack.oOrU7P/_old  2017-01-18 21:56:29.903894633 +0100
+++ /var/tmp/diff_new_pack.oOrU7P/_new  2017-01-18 21:56:29.911893501 +0100
@@ -24,6 +24,8 @@
 License:        GPL-3.0
 Group:          Productivity/Archiving/Backup
 Source:         
http://downloads.sourceforge.net/project/dc3dd/dc3dd/7.2/dc3dd-%{pkg_version}.tar.xz
+# PATCH-FIX-UPSTREAMING -- bmwiedemann -- 
https://sourceforge.net/p/dc3dd/bugs/16/
+Patch0:         reproducible.patch
 Url:            http://dc3dd.sourceforge.net/
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  gcc
@@ -56,6 +58,7 @@
 
 %prep
 %setup -q -n "dc3dd-%{pkg_version}"
+%patch0 -p1
 # fix end-of-line encoding
 %__sed -i 's/\r$//' *.txt
 %__sed -i 's/\r$//' ChangeLog

++++++ reproducible.patch ++++++
Index: root/osc/openSUSE:Factory/dc3dd/dc3dd-7.2.641/man/help2man
===================================================================
--- dc3dd-7.2.641/man/help2man
+++ dc3dd-7.2.641/man/help2man
@@ -242,7 +242,7 @@ $version_text ||= get_option_value $ARGV
 # the English version expands to the month as a word and the full year.  It
 # is used on the footer of the generated manual pages.  If in doubt, you may
 # just use %x as the value (which should be the full locale-specific date).
-my $date = enc strftime _("%B %Y"), localtime;
+my $date = enc strftime _("%B %Y"), gmtime($ENV{SOURCE_DATE_EPOCH} || time);
 (my $program = $ARGV[0]) =~ s!.*/!!;
 my $package = $program;
 my $version;
Index: root/osc/openSUSE:Factory/dc3dd/dc3dd-7.2.641/src/dc3dd.c
===================================================================
--- dc3dd-7.2.641/src/dc3dd.c
+++ dc3dd-7.2.641/src/dc3dd.c
@@ -637,13 +637,48 @@ report_error(int status, int errnum, con
       usage(status); 
 }
 
+time_t reproducible_time()
+{
+   time_t now;
+   char *source_date_epoch;
+   unsigned long long epoch;
+   char *endptr;
+
+   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);
+   }
+   return now;
+}
+
 // End code copied (and modified) from ../lib/error.c 
 
 static char*
 get_formatted_time_string()
 {
    // Get the current local time.
-   time_t t = time(NULL);
+   time_t t = reproducible_time();
    struct tm tm;
    struct tm* ret = localtime_r(&t, &tm);
    if (ret == NULL)

Reply via email to