Commit 08c04399 authored by Axel Beckert's avatar Axel Beckert

Extend reproducible-build.diff to avoid having to use faketime

parent 33a6244a
...@@ -2,6 +2,9 @@ mp4h (1.3.1-12) UNRELEASED; urgency=medium ...@@ -2,6 +2,9 @@ mp4h (1.3.1-12) UNRELEASED; urgency=medium
* Hopefully fix as-installed testing by patching shtool dynamically with * Hopefully fix as-installed testing by patching shtool dynamically with
sed so that it doesn't output a specific warning to STDERR. sed so that it doesn't output a specific warning to STDERR.
* Extend debian/patches/reproducible-build.diff to avoid having to use
faketime to properly set modification timestamps during the build.
+ Drop build-dependency on faketime.
-- Axel Beckert <abe@debian.org> Sun, 13 Dec 2015 21:10:07 +0100 -- Axel Beckert <abe@debian.org> Sun, 13 Dec 2015 21:10:07 +0100
......
...@@ -8,7 +8,6 @@ Build-Depends: autoconf (>= 2.57~), ...@@ -8,7 +8,6 @@ Build-Depends: autoconf (>= 2.57~),
debhelper (>= 9~), debhelper (>= 9~),
dh-autoreconf, dh-autoreconf,
fakeroot, fakeroot,
faketime,
gettext, gettext,
libltdl-dev, libltdl-dev,
libpcre3-dev, libpcre3-dev,
......
...@@ -9,8 +9,8 @@ Last-Update: 2015-10-16 ...@@ -9,8 +9,8 @@ Last-Update: 2015-10-16
Index: mp4h/doc/mp4h.mp4h Index: mp4h/doc/mp4h.mp4h
=================================================================== ===================================================================
--- mp4h.orig/doc/mp4h.mp4h 2015-10-17 21:47:26.775335772 +0200 --- mp4h.orig/doc/mp4h.mp4h 2015-12-13 20:59:57.000000000 +0100
+++ mp4h/doc/mp4h.mp4h 2015-10-17 21:47:26.771335786 +0200 +++ mp4h/doc/mp4h.mp4h 2015-10-17 22:38:58.000000000 +0200
@@ -664,7 +664,7 @@ @@ -664,7 +664,7 @@
<set-var version="0.10.1" /> <set-var version="0.10.1" />
This is version <get-var version /> This is version <get-var version />
...@@ -43,8 +43,8 @@ Index: mp4h/doc/mp4h.mp4h ...@@ -43,8 +43,8 @@ Index: mp4h/doc/mp4h.mp4h
Index: mp4h/src/builtin.c Index: mp4h/src/builtin.c
=================================================================== ===================================================================
--- mp4h.orig/src/builtin.c 2015-10-17 21:47:26.775335772 +0200 --- mp4h.orig/src/builtin.c 2015-12-13 20:59:57.000000000 +0100
+++ mp4h/src/builtin.c 2015-10-17 21:47:26.771335786 +0200 +++ mp4h/src/builtin.c 2015-12-13 21:01:58.476123778 +0100
@@ -36,6 +36,8 @@ @@ -36,6 +36,8 @@
#undef MP4H_MODULE #undef MP4H_MODULE
...@@ -54,7 +54,66 @@ Index: mp4h/src/builtin.c ...@@ -54,7 +54,66 @@ Index: mp4h/src/builtin.c
#define CHECK_SAFETY_LEVEL(sl) \ #define CHECK_SAFETY_LEVEL(sl) \
if (safety_level > sl) \ if (safety_level > sl) \
@@ -1513,6 +1515,8 @@ @@ -1328,6 +1330,9 @@
struct stat buf;
struct passwd *user;
struct group *group;
+ char *endp = NULL;
+ char *source_date_epoch;
+ unsigned long long epoch;
CHECK_SAFETY_LEVEL(1);
@@ -1353,12 +1358,42 @@
obstack_grow (obs, "UNKNOWN", 7);
obstack_1grow (obs, '\n');
- shipout_long (obs, (long) buf.st_ctime);
- obstack_1grow (obs, '\n');
- shipout_long (obs, (long) buf.st_mtime);
- obstack_1grow (obs, '\n');
- shipout_long (obs, (long) buf.st_atime);
- obstack_1grow (obs, '\n');
+
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ if (source_date_epoch) {
+ errno = 0;
+ epoch = strtoull(source_date_epoch, &endp, 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 (endp == source_date_epoch) {
+ fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", endp);
+ exit(EXIT_FAILURE);
+ }
+ if (*endp != '\0') {
+ fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", endp);
+ 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);
+ }
+ shipout_long (obs, (long) epoch);
+ obstack_1grow (obs, '\n');
+ shipout_long (obs, (long) epoch);
+ obstack_1grow (obs, '\n');
+ shipout_long (obs, (long) epoch);
+ obstack_1grow (obs, '\n');
+ } else {
+ shipout_long (obs, (long) buf.st_ctime);
+ obstack_1grow (obs, '\n');
+ shipout_long (obs, (long) buf.st_mtime);
+ obstack_1grow (obs, '\n');
+ shipout_long (obs, (long) buf.st_atime);
+ obstack_1grow (obs, '\n');
+ }
user = getpwuid (buf.st_uid);
if (user)
obstack_grow (obs, user->pw_name, strlen (user->pw_name));
@@ -1513,6 +1548,8 @@
const char *format, *timespec; const char *format, *timespec;
struct tm *timeptr; struct tm *timeptr;
char *endp = NULL; char *endp = NULL;
...@@ -63,7 +122,7 @@ Index: mp4h/src/builtin.c ...@@ -63,7 +122,7 @@ Index: mp4h/src/builtin.c
format = predefined_attribute ("format", &argc, argv, FALSE); format = predefined_attribute ("format", &argc, argv, FALSE);
timespec = predefined_attribute ("time", &argc, argv, FALSE); timespec = predefined_attribute ("time", &argc, argv, FALSE);
@@ -1533,8 +1537,33 @@ @@ -1533,8 +1570,33 @@
return; return;
} }
} }
...@@ -101,8 +160,8 @@ Index: mp4h/src/builtin.c ...@@ -101,8 +160,8 @@ Index: mp4h/src/builtin.c
if (format) if (format)
Index: mp4h/tests/directory-contents/01.in Index: mp4h/tests/directory-contents/01.in
=================================================================== ===================================================================
--- mp4h.orig/tests/directory-contents/01.in 2015-05-13 01:11:15.101416773 +0200 --- mp4h.orig/tests/directory-contents/01.in 2015-12-13 20:59:52.000000000 +0100
+++ mp4h/tests/directory-contents/01.in 2015-10-17 21:50:25.278780859 +0200 +++ mp4h/tests/directory-contents/01.in 2015-12-13 20:59:57.000000000 +0100
@@ -1 +1 @@ @@ -1 +1 @@
-<directory-contents . matching="01\..." /> -<directory-contents . matching="01\..." />
+<set-var files="<directory-contents . matching="01\..." />" /><sort files /><get-var files /> +<set-var files="<directory-contents . matching="01\..." />" /><sort files /><get-var files />
...@@ -8,7 +8,6 @@ GETTEXT_TOP_FILES= ABOUT-NLS config.rpath ...@@ -8,7 +8,6 @@ GETTEXT_TOP_FILES= ABOUT-NLS config.rpath
GETTEXT_PO_FILES= Makefile.in.in Rules-quot boldquot.sed \ GETTEXT_PO_FILES= Makefile.in.in Rules-quot boldquot.sed \
en@boldquot.header en@quot.header insert-header.sin \ en@boldquot.header en@quot.header insert-header.sin \
quot.sed remove-potcdate.sin quot.sed remove-potcdate.sin
BUILD_DATE=$(shell dpkg-parsechangelog --show-field Date)
%: %:
dh $@ dh $@
...@@ -38,9 +37,7 @@ override_dh_auto_configure: ...@@ -38,9 +37,7 @@ override_dh_auto_configure:
--with-tidy=/usr/bin/tidy --with-tidy=/usr/bin/tidy
override_dh_auto_build: override_dh_auto_build:
# Fake consistent user and enforce all three modification times fakeroot dh_auto_build
faketime "$(BUILD_DATE)" fakeroot sh -c \
'cp doc/mp4h.mp4h doc/mp4h.mp4h.tmp && rm doc/mp4h.mp4h && mv doc/mp4h.mp4h.tmp doc/mp4h.mp4h && dh_auto_build'
override_dh_auto_clean: override_dh_auto_clean:
-tar cvf debian/needed-after-clean.tar ABOUT-NLS po/Makefile.in.in -tar cvf debian/needed-after-clean.tar ABOUT-NLS po/Makefile.in.in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment