Add sprout support to signing tools

Bug: 15379701

Change-Id: Ied8329e1162250cc5509b65ef8bf0b5a9ddda3c3
This commit is contained in:
Michael Runge 2014-06-03 14:43:11 -07:00
parent 4f12fceead
commit dc2661afe2

View file

@ -142,6 +142,7 @@ def SignApk(data, keyname, pw):
def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
apk_key_map, key_passwords):
maxsize = max([len(os.path.basename(i.filename))
for i in input_tf_zip.infolist()
if i.filename.endswith('.apk')])
@ -188,7 +189,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
elif info.filename in ("SYSTEM/build.prop",
"RECOVERY/RAMDISK/default.prop"):
print "rewriting %s:" % (info.filename,)
new_data = RewriteProps(data)
new_data = RewriteProps(data, misc_info)
output_tf_zip.writestr(out_info, new_data)
if info.filename == "RECOVERY/RAMDISK/default.prop":
write_to_temp(info.filename, info.external_attr, new_data)
@ -270,14 +271,20 @@ def EditTags(tags):
return ",".join(sorted(tags))
def RewriteProps(data):
def RewriteProps(data, misc_info):
output = []
for line in data.split("\n"):
line = line.strip()
original_line = line
if line and line[0] != '#':
if line and line[0] != '#' and "=" in line:
key, value = line.split("=", 1)
if key == "ro.build.fingerprint":
if (key == "ro.build.fingerprint"
and misc_info.get("oem_fingerprint_properties") is None):
pieces = value.split("/")
pieces[-1] = EditTags(pieces[-1])
value = "/".join(pieces)
elif (key == "ro.build.thumbprint"
and misc_info.get("oem_fingerprint_properties") is not None):
pieces = value.split("/")
pieces[-1] = EditTags(pieces[-1])
value = "/".join(pieces)