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

Commit 0663ae4f authored by Po Hu's avatar Po Hu
Browse files

Fix build break for vendor freeze

1. Fix build break when rebuilding vendor images in
sign_target_files_apks, because of missing SYSTEM/build.prop:
  File ".../add_img_to_target_files.py", line 999, in <module>
  File ".../add_img_to_target_files.py", line 993, in main
  File ".../add_img_to_target_files.py", line 854, in AddImagesToTargetFiles
  File ".../add_img_to_target_files.py", line 229, in AddVendor
  File ".../add_img_to_target_files.py", line 391, in CreateImage
  File "add_img_to_target_files/common.py", line 394, in __init__
    self._fingerprint = self.CalculateFingerprint()
  File "add_img_to_target_files/common.py", line 537, in CalculateFingerprint
    self.GetBuildProp("ro.build.version.release"),
  File "add_img_to_target_files/common.py", line 457, in GetBuildProp
    raise ExternalError("couldn't find %s in build.prop" % (prop,))
ExternalError: couldn't find ro.build.version.release in build.prop

2. Support more scenarios (non-AB, RADIO...)

Bug: 192422274
Change-Id: I792b0a2c2354ed9312730e322ce28df49b3c2f7f
parent b7aced88
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -1197,6 +1197,7 @@ def BuildVendorPartitions(output_zip_path):
  logger.info("Building vendor partitions using vendor otatools.")
  vendor_tempdir = common.UnzipTemp(output_zip_path, [
      "META/*",
      "SYSTEM/build.prop",
  ] + ["{}/*".format(p.upper()) for p in OPTIONS.vendor_partitions])

  # Disable various partitions that build based on misc_info fields.
@@ -1219,9 +1220,25 @@ def BuildVendorPartitions(output_zip_path):
    for key in sorted(vendor_misc_info):
      output.write("{}={}\n".format(key, vendor_misc_info[key]))

  # Disable system partition by a placeholder of IMAGES/system.img,
  # instead of removing SYSTEM folder.
  # Because SYSTEM/build.prop is still needed for:
  #   add_img_to_target_files.CreateImage ->
  #   common.BuildInfo ->
  #   common.BuildInfo.CalculateFingerprint
  vendor_images_path = os.path.join(vendor_tempdir, "IMAGES")
  if not os.path.exists(vendor_images_path):
    os.makedirs(vendor_images_path)
  with open(os.path.join(vendor_images_path, "system.img"), "w") as output:
    pass

  # Disable care_map.pb as not all ab_partitions are available when
  # vendor otatools regenerates vendor images.
  if os.path.exists(os.path.join(vendor_tempdir, "META/ab_partitions.txt")):
    os.remove(os.path.join(vendor_tempdir, "META/ab_partitions.txt"))
  # Disable RADIO images
  if os.path.exists(os.path.join(vendor_tempdir, "META/pack_radioimages.txt")):
    os.remove(os.path.join(vendor_tempdir, "META/pack_radioimages.txt"))

  # Build vendor images using vendor otatools.
  vendor_otatools_dir = common.MakeTempDir(prefix="vendor_otatools_")
@@ -1229,6 +1246,7 @@ def BuildVendorPartitions(output_zip_path):
  cmd = [
      os.path.join(vendor_otatools_dir, "bin", "add_img_to_target_files"),
      "--is_signing",
      "--add_missing",
      "--verbose",
      vendor_tempdir,
  ]