From 9f633ed448ed20545fcb3b096a5917cf40760df9 Mon Sep 17 00:00:00 2001 From: Will Drewry Date: Thu, 5 Nov 2015 16:07:18 -0800 Subject: brillo_config: pull PRODUCT_VERSION from cfgtree Add support to read the product version from config/brillo/product_version (cherry picked from commit f01bc2175998a3d13e47dc6afe913ae8f036a89e) BUG=25516395 Change-Id: Id1277112ce7f7c89c9d984ff372bc43007d41016 --- brillo_config/Android.mk | 13 +++++++++++-- 1 file 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") -- cgit v1.2.3