[openwrt/openwrt] build: store SOURCE_DATE_EPOCH in JSON info files

LEDE Commits lede-commits at lists.infradead.org
Thu Nov 12 12:22:34 EST 2020


ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/165f0b00cdd2f763c1d478c2f58c535fc19b13bd

commit 165f0b00cdd2f763c1d478c2f58c535fc19b13bd
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Sun Nov 1 11:53:39 2020 -1000

    build: store SOURCE_DATE_EPOCH in JSON info files
    
    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 at aparcar.org>
---
 include/image.mk               | 1 +
 scripts/json_add_image_info.py | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/image.mk b/include/image.mk
index de08d04aa4..eabc9ece0b 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -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)" \
diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py
index 768bb10254..ac907c777c 100755
--- a/scripts/json_add_image_info.py
+++ b/scripts/json_add_image_info.py
@@ -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"),



More information about the lede-commits mailing list