build: store SOURCE_DATE_EPOCH in JSON info files
authorPaul Spooren <mail@aparcar.org>
Sun, 1 Nov 2020 21:53:39 +0000 (11:53 -1000)
committerPetr Štetiar <ynezz@true.cz>
Thu, 12 Nov 2020 17:19:44 +0000 (18:19 +0100)
The source date epoch is the only reproducible date close to the actual
build date. It can be used for tooling like the firmware wizard to show
the image age.

Signed-off-by: Paul Spooren <mail@aparcar.org>
include/image.mk
scripts/json_add_image_info.py

index de08d04aa4620870ce358e6ff7d735ae93602560..eabc9ece0be162641e61b3ebf0efc7e9107daefe 100644 (file)
@@ -563,6 +563,7 @@ define Device/Build/image
        @mkdir -p $$(shell dirname $$@)
        DEVICE_ID="$(DEVICE_NAME)" \
        BIN_DIR="$(BIN_DIR)" \
+       SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
        IMAGE_NAME="$(IMAGE_NAME)" \
        IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \
        IMAGE_PREFIX="$(IMAGE_PREFIX)" \
index 768bb102541ba3f4011c228c52b739709b950c11..ac907c777c4454772ee37b32d246d20299b39da1 100755 (executable)
@@ -44,6 +44,7 @@ image_info = {
     "target": "{}/{}".format(getenv("TARGET"), getenv("SUBTARGET")),
     "version_code": getenv("VERSION_CODE"),
     "version_number": getenv("VERSION_NUMBER"),
+    "source_date_epoch": getenv("SOURCE_DATE_EPOCH"),
     "profiles": {
         device_id: {
             "image_prefix": getenv("IMAGE_PREFIX"),