[Reproducible-builds] Bug#788752: analog: please make the build reproducible

Dhole dhole at openmailbox.org
Mon Jun 15 11:54:59 UTC 2015


Hi!

The patch I submitted earlier removed the timestamp from the build
system. Probably removing the `<property name="built" content="...">`
field in the generated xml by outxml.c was not desirable, so I've
improved the patch.
In this case no timestamp is removed: the build date can now be set
externally, and specifically it is set to the last debian/changelog entry.

-- 
Dhole
-------------- next part --------------
diff -u analog-6.0/debian/changelog analog-6.0/debian/changelog
--- analog-6.0/debian/changelog
+++ analog-6.0/debian/changelog
@@ -1,3 +1,11 @@
+analog (2:6.0-21) UNRELEASED; urgency=medium
+
+  * Patch build system to allow the build date to be set externally,
+    and set it to the latest debian/changelog entry for reproducibility.
+
+
+ -- Dhole <dhole at openmailbox.org>  Mon, 15 Jun 2015 13:08:11 +0200
+
 analog (2:6.0-20) unstable; urgency=low
 
   * QA upload.
diff -u analog-6.0/debian/rules analog-6.0/debian/rules
--- analog-6.0/debian/rules
+++ analog-6.0/debian/rules
@@ -2,6 +2,8 @@
 
 include /usr/share/quilt/quilt.make
 
+export BUILD_DATE = $(shell LC_ALL=C date -u --date="`dpkg-parsechangelog -SDate`" +'%b %e %Y %H:%M:%S')
+
 clean: unpatch
 	dh clean
 
only in patch2:
unchanged:
--- analog-6.0.orig/src/Makefile
+++ analog-6.0/src/Makefile
@@ -47,6 +47,7 @@
 #             MPE/iX needs LIBS = -lsocket -lm
 #             SVR4 needs LIBS = -lsocket -lnsl -lm
 #             DYNIX/ptx needs LIBS = -L/usr/lib/bsd-socket -lsocket -lnsl -lm
+BUILD_DATE ?= $(shell date '+%b %e %Y') # define in case it is not exported
 
 PROGRAM = analog
 TARGET = ../analog
@@ -69,7 +70,7 @@
 HEADERS = anlghead.h anlghea2.h anlghea3.h anlghea4.h macdir.h \
 	pcre/pcre.h libgd/gd.h libgd/gdfontf.h libgd/gdfonts.h unzip/unzip.h \
 	zlib/zlib.h bzip2/bzlib.h
-ALLCFLAGS = $(CFLAGS) $(DEFS) -D$(OS)
+ALLCFLAGS = $(CFLAGS) $(DEFS) -D$(OS) -DBUILD_DATE="\"$(BUILD_DATE)\""
 ALLOBJS = $(OBJS) $(SUBDIROBJS)
 
 $(PROGRAM): $(OBJS) $(SUBDIRS) $(HEADERS) Makefile
only in patch2:
unchanged:
--- analog-6.0.orig/src/outxml.c
+++ analog-6.0/src/outxml.c
@@ -16,6 +16,10 @@
 
 #define NDEBUG
 
+#ifndef BUILD_DATE
+#define BUILD_DATE __DATE__ " " __TIME__
+#endif
+
 #include <stdio.h>
 #include <stddef.h>
 #include <time.h>
@@ -85,7 +89,7 @@
 	xml_defaults( opts );
 
 	// extract a build timestamp from __DATE__ and __TIME__ -- locale dependent?! need to force "C" locale ?
-	strptime( __DATE__" "__TIME__, "%b%n%d%n%Y%n%T", &temptime );
+	strptime( BUILD_DATE, "%b%n%d%n%Y%n%T", &temptime );
 
 	sprintf( buffer, "%04d%02d%02d%02d%02d",
 	temptime.tm_year+1900, temptime.tm_mon+1, temptime.tm_mday, temptime.tm_hour, temptime.tm_min );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20150615/9d6058d0/attachment.sig>


More information about the Reproducible-builds mailing list