Message ID | 57423c6627e00fbc3f41d3f6be6ba1e15abb96fc.1604156731.git.frederic.pierret@qubes-os.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Reproducibility: use of SOURCE_DATE_EPOCH | expand |
On 31.10.2020 16:14, Frédéric Pierret (fepitre) wrote: > --- 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 As this pattern recurs, how about abstracting it away via a definition (perhaps to be placed in ./Config.mk) along the lines of (variable name subject to improvement) DATE_EPOCH_OPTS := $(if $(SOURCE_DATE_EPOCH),-u -d "@$(SOURCE_DATE_EPOCH)") and then here simply SMBIOS_REL_DATE ?= $(shell date $(DATE_EPOCH_OPTS) +%m/%d/%Y) (i.e. in particular also without any "ifneq()")? Jan
Le 11/3/20 à 10:10 AM, Jan Beulich a écrit : > On 31.10.2020 16:14, Frédéric Pierret (fepitre) wrote: >> --- 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 > > As this pattern recurs, how about abstracting it away via a > definition (perhaps to be placed in ./Config.mk) along the > lines of (variable name subject to improvement) > > DATE_EPOCH_OPTS := $(if $(SOURCE_DATE_EPOCH),-u -d "@$(SOURCE_DATE_EPOCH)") > > and then here simply > > SMBIOS_REL_DATE ?= $(shell date $(DATE_EPOCH_OPTS) +%m/%d/%Y) > > (i.e. in particular also without any "ifneq()")? > > Jan > Hi Jan, Yes it makes sense. I'll prepare another version with your comments. Thank you. Frédéric
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