Expose PLATFORM_SECURITY_PATCH_TIMESTAMP.
We have use case that uses the timestamp for PLATFORM_SECURITY_PATCH in
device specific Makefile, but need to handle the platform-dependent
`date` command. This CL computes and exposes
PLATFORM_SECURITY_PATCH_TIMESTAMP from the core build system.
Bug: 80311893
Test: Use PLATFORM_SECURITY_PATCH_TIMESTAMP in device-specific folder,
on both of Linux and macOS. Check the value.
Change-Id: I27a88dcebde7a1c204491f5f5c45c5160398dbb6
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 8c36359..ec0bfcd 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -258,6 +258,16 @@
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
+ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP
+ # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH.
+ ifneq (,$(findstring Darwin,$(UNAME)))
+ PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -jf '%Y-%m-%d %T %Z' '$(PLATFORM_SECURITY_PATCH) 00:00:00 GMT' +%s)
+ else
+ PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s)
+ endif
+endif
+.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
+
ifndef PLATFORM_BASE_OS
# Used to indicate the base os applied to the device.
# Can be an arbitrary string, but must be a single word.