diff options
author | Ying Wang <wangying@android.com> | 2014-03-07 02:27:35 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-07 02:27:35 +0000 |
commit | 0dd00d3d004b5fdc3c3501252f91fe9ec05e7bba (patch) | |
tree | 55e4673f4b080dda77847710d66247cad7004afc /tools | |
parent | 14040db928dd565887f8f3c8cb2e20be0ba53c44 (diff) | |
parent | de90b0307a603449354bb2d265c5b2315b7b6850 (diff) | |
download | build-0dd00d3d004b5fdc3c3501252f91fe9ec05e7bba.zip build-0dd00d3d004b5fdc3c3501252f91fe9ec05e7bba.tar.gz build-0dd00d3d004b5fdc3c3501252f91fe9ec05e7bba.tar.bz2 |
am de90b030: Merge "A build property\'s value is returned empty in runtime when its length exceeds 92 symbols (91 valid symbols + \0). It is better to catch that issue on earlier stage, i.e. fail the build with an appropriate message."
* commit 'de90b0307a603449354bb2d265c5b2315b7b6850':
A build property's value is returned empty in runtime when its length exceeds 92 symbols (91 valid symbols + \0). It is better to catch that issue on earlier stage, i.e. fail the build with an appropriate message.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/post_process_props.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tools/post_process_props.py b/tools/post_process_props.py index 9d69736..32146e3 100755 --- a/tools/post_process_props.py +++ b/tools/post_process_props.py @@ -19,7 +19,27 @@ import sys # 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): - pass + buildprops=prop.buildprops + check_pass=True + for key in buildprops: + # Check build properties' length. + # Terminator(\0) added into the provided value of properties + # Total length (including terminator) will be no greater that PROP_VALUE_MAX(92). + if len(buildprops[key]) > 91: + # If dev build, show a warning message, otherwise fail the build with error message + if prop.get("ro.build.version.incremental").startswith("eng"): + sys.stderr.write("warning: " + key + " exceeds 91 symbols: ") + sys.stderr.write(buildprops[key]) + sys.stderr.write("(" + str(len(buildprops[key])) + ") \n") + sys.stderr.write("warning: This will cause the " + key + " ") + sys.stderr.write("property return as empty at runtime\n") + else: + check_pass=False + sys.stderr.write("error: " + key + " cannot exceed 91 symbols: ") + sys.stderr.write(buildprops[key]) + sys.stderr.write("(" + str(len(buildprops[key])) + ") \n") + if not check_pass: + sys.exit(1) # 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. @@ -40,8 +60,19 @@ def mangle_default_prop(prop): prop.put("persist.sys.usb.config", "none"); class PropFile: + + buildprops={} + def __init__(self, lines): self.lines = [s[:-1] for s in lines] + for line in self.lines: + line=line.strip() + if not line.strip() or line.startswith("#"): + continue + index=line.find("=") + key=line[0:index] + value=line[index+1:] + self.buildprops[key]=value def get(self, name): key = name + "=" |