summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Drewry <drewry@google.com>2015-11-05 16:07:18 -0800
committerWill Drewry <drewry@google.com>2015-11-05 18:22:17 -0800
commit9f633ed448ed20545fcb3b096a5917cf40760df9 (patch)
tree980c6638873cc3a6828295c257a5c3914ee30495
parent289f1ba7c3e094f87ded911581bc0584dc525e2e (diff)
downloadextras-brillo-m7-release.tar.gz
brillo_config: pull PRODUCT_VERSION from cfgtreebrillo-m7-releasebrillo-m7-mr-devbrillo-m7-dev
Add support to read the product version from config/brillo/product_version (cherry picked from commit f01bc2175998a3d13e47dc6afe913ae8f036a89e) BUG=25516395 Change-Id: Id1277112ce7f7c89c9d984ff372bc43007d41016
-rw-r--r--brillo_config/Android.mk13
1 files changed, 11 insertions, 2 deletions
diff --git a/brillo_config/Android.mk b/brillo_config/Android.mk
index 87ea7cb8..8946e784 100644
--- a/brillo_config/Android.mk
+++ b/brillo_config/Android.mk
@@ -40,9 +40,18 @@ LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
include $(BUILD_SYSTEM)/base_rules.mk
-# The version is set to 0.0.0 if the user did not set the actual version.
+
+# The version is set to 0.0.0 if the user did not set the actual version and
+# a version cannot be loaded from the product cfgtree.
# This allows us to have a valid version number while being easy to filter.
-BRILLO_PRODUCT_VERSION ?= "0.0.0"
+ifeq ($(BRILLO_PRODUCT_VERSION),)
+# Load from file first
+BRILLO_PRODUCT_VERSION := $(call cfgtree-get-if-exists,brillo/product_version)
+endif
+# If the version is still empty, override it with 0.0.0
+ifeq ($(BRILLO_PRODUCT_VERSION),)
+BRILLO_PRODUCT_VERSION := "0.0.0"
+endif
ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),)
$(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \
three numbers separated by dots. Example: "1.2.0")