Accepting request 645935 from home:bmwiedemann:branches:M17N
add groff-reproducible-mdate.patch and groff-use-SDE.patch to allow to override build time to make package build reproducible (boo#1047218) OBS-URL: https://build.opensuse.org/request/show/645935 OBS-URL: https://build.opensuse.org/package/show/M17N/groff?expand=0&rev=64
This commit is contained in:
parent
e2ff32eaa7
commit
5056a15007
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 30 23:50:14 UTC 2018 - Bernhard Wiedemann <bwiedemann@suse.com>
|
||||
|
||||
- add groff-reproducible-mdate.patch and groff-use-SDE.patch to allow
|
||||
to override build time to make package build reproducible (boo#1047218)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 19 11:47:37 CET 2018 - kukuk@suse.de
|
||||
|
||||
|
@ -58,6 +58,10 @@ Patch9: 0002-documentation-for-the-locale-keyword.patch
|
||||
Patch10: groff-force-locale-usage.patch
|
||||
# PATCH-FIX-UPSTREAM fix build with multiple threads ; taken from upstream
|
||||
Patch11: groff-multi-thread.patch
|
||||
# PATCH-FIX-UPSTREAM e4290210f2c1db5292d97678197a986d6822d044
|
||||
Patch12: groff-use-SDE.patch
|
||||
# PATCH-FIX-UPSTREAM 677274dafc5dd5f79f2a6d16270b21d2f5a16c5b
|
||||
Patch13: groff-reproducible-mdate.patch
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
@ -156,6 +160,8 @@ the -X option.
|
||||
%patch9 -p1 -b .locale2
|
||||
%patch10 -p1 -b .force-locale
|
||||
%patch11 -b .multithread
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
|
||||
%build
|
||||
PATH=$PWD/src/roff/troff:$PWD/src/preproc/pic:$PWD/src/preproc/eqn:$PWD/src/preproc/tbl:$PWDsrc/preproc/refer:$PWD/src/preproc/soelim:$PATH
|
||||
|
25
groff-reproducible-mdate.patch
Normal file
25
groff-reproducible-mdate.patch
Normal file
@ -0,0 +1,25 @@
|
||||
Author: Bernhard M. Wiedemann <bwiedemann suse de>
|
||||
Date: 2018-11-01
|
||||
Subject: make package build reproducible
|
||||
|
||||
sometimes our patches touch .man input files
|
||||
and mdate picks up their mtime for use in man-page headers
|
||||
so we clamp the mtime to SOURCE_DATE_EPOCH if set
|
||||
similar to https://www.fabiankeil.de/sourcecode/electrobsd/ElectroBSD-r312620-6cfa243f1516/0079-contrib-groff-mdate.sh-Use-EPOCH_DATE-when-set.diff
|
||||
|
||||
upstream commit 677274dafc5dd5f79f2a6d16270b21d2f5a16c5b
|
||||
rewrote it to similar perl, too
|
||||
|
||||
Index: groff-1.22.3/mdate.sh
|
||||
===================================================================
|
||||
--- groff-1.22.3.orig/mdate.sh
|
||||
+++ groff-1.22.3/mdate.sh
|
||||
@@ -19,4 +19,7 @@
|
||||
#
|
||||
# Print the modification date of $1 `nicely'.
|
||||
|
||||
-perl -MPOSIX -le 'print strftime("%d %B %Y", localtime((stat $ARGV[0])[9]))' $1
|
||||
+perl -MPOSIX -le '
|
||||
+$t=((stat $ARGV[0])[9]);
|
||||
+$t=$ENV{SOURCE_DATE_EPOCH} if($ENV{SOURCE_DATE_EPOCH} && $t > $ENV{SOURCE_DATE_EPOCH});
|
||||
+print strftime("%d %B %Y", gmtime($t))' $1
|
221
groff-use-SDE.patch
Normal file
221
groff-use-SDE.patch
Normal file
@ -0,0 +1,221 @@
|
||||
commit e4290210f2c1db5292d97678197a986d6822d044
|
||||
Author: Colin Watson <cjwatson@debian.org>
|
||||
Date: Fri Jul 29 03:25:26 2016 +0100
|
||||
|
||||
Implement `SOURCE_DATE_EPOCH' for reproducible builds.
|
||||
|
||||
* src/include/curtime.h: New file.
|
||||
* src/libs/libgroff/curtime.cpp: New file.
|
||||
* src/libs/libgroff/libgroff.am (libgroff_a_SOURCES): Add
|
||||
src/libs/libgroff/curtime.cpp.
|
||||
|
||||
* src/roff/troff/input.cpp (init_registers): Use `current_time'
|
||||
instead of `time(0)'.
|
||||
* src/devices/grohtml/post-html.cpp
|
||||
(html_printer::do_file_components): Likewise.
|
||||
(html_printer::~html_printer): Likewise.
|
||||
* src/devices/grops/ps.cpp (ps_printer::~ps_printer): Likewise.
|
||||
* src/devices/gropdf/gropdf.pl: Use `$ENV{SOURCE_DATE_EPOCH}` if
|
||||
available in preference to `time`.
|
||||
|
||||
* doc/groff.texi (Environment): Document `SOURCE_DATE_EPOCH'.
|
||||
* src/devices/grohtml/grohtml.1.man (ENVIRONMENT): Likewise.
|
||||
* src/devices/gropdf/gropdf.1.man (ENVIRONMENT): Likewise.
|
||||
* src/devices/grops/grops.1.man (ENVIRONMENT): Likewise.
|
||||
|
||||
Index: groff-1.22.3/src/devices/grohtml/post-html.cpp
|
||||
===================================================================
|
||||
--- groff-1.22.3.orig/src/devices/grohtml/post-html.cpp
|
||||
+++ groff-1.22.3/src/devices/grohtml/post-html.cpp
|
||||
@@ -28,6 +28,7 @@ along with this program. If not, see <ht
|
||||
#include "html.h"
|
||||
#include "html-text.h"
|
||||
#include "html-table.h"
|
||||
+#include "curtime.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
@@ -5013,7 +5014,7 @@ void html_printer::do_file_components (v
|
||||
.put_string(Version_string)
|
||||
.end_comment();
|
||||
|
||||
- t = time(0);
|
||||
+ t = current_time();
|
||||
html.begin_comment("CreationDate: ")
|
||||
.put_string(ctime(&t), strlen(ctime(&t))-1)
|
||||
.end_comment();
|
||||
@@ -5126,7 +5127,7 @@ html_printer::~html_printer()
|
||||
.put_string(Version_string)
|
||||
.end_comment();
|
||||
|
||||
- t = time(0);
|
||||
+ t = current_time();
|
||||
html.begin_comment("CreationDate: ")
|
||||
.put_string(ctime(&t), strlen(ctime(&t))-1)
|
||||
.end_comment();
|
||||
Index: groff-1.22.3/src/devices/gropdf/gropdf.pl
|
||||
===================================================================
|
||||
--- groff-1.22.3.orig/src/devices/gropdf/gropdf.pl
|
||||
+++ groff-1.22.3/src/devices/gropdf/gropdf.pl
|
||||
@@ -239,13 +239,14 @@ elsif (exists($ppsz{$papersz}))
|
||||
@defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]);
|
||||
}
|
||||
|
||||
-my (@dt)=localtime(time);
|
||||
+my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time);
|
||||
my $dt=PDFDate(\@dt);
|
||||
|
||||
my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
|
||||
'Producer' => "(gropdf version $cfg{GROFF_VERSION})",
|
||||
'ModDate' => "($dt)",
|
||||
'CreationDate' => "($dt)");
|
||||
+
|
||||
while (<>)
|
||||
{
|
||||
chomp;
|
||||
Index: groff-1.22.3/src/devices/grops/ps.cpp
|
||||
===================================================================
|
||||
--- groff-1.22.3.orig/src/devices/grops/ps.cpp
|
||||
+++ groff-1.22.3/src/devices/grops/ps.cpp
|
||||
@@ -28,6 +28,7 @@ along with this program. If not, see <ht
|
||||
#include "cset.h"
|
||||
#include "nonposix.h"
|
||||
#include "paper.h"
|
||||
+#include "curtime.h"
|
||||
|
||||
#include "ps.h"
|
||||
#include <time.h>
|
||||
@@ -1390,7 +1391,7 @@ ps_printer::~ps_printer()
|
||||
#else
|
||||
time_t
|
||||
#endif
|
||||
- t = time(0);
|
||||
+ t = current_time();
|
||||
fputs(ctime(&t), out.get_file());
|
||||
}
|
||||
for (font_pointer_list *f = font_list; f; f = f->next) {
|
||||
Index: groff-1.22.3/src/include/curtime.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ groff-1.22.3/src/include/curtime.h
|
||||
@@ -0,0 +1,23 @@
|
||||
+/* Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of groff.
|
||||
+
|
||||
+groff is free software; you can redistribute it and/or modify it under
|
||||
+the terms of the GNU General Public License as published by the Free
|
||||
+Software Foundation, either version 2 of the License, or
|
||||
+(at your option) any later version.
|
||||
+
|
||||
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+for more details.
|
||||
+
|
||||
+The GNU General Public License version 2 (GPL2) is available in the
|
||||
+internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
|
||||
+
|
||||
+#ifdef LONG_FOR_TIME_T
|
||||
+long
|
||||
+#else
|
||||
+time_t
|
||||
+#endif
|
||||
+current_time();
|
||||
Index: groff-1.22.3/src/libs/libgroff/curtime.cpp
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ groff-1.22.3/src/libs/libgroff/curtime.cpp
|
||||
@@ -0,0 +1,51 @@
|
||||
+/* Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of groff.
|
||||
+
|
||||
+groff is free software; you can redistribute it and/or modify it under
|
||||
+the terms of the GNU General Public License as published by the Free
|
||||
+Software Foundation, either version 2 of the License, or
|
||||
+(at your option) any later version.
|
||||
+
|
||||
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+for more details.
|
||||
+
|
||||
+The GNU General Public License version 2 (GPL2) is available in the
|
||||
+internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <limits.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <time.h>
|
||||
+
|
||||
+#include "errarg.h"
|
||||
+#include "error.h"
|
||||
+
|
||||
+#ifdef LONG_FOR_TIME_T
|
||||
+long
|
||||
+#else
|
||||
+time_t
|
||||
+#endif
|
||||
+current_time()
|
||||
+{
|
||||
+ char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
||||
+
|
||||
+ if (source_date_epoch) {
|
||||
+ errno = 0;
|
||||
+ char *endptr;
|
||||
+ long epoch = strtol(source_date_epoch, &endptr, 10);
|
||||
+
|
||||
+ if ((errno == ERANGE && (epoch == LONG_MAX || epoch == LONG_MIN)) ||
|
||||
+ (errno != 0 && epoch == 0))
|
||||
+ fatal("$SOURCE_DATE_EPOCH: strtol: %1", strerror(errno));
|
||||
+ if (endptr == source_date_epoch)
|
||||
+ fatal("$SOURCE_DATE_EPOCH: no digits found: %1", endptr);
|
||||
+ if (*endptr != '\0')
|
||||
+ fatal("$SOURCE_DATE_EPOCH: trailing garbage: %1", endptr);
|
||||
+ return epoch;
|
||||
+ } else
|
||||
+ return time(0);
|
||||
+}
|
||||
Index: groff-1.22.3/src/roff/troff/input.cpp
|
||||
===================================================================
|
||||
--- groff-1.22.3.orig/src/roff/troff/input.cpp
|
||||
+++ groff-1.22.3/src/roff/troff/input.cpp
|
||||
@@ -36,6 +36,7 @@ along with this program. If not, see <ht
|
||||
#include "input.h"
|
||||
#include "defs.h"
|
||||
#include "unicode.h"
|
||||
+#include "curtime.h"
|
||||
|
||||
// Needed for getpid() and isatty()
|
||||
#include "posix.h"
|
||||
@@ -8138,7 +8139,7 @@ static void init_registers()
|
||||
#else /* not LONG_FOR_TIME_T */
|
||||
time_t
|
||||
#endif /* not LONG_FOR_TIME_T */
|
||||
- t = time(0);
|
||||
+ t = current_time();
|
||||
// Use struct here to work around misfeature in old versions of g++.
|
||||
struct tm *tt = localtime(&t);
|
||||
set_number_reg("seconds", int(tt->tm_sec));
|
||||
Index: groff-1.22.3/src/libs/libgroff/Makefile.sub
|
||||
===================================================================
|
||||
--- groff-1.22.3.orig/src/libs/libgroff/Makefile.sub
|
||||
+++ groff-1.22.3/src/libs/libgroff/Makefile.sub
|
||||
@@ -32,6 +32,7 @@ OBJS=\
|
||||
cmap.$(OBJEXT) \
|
||||
color.$(OBJEXT) \
|
||||
cset.$(OBJEXT) \
|
||||
+ curtime.$(OBJEXT) \
|
||||
device.$(OBJEXT) \
|
||||
errarg.$(OBJEXT) \
|
||||
error.$(OBJEXT) \
|
||||
@@ -82,6 +83,7 @@ CCSRCS=\
|
||||
$(srcdir)/cmap.cpp \
|
||||
$(srcdir)/color.cpp \
|
||||
$(srcdir)/cset.cpp \
|
||||
+ $(srcdir)/curtime.cpp \
|
||||
$(srcdir)/device.cpp \
|
||||
$(srcdir)/errarg.cpp \
|
||||
$(srcdir)/error.cpp \
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 30 23:50:14 UTC 2018 - Bernhard Wiedemann <bwiedemann@suse.com>
|
||||
|
||||
- add groff-reproducible-mdate.patch and groff-use-SDE.patch to allow
|
||||
to override build time to make package build reproducible (boo#1047218)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 19 11:47:37 CET 2018 - kukuk@suse.de
|
||||
|
||||
|
@ -57,6 +57,10 @@ Patch9: 0002-documentation-for-the-locale-keyword.patch
|
||||
Patch10: groff-force-locale-usage.patch
|
||||
# PATCH-FIX-UPSTREAM fix build with multiple threads ; taken from upstream
|
||||
Patch11: groff-multi-thread.patch
|
||||
# PATCH-FIX-UPSTREAM e4290210f2c1db5292d97678197a986d6822d044
|
||||
Patch12: groff-use-SDE.patch
|
||||
# PATCH-FIX-UPSTREAM 677274dafc5dd5f79f2a6d16270b21d2f5a16c5b
|
||||
Patch13: groff-reproducible-mdate.patch
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
@ -155,6 +159,8 @@ the -X option.
|
||||
%patch9 -p1 -b .locale2
|
||||
%patch10 -p1 -b .force-locale
|
||||
%patch11 -b .multithread
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
|
||||
%build
|
||||
PATH=$PWD/src/roff/troff:$PWD/src/preproc/pic:$PWD/src/preproc/eqn:$PWD/src/preproc/tbl:$PWDsrc/preproc/refer:$PWD/src/preproc/soelim:$PATH
|
||||
|
Loading…
Reference in New Issue
Block a user