Merge "Fix potential issues if str has spaces"

This commit is contained in:
Kelvin Zhang
2022-06-25 00:49:48 +00:00
committed by Gerrit Code Review
3 changed files with 7 additions and 7 deletions

View File

@@ -557,7 +557,7 @@ def AddPartitionTable(output_zip):
cmd = [bpttool, "make_table", "--output_json", bpt.name,
"--output_gpt", img.name]
input_files_str = OPTIONS.info_dict["board_bpt_input_files"]
input_files = input_files_str.split(" ")
input_files = input_files_str.split()
for i in input_files:
cmd.extend(["--input", i])
disk_size = OPTIONS.info_dict.get("board_bpt_disk_size")

View File

@@ -1186,8 +1186,8 @@ def MergeDynamicPartitionInfoDicts(framework_dict, vendor_dict):
"""
def uniq_concat(a, b):
combined = set(a.split(" "))
combined.update(set(b.split(" ")))
combined = set(a.split())
combined.update(set(b.split()))
combined = [item.strip() for item in combined if item.strip()]
return " ".join(sorted(combined))
@@ -1208,7 +1208,7 @@ def MergeDynamicPartitionInfoDicts(framework_dict, vendor_dict):
# Super block devices are defined by the vendor dict.
if "super_block_devices" in vendor_dict:
merged_dict["super_block_devices"] = vendor_dict["super_block_devices"]
for block_device in merged_dict["super_block_devices"].split(" "):
for block_device in merged_dict["super_block_devices"].split():
key = "super_%s_device_size" % block_device
if key not in vendor_dict:
raise ValueError("Vendor dict does not contain required key %s." % key)
@@ -1217,7 +1217,7 @@ def MergeDynamicPartitionInfoDicts(framework_dict, vendor_dict):
# Partition groups and group sizes are defined by the vendor dict because
# these values may vary for each board that uses a shared system image.
merged_dict["super_partition_groups"] = vendor_dict["super_partition_groups"]
for partition_group in merged_dict["super_partition_groups"].split(" "):
for partition_group in merged_dict["super_partition_groups"].split():
# Set the partition group's size using the value from the vendor dict.
key = "super_%s_group_size" % partition_group
if key not in vendor_dict:

View File

@@ -881,7 +881,7 @@ def RewriteProps(data):
pieces[-1] = EditTags(pieces[-1])
value = "/".join(pieces)
elif key == "ro.build.description":
pieces = value.split(" ")
pieces = value.split()
assert pieces[-1].endswith("-keys")
pieces[-1] = EditTags(pieces[-1])
value = " ".join(pieces)
@@ -1098,7 +1098,7 @@ def RewriteAvbProps(misc_info):
tokens = []
changed = False
for token in args.split(' '):
for token in args.split():
fingerprint_key = 'com.android.build.{}.fingerprint'.format(partition)
if not token.startswith(fingerprint_key):
tokens.append(token)