forked from openkylin/platform_build
Fail even dev build when property value exceeds length limit.
Let developers know the issue earlier when they set up new products. Change-Id: I3f2ecbc3a833c1a8a84bd75407a5c035e5fea70a
This commit is contained in:
parent
4c178ebcc0
commit
38df101343
|
@ -56,8 +56,6 @@ def validate(prop):
|
|||
"""
|
||||
check_pass = True
|
||||
buildprops = prop.to_dict()
|
||||
dev_build = buildprops.get("ro.build.version.incremental",
|
||||
"").startswith("eng")
|
||||
for key, value in buildprops.iteritems():
|
||||
# Check build properties' length.
|
||||
if len(key) > PROP_NAME_MAX:
|
||||
|
@ -66,19 +64,10 @@ def validate(prop):
|
|||
(key, PROP_NAME_MAX))
|
||||
sys.stderr.write("%s (%d)\n" % (key, len(key)))
|
||||
if len(value) > PROP_VALUE_MAX:
|
||||
# If dev build, show a warning message, otherwise fail the
|
||||
# build with error message
|
||||
if dev_build:
|
||||
sys.stderr.write("warning: %s exceeds %d bytes: " %
|
||||
(key, PROP_VALUE_MAX))
|
||||
sys.stderr.write("%s (%d)\n" % (value, len(value)))
|
||||
sys.stderr.write("warning: This will cause the %s " % key)
|
||||
sys.stderr.write("property return as empty at runtime\n")
|
||||
else:
|
||||
check_pass = False
|
||||
sys.stderr.write("error: %s cannot exceed %d bytes: " %
|
||||
(key, PROP_VALUE_MAX))
|
||||
sys.stderr.write("%s (%d)\n" % (value, len(value)))
|
||||
check_pass = False
|
||||
sys.stderr.write("error: %s cannot exceed %d bytes: " %
|
||||
(key, PROP_VALUE_MAX))
|
||||
sys.stderr.write("%s (%d)\n" % (value, len(value)))
|
||||
return check_pass
|
||||
|
||||
class PropFile:
|
||||
|
|
Loading…
Reference in New Issue