Source: seabios
Version: 1.7.5-1
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps hostname

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that seabios could not be built reproducibly.

The attached patch adds a way to configure the time and the hostname
in the version string through environment variables. These variables
are then set in debian/rules.

Once applied, seabios can be built reproducibly in our current
experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds

-- 
Lunar                                             <lu...@torproject.org>
diff -Nru seabios-1.7.5/debian/changelog seabios-1.7.5/debian/changelog
--- seabios-1.7.5/debian/changelog	2014-05-31 08:29:25.000000000 +0000
+++ seabios-1.7.5/debian/changelog	2015-04-19 17:00:54.000000000 +0000
@@ -1,3 +1,14 @@
+seabios (1.7.5-1.0~reproducible1) UNRELEASED; urgency=low
+
+  * make the build reproducible:
+    - add a patch to allow the build time and hostname embedded in
+      the version string to optionally be set through environment
+      variable
+    - set these variables to the latest debian/changelog entry for
+      the build time and "debian" for the hostname in debian/rules
+
+ -- Jérémy Bobbio <lu...@debian.org>  Sun, 19 Apr 2015 16:53:11 +0000
+
 seabios (1.7.5-1) unstable; urgency=medium
 
   * new upstream release
diff -Nru seabios-1.7.5/debian/patches/allow_external_time_and_hostname_for_version.patch seabios-1.7.5/debian/patches/allow_external_time_and_hostname_for_version.patch
--- seabios-1.7.5/debian/patches/allow_external_time_and_hostname_for_version.patch	1970-01-01 00:00:00.000000000 +0000
+++ seabios-1.7.5/debian/patches/allow_external_time_and_hostname_for_version.patch	2015-04-19 16:53:02.000000000 +0000
@@ -0,0 +1,46 @@
+Description: <short summary of the patch>
+ TODO: Put a short summary on the line above and replace this paragraph
+ with a longer explanation of this change. Complete the meta-information
+ with other relevant fields (see below for details). To make it easier, the
+ information below has been extracted from the changelog. Adjust it or drop
+ it.
+ .
+ seabios (1.7.5-1) unstable; urgency=medium
+ .
+   * new upstream release
+   * dropped all patches taken from upstream
+   * disabled more features (XEN & USB_UAS) from the 128k bios build to fit
+   * set upstream source URL (Closes: #740471)
+Author: Michael Tokarev <m...@tls.msk.ru>
+Bug-Debian: https://bugs.debian.org/740471
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- seabios-1.7.5.orig/scripts/buildversion.sh
++++ seabios-1.7.5/scripts/buildversion.sh
+@@ -11,7 +11,13 @@ elif [ -f .version ]; then
+ else
+     VERSION="?"
+ fi
+-VERSION="${VERSION}-`date +"%Y%m%d_%H%M%S"`-`hostname`"
++if ! [ "$BUILD_TIME" ]; then
++    BUILD_TIME=`date +"%Y%m%d_%H%M%S"`
++fi
++if ! [ "$HOSTNAME" ]; then
++    HOSTNAME=`hostname`
++fi
++VERSION="${VERSION}-${BUILD_TIME}-${HOSTNAME}"
+ echo "Version: ${VERSION}"
+ 
+ # Build header file
diff -Nru seabios-1.7.5/debian/patches/series seabios-1.7.5/debian/patches/series
--- seabios-1.7.5/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ seabios-1.7.5/debian/patches/series	2015-04-19 16:58:15.000000000 +0000
@@ -0,0 +1 @@
+allow_external_time_and_hostname_for_version.patch
diff -Nru seabios-1.7.5/debian/rules seabios-1.7.5/debian/rules
--- seabios-1.7.5/debian/rules	2014-05-31 08:20:17.000000000 +0000
+++ seabios-1.7.5/debian/rules	2015-04-19 16:52:59.000000000 +0000
@@ -10,6 +10,12 @@
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
+# Set reproducible values for scripts/buildversion.sh
+BUILD_TIME = $(shell dpkg-parsechangelog -S Date | date -u -f - +"%Y%m%d_%H%M%S")
+export BUILD_TIME
+HOSTNAME = debian
+export HOSTNAME
+
 VGABIOSES = cirrus stdvga vmware qxl isavga
 VGABIOS_TARGETS = $(addprefix build/vgabios-, $(addsuffix .bin, $(VGABIOSES)))
 BUILD_TARGETS = build/bios.bin build/bios-256k.bin \

Attachment: signature.asc
Description: Digital signature

Reply via email to