diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-01-03 02:46:15 +0000 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-06 16:31:30 -0700 |
commit | ab949b5c6394de98dc6ccb9fa3964219e21f5d71 (patch) | |
tree | df743eb47656197744c1f1d8a9852b6ced81abd8 | |
parent | b2190846fc85594a8f9775f607c6aa176f52cc5c (diff) | |
download | build-ab949b5c6394de98dc6ccb9fa3964219e21f5d71.zip build-ab949b5c6394de98dc6ccb9fa3964219e21f5d71.tar.gz build-ab949b5c6394de98dc6ccb9fa3964219e21f5d71.tar.bz2 |
Allow individual projects to enforce a property's value
Some projects require system properties to be set to a specific
value (for example, a shared library needing a property pointing
to its own path) in order to work correctly, but some device
configurations are mistakenly setting those properties with the
wrong value (usually inherited from the original OEM build).
"PRODUCT_PROPERTY_UBER_OVERRIDES += property=value" can (and
should) be used in that project's makefile to ensure the value
is the correct one. This variable is intended for software projects,
and should never be used in product makefiles (BoardConfig, cm.mk,
AndroidProduct)
Change-Id: I1986e7c444e51cce8b198e43fdc793fad16d6276
-rw-r--r-- | core/Makefile | 2 | ||||
-rwxr-xr-x | tools/post_process_props.py | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/core/Makefile b/core/Makefile index 0dfa2df..047288d 100644 --- a/core/Makefile +++ b/core/Makefile @@ -265,7 +265,7 @@ endif $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \ echo "$(line)" >> $@;) $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@ - $(hide) build/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST) + $(hide) build/tools/post_process_props.py $@ "$(PRODUCT_PROPERTY_UBER_OVERRIDES)" $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST) build_desc := diff --git a/tools/post_process_props.py b/tools/post_process_props.py index fa6106f..cbbf1f1 100755 --- a/tools/post_process_props.py +++ b/tools/post_process_props.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys +import os, sys # Usage: post_process_props.py file.prop [blacklist_key, ...] # Blacklisted keys are removed from the property file, if present @@ -27,7 +27,14 @@ PROP_VALUE_MAX = 91 # Put the modifications that you need to make into the /system/build.prop into this # function. The prop object has get(name) and put(name,value) methods. -def mangle_build_prop(prop): +def mangle_build_prop(prop, overrides): + if len(overrides) == 0: + return + overridelist = overrides.replace(" ",",").split(",") + for proppair in overridelist: + values = proppair.split("=") + prop.put(values[0], values[1]) + pass # Put the modifications that you need to make into the /default.prop into this @@ -110,6 +117,10 @@ class PropFile: def main(argv): filename = argv[1] + if (len(argv) > 2): + extraargs = argv[2] + else: + extraargs = "" f = open(filename) lines = f.readlines() f.close() @@ -117,7 +128,7 @@ def main(argv): properties = PropFile(lines) if filename.endswith("/build.prop"): - mangle_build_prop(properties) + mangle_build_prop(properties, extraargs) elif filename.endswith("/default.prop"): mangle_default_prop(properties) else: @@ -128,7 +139,7 @@ def main(argv): sys.exit(1) # Drop any blacklisted keys - for key in argv[2:]: + for key in argv[3:]: properties.delete(key) f = open(filename, 'w+') |