aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Drewry <drewry@google.com>2015-10-28 18:03:20 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-28 18:03:20 +0000
commitd4f8fae8c4e305a189af15f081f9e0df525083bf (patch)
tree7e00eedeae4c2a44ec05b9e705564c9a348daffa
parentf5872349d6a43e0cf2b3fbed2eff7a62517fb940 (diff)
parentdb7e1068e7178aeaf282478e9092a4fde8c2d137 (diff)
downloadbdk-d4f8fae8c4e305a189af15f081f9e0df525083bf.tar.gz
Merge "ledflasher: override AndroidProducts.mk and <product>.mk" into mnc-brillo-dev
-rw-r--r--brunch/lib/core/product.py20
-rw-r--r--brunch/lib/core/product_templates.py21
2 files changed, 34 insertions, 7 deletions
diff --git a/brunch/lib/core/product.py b/brunch/lib/core/product.py
index 7fa9f4d..9a133af 100644
--- a/brunch/lib/core/product.py
+++ b/brunch/lib/core/product.py
@@ -73,10 +73,11 @@ class ProductCreator(object):
self._config.bdk_version = util.GetBDKVersion()
def _create_common(self):
- # TODO(wad) handle os, open exceptions.
- os.makedirs(self._name)
- os.makedirs(os.path.join(self._name, 'out'))
- os.makedirs(os.path.join(self._name, 'src'))
+ paths = [ self._name, os.path.join(self._name, 'out'), \
+ os.path.join(self._name, 'src') ]
+ for path in paths:
+ if not os.path.exists(path):
+ os.makedirs(path)
self._init_config()
with open(os.path.join(self._name, 'AndroidProducts.mk'), 'w') as f:
@@ -108,12 +109,17 @@ class ProductCreator(object):
# The only reason the example can work with a copy in tree is that we do not
# symlink in the product tree during the per-product build. If that changes,
# then ledflasher will need to be generated from a template.
- shutil.copytree('%s/product/google/example-ledflasher' % bdk_path,
+ shutil.copytree(os.path.join(bdk_path, 'product',
+ 'google', 'example-ledflasher'),
self._name,
False, # don't follow symlinks
shutil.ignore_patterns('.git'))
- # Initialize the config since we couldn't do it before the path existed.
- self._init_config()
+ # Update the product.mk to reflect the name and board
+ os.unlink(os.path.join(self._name, 'ledflasher.mk'))
+ self._create_common()
+ with open(os.path.join(self._name, ('%s.mk' % self._name)), 'w') as f:
+ f.write(product_templates.LEDFLASHER_MK.substitute(
+ self._config.dict()))
class Environment(object):
diff --git a/brunch/lib/core/product_templates.py b/brunch/lib/core/product_templates.py
index 332e936..96bc210 100644
--- a/brunch/lib/core/product_templates.py
+++ b/brunch/lib/core/product_templates.py
@@ -39,6 +39,27 @@ PRODUCT_PACKAGES += \\
""")
+LEDFLASHER_MK = string.Template("""\
+# Automatically generated by brunch.
+include device/generic/brillo/brillo_base.mk
+$$(call set-product-defaults)
+PRODUCT_BRAND := Brillo
+PRODUCT_MANUFACTURER := ${product_manufacturer}
+PRODUCT_DEVICE := ${product_device}
+PRODUCT_PACKAGES += \\
+ ledflasher \\
+ ledservice \\
+
+# Install LED Flasher config file for weaved.
+PRODUCT_COPY_FILES += \\
+ $$(LOCAL_PATH)/weaved.conf:system/etc/weaved/weaved.conf
+
+BOARD_SEPOLICY_DIRS := $$(BOARD_SEPOLICY_DIRS) $$(LOCAL_PATH)/sepolicy
+
+# Set the crash server URL.
+BRILLO_CRASH_SERVER := https://clients2.google.com/bc/report
+""")
+
HELLO_WORLD_MK = string.Template("""\
# Automatically generated by brunch.
include device/generic/brillo/brillo_base.mk