From 8cd2bcba15c328c124b28fc12cd1b9846633d5d5 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Wed, 28 Dec 2016 11:33:29 +1100 Subject: build: support lineage device trees Change-Id: I087a97e31cab2ccfba16b5378cef429785baf7d0 --- core/product_config.mk | 6 +++++- envsetup.sh | 23 +++++++++++++++++------ tools/roomservice.py | 33 +++++++++++++++++++-------------- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/core/product_config.mk b/core/product_config.mk index 89c6810..58b03e9 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -181,7 +181,11 @@ include $(BUILD_SYSTEM)/device.mk # A CM build needs only the CM product makefiles. ifneq ($(CM_BUILD),) - all_product_configs := $(shell find device -path "*/$(CM_BUILD)/cm.mk") + all_product_configs := $(shell find device -path "*/$(CM_BUILD)/lineage.mk") + ifeq ($(all_product_configs),) + # Fall back to cm.mk + all_product_configs := $(shell find device -path "*/$(CM_BUILD)/cm.mk") + endif else ifneq ($(strip $(TARGET_BUILD_APPS)),) # An unbundled app build needs only the core product makefiles. diff --git a/envsetup.sh b/envsetup.sh index 42823df..8030ce4 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -84,11 +84,17 @@ function check_product() return fi - if (echo -n $1 | grep -q -e "^cm_") ; then - CM_BUILD=$(echo -n $1 | sed -e 's/^cm_//g') - export BUILD_NUMBER=$((date +%s%N ; echo $CM_BUILD; hostname) | openssl sha1 | sed -e 's/.*=//g; s/ //g' | cut -c1-10) + if (echo -n $1 | grep -q -e "^lineage_") ; then + CM_BUILD=$(echo -n $1 | sed -e 's/^lineage_//g') + export BUILD_NUMBER=$((date +%s%N ; echo $CM_BUILD; hostname) | openssl sha1 | sed -e 's/.*=//g; s/ //g' | cut -c1-10) else - CM_BUILD= + # Fall back to cm_ + if (echo -n $1 | grep -q -e "^cm_") ; then + CM_BUILD=$(echo -n $1 | sed -e 's/^cm_//g') + export BUILD_NUMBER=$((date +%s%N ; echo $CM_BUILD; hostname) | openssl sha1 | sed -e 's/.*=//g; s/ //g' | cut -c1-10) + else + CM_BUILD= + fi fi export CM_BUILD @@ -568,11 +574,16 @@ function breakfast() # A buildtype was specified, assume a full device name lunch $target else - # This is probably just the CM model name + # This is probably just the Lineage model name if [ -z "$variant" ]; then variant="userdebug" fi - lunch cm_$target-$variant + lunch lineage_$target-$variant + if [ $? -ne 0 ]; then + # try CM + echo "** Warning: '$target' is using CM-based makefiles. This will be deprecated in the next major release." + lunch cm_$target-$variant + fi fi fi return $? diff --git a/tools/roomservice.py b/tools/roomservice.py index 5393907..691456e 100755 --- a/tools/roomservice.py +++ b/tools/roomservice.py @@ -203,25 +203,30 @@ def add_to_manifest(repositories, fallback_branch = None): def fetch_dependencies(repo_path, fallback_branch = None): print('Looking for dependencies') - dependencies_path = repo_path + '/cm.dependencies' + dependencies_paths = [repo_path + '/lineage.dependencies', repo_path + '/cm.dependencies'] + found_dependencies = False syncable_repos = [] - if os.path.exists(dependencies_path): - dependencies_file = open(dependencies_path, 'r') - dependencies = json.loads(dependencies_file.read()) - fetch_list = [] + for dependencies_path in dependencies_paths: + if os.path.exists(dependencies_path): + dependencies_file = open(dependencies_path, 'r') + dependencies = json.loads(dependencies_file.read()) + fetch_list = [] - for dependency in dependencies: - if not is_in_manifest(dependency['target_path']): - fetch_list.append(dependency) - syncable_repos.append(dependency['target_path']) + for dependency in dependencies: + if not is_in_manifest(dependency['target_path']): + fetch_list.append(dependency) + syncable_repos.append(dependency['target_path']) - dependencies_file.close() + dependencies_file.close() + found_dependencies = True - if len(fetch_list) > 0: - print('Adding dependencies to manifest') - add_to_manifest(fetch_list, fallback_branch) - else: + if len(fetch_list) > 0: + print('Adding dependencies to manifest') + add_to_manifest(fetch_list, fallback_branch) + break + + if not found_dependencies: print('Dependencies file not found, bailing out.') if len(syncable_repos) > 0: -- cgit v1.1