Package: qemu-system-data
Version: 1:5.0-5
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

The various openbios roms include time and date information embedded in
the binary.

The attached patch uses the SOURCE_DATE_EPOCH environment variable,
which is exported by dpkg-buildpackage, to set the date to a consistant
value between builds. It relies on features of GNU date in order to keep
the patch simple, though that may prevent it from being upstreamable.

Thanks for maintaining qemu!


live well,
  vagrant

From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Sun, 21 Jun 2020 19:27:11 +0000
X-Dgit-Generated: 1:5.0-6~0~20200621~20 0b5923e6cc49abffd582177ba8558cfb6c7f10ce
Subject: roms/openbios: Use SOURCE_DATE_EPOCH in Makefile.

Embedding the build time breaks reproducibility. Instead, use the date
specified by the SOURCE_DATE_EPOCH environment variable:

  https://reproducible-builds.org/docs/source-date-epoch/

This patch relies on features of GNU date, and will need further
changes for portability to other systems.

---

--- qemu-5.0.orig/roms/openbios/Makefile.target
+++ qemu-5.0/roms/openbios/Makefile.target
@@ -54,14 +54,14 @@ versions: $(ODIR)/target/include/openbio
 
 $(ODIR)/forth/version.fs:
 	$(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
-	@DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ;  \
+	@DATE="$(shell echo `LC_ALL=C date --utc --date=@$(SOURCE_DATE_EPOCH) +'%b %e %Y %H:%M'`)" ;  \
 		( echo ": builddate \" $$DATE\" ; " ;     \
 		  echo ": version \" $(VERSION)\" ; " ; ) \
 		  > $(dir $@)/version.fs
 
 $(ODIR)/target/include/openbios-version.h:
 	$(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
-	@DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
+	@DATE="$(shell echo `LC_ALL=C date --utc --date=@$(SOURCE_DATE_EPOCH) +'%b %e %Y %H:%M'`)" ; \
           ( echo "#define OPENBIOS_BUILD_DATE \"$$DATE\"" ; \
            echo "#define OPENBIOS_VERSION_STR \"$(VERSION)\"" ; ) \
          > $(dir $@)/openbios-version.h

Attachment: signature.asc
Description: PGP signature

Reply via email to