On 2021-09-30, Vagrant Cascadian wrote: > On 2016-07-05, Reiner Herrmann wrote: >> Source: bibclean >> Version: 2.11.4.1-4 >> Severity: wishlist >> Tags: patch upstream >> User: reproducible-bui...@lists.alioth.debian.org >> Usertags: timestamps username hostname >> X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org >> >> Hi! >> >> While working on the "reproducible builds" effort [1], we have noticed >> that bibclean could not be built reproducibly. >> It embeds the username and hostname into the binary, and a timestamp >> into a dvi file. >> >> The attached patch this by stripping non-deterministic data and setting >> FORCE_SOURCE_DATE, which tells texlive to override the timestamps in the >> dvi file with SOURCE_DATE_EPOCH. >> >> Regards, >> Reiner >> >> [1]: https://wiki.debian.org/ReproducibleBuilds > > I can confirm this patch still works, although there are build-path > issues it does not resolve (though tests.reproducible-builds.org doesn't > current test build path variations in testing or stable, so applying > this patch would be sufficient to get the package to at least build > reproducibly there.
Adding this to debian/rules fixes build paths too: +# Pass option to strip out build paths for reproducible builds +CFLAGS += -ffile-prefix-map=$(CURDIR)=. Updated patch attached also including this. Alternately, switching to using the default buildflags provided by /usr/share/dpkg/buildflags.mk or calling dpkg-buildflags to set CFLAGS appropriately would also work. live well, vagrant
diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch new file mode 100644 index 0000000..6d32ce8 --- /dev/null +++ b/debian/patches/reproducible-build.patch @@ -0,0 +1,30 @@ +Author: Reiner Herrmann <rei...@reiner-h.de> +Description: Strip non-deterministic data to make build reproducible + +--- a/option.c ++++ b/option.c +@@ -567,24 +567,6 @@ + #if defined(HOST) || defined(USER) || defined(__DATE__) || defined(__TIME__) + "Compiled", + +-#if defined(USER) +- " by <", USER, +- +-#if defined(HOST) +- "@", HOST, +-#endif /* defined(HOST) */ +- +- ">", +-#endif /* defined(USER) */ +- +-#if defined(__DATE__) +- " on ", __DATE__, +-#endif /* defined(__DATE__) */ +- +-#if defined(__TIME__) +- " ", __TIME__, +-#endif /* defined(__TIME__) */ +- + #if defined(HAVE_PATTERNS) + "\nwith native pattern matching", + #endif /* defined(HAVE_PATTERNS) */ diff --git a/debian/patches/series b/debian/patches/series index b4e2b79..4305c2c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ make.patch source.patch man.patch bibclean.ini.patch +reproducible-build.patch diff --git a/debian/rules b/debian/rules index 23a3ba1..3396a42 100755 --- a/debian/rules +++ b/debian/rules @@ -9,12 +9,16 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +export FORCE_SOURCE_DATE=1 + CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif +# Pass option to strip out build paths for reproducible builds +CFLAGS += -ffile-prefix-map=$(CURDIR)=. # This target makes sure that timestamps of files are in the # right order after dpkg-deb has unpacked the package. It prevents
signature.asc
Description: PGP signature