Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5ddfcd0 authored by jiajia tang's avatar jiajia tang
Browse files

Fix potential issues if str has spaces



Uniform the split() function
str.split() will return a list split all spaces in str,
while str.split(' ') will return a list might contain ''
which might have potential issues.

Signed-off-by: default avatarjiajia tang <tangjiajia@xiaomi.com>
Change-Id: I0961659b140f800bdbe285f63bb4f02b8459ff8b
Signed-off-by: default avatarjiajia tang <tangjiajia@xiaomi.com>
parent 7c8dd8c3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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")
+4 −4
Original line number Diff line number Diff line
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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)