Hello ipxe-devel, While I work on a reproducible build-id, there's no reason this patch for a reproducible timestamp needs to wait for it. Hence, the attached (and below inlined) patch diff allows a reproducible `BUILD_TIMESTAMP` when the following criteria are satisfied:
* `git` command is available * the ipxe source tree is a git checkout * the git checkout is "clean" (no diff between working tree and index) If the aforementioned are satisfied, then the `BUILD_TIMESTAMP` is assigned the Unix timestamp of the HEAD commit. Otherwise, the `BUILD_TIMESTAMP` is assigned the Unix timestamp of "now"; i.e., heretofore legacy behavior. Inline diff follows... diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 1dd14794..126a082a 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -1168,9 +1168,14 @@ blib : $(BLIB) # BUILD_ID_CMD := perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );' +# assumes first element in MAKEFILE_LIST is src/Makefile: +IPXE_DIR := $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST))))/..) + # Build timestamp # -BUILD_TIMESTAMP := $(shell date +%s) +BUILD_TIMESTAMP := $(shell git -C $(IPXE_DIR) diff-files --quiet \ + && git -C $(IPXE_DIR) show -s --format=%ct HEAD \ + || date +%s) # Build version #
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 1dd14794..126a082a 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -1168,9 +1168,14 @@ blib : $(BLIB) # BUILD_ID_CMD := perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );' +# assumes first element in MAKEFILE_LIST is src/Makefile: +IPXE_DIR := $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST))))/..) + # Build timestamp # -BUILD_TIMESTAMP := $(shell date +%s) +BUILD_TIMESTAMP := $(shell git -C $(IPXE_DIR) diff-files --quiet \ + && git -C $(IPXE_DIR) show -s --format=%ct HEAD \ + || date +%s) # Build version #
_______________________________________________ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo/ipxe-devel