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

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



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



 


Rackspace

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