summaryrefslogtreecommitdiff
path: root/brillo_config
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 16:12:12 -0800
commitf01bc2175998a3d13e47dc6afe913ae8f036a89e (patch)
tree1cbc448d6b3b3310dfd3b4751f41a2d4e9d7a0f8 /brillo_config
parentde104595f3b2001658b50278725d2a7491d724a6 (diff)
downloadextras-f01bc2175998a3d13e47dc6afe913ae8f036a89e.tar.gz
brillo_config: pull PRODUCT_VERSION from cfgtree
Add support to read the product version from config/brillo/product_version Change-Id: Iee2394810b42fbab8be1e318373140f289f91346
Diffstat (limited to 'brillo_config')
-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")