[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 1/2] Define build dates/time based on SOURCE_DATE_EPOCH



It improves reproducibility if SOURCE_DATE_EPOCH is
defined while building xen binary
---
 tools/firmware/hvmloader/Makefile | 4 ++++
 tools/firmware/vgabios/Makefile   | 4 ++++
 xen/Makefile                      | 5 +++++
 3 files changed, 13 insertions(+)

diff --git a/tools/firmware/hvmloader/Makefile 
b/tools/firmware/hvmloader/Makefile
index e980ce7c5f..923e3c8b9a 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -21,7 +21,11 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
 # SMBIOS spec requires format mm/dd/yyyy
+ifneq ($(SOURCE_DATE_EPOCH),)
+SMBIOS_REL_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%m/%d/%Y" 
2>/dev/null)
+else
 SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
+endif
 
 CFLAGS += $(CFLAGS_xeninclude)
 
diff --git a/tools/firmware/vgabios/Makefile b/tools/firmware/vgabios/Makefile
index 3284812fde..9b8b687a73 100644
--- a/tools/firmware/vgabios/Makefile
+++ b/tools/firmware/vgabios/Makefile
@@ -5,7 +5,11 @@ BCC = bcc
 AS86 = as86
 
 RELEASE = `pwd | sed "s-.*/--"`
+ifneq ($(SOURCE_DATE_EPOCH),)
+VGABIOS_REL_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%d %b %Y" 
2>/dev/null)
+else
 VGABIOS_REL_DATE ?= `date '+%d %b %Y'`
+endif
 RELVERS = `pwd | sed "s-.*/--" | sed "s/vgabios//" | sed "s/-//"`
 
 VGABIOS_DATE = "-DVGABIOS_DATE=\"$(VGABIOS_REL_DATE)\""
diff --git a/xen/Makefile b/xen/Makefile
index bf0c804d43..30b1847515 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -8,8 +8,13 @@ export XEN_FULLVERSION   = 
$(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 
 export XEN_WHOAMI      ?= $(USER)
 export XEN_DOMAIN      ?= $(shell ([ -x /bin/dnsdomainname ] && 
/bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo 
[unknown]))
+ifneq ($(SOURCE_DATE_EPOCH),)
+export XEN_BUILD_DATE  ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" 
2>/dev/null)
+export XEN_BUILD_TIME  ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +%T 
2>/dev/null)
+else
 export XEN_BUILD_DATE  ?= $(shell LC_ALL=C date)
 export XEN_BUILD_TIME  ?= $(shell LC_ALL=C date +%T)
+endif
 export XEN_BUILD_HOST  ?= $(shell hostname)
 
 # Best effort attempt to find a python interpreter, defaulting to Python 3 if
-- 
2.26.2





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.