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

Commit 9e8bfde3 authored by Lalit Kansara's avatar Lalit Kansara Committed by Linux Build Service Account
Browse files

Debug messages added to know build failure reasons

Debug messages added to know build failure reasons while building
image.

Change-Id: Iacf02b4228c761739859544eb3be025331d38597
parent 191cccb4
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -316,6 +316,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
  Returns:
    True iff the image is built successfully.
  """
  print("BuildImage: in_dir = %s, out_file = %s" % (in_dir, out_file))
  # system_root_image=true: build a system.img that combines the contents of
  # /system and the ramdisk, and can be mounted at the root of the file system.
  origin_in = in_dir
@@ -358,6 +359,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
    adjusted_size = AdjustPartitionSizeForVerity(partition_size,
                                                 verity_fec_supported)
    if not adjusted_size:
      print "Error: adjusting partition size for verity failed, partition_size = %d" % partition_size
      return False
    prop_dict["partition_size"] = str(adjusted_size)
    prop_dict["original_partition_size"] = str(partition_size)
@@ -383,6 +385,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
    if "base_fs_file" in prop_dict:
      base_fs_file = ConvertBlockMapToBaseFs(prop_dict["base_fs_file"])
      if base_fs_file is None:
        print "Error: no base fs file found"
        return False
      build_command.extend(["-d", base_fs_file])
    build_command.extend(["-L", prop_dict["mount_point"]])
@@ -436,9 +439,12 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):

  try:
    if reserved_blocks and fs_type.startswith("ext4"):
      print "fs type is ext4"
      (ext4fs_output, exit_code) = RunCommand(build_command)
    else:
      print "fs type is not ext4"
      (_, exit_code) = RunCommand(build_command)
    print("Running %s command, exit code = %d" % (build_command, exit_code))
  finally:
    if in_dir != origin_in:
      # Clean up temporary directories and files.
@@ -448,6 +454,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
    if base_fs_file is not None:
      os.remove(base_fs_file)
  if exit_code != 0:
    print "Error: %s command unsuccessful" % build_command
    return False

  # Bug: 21522719, 22023465
@@ -488,17 +495,19 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
  # create the verified image if this is to be verified
  if verity_supported and is_verity_partition:
    if not MakeVerityEnabledImage(out_file, verity_fec_supported, prop_dict):
      print "Error: making verity enabled image failed"
      return False

  if run_fsck and prop_dict.get("skip_fsck") != "true":
    success, unsparse_image = UnsparseImage(out_file, replace=False)
    if not success:
      print "Error: unparsing of image failed"
      return False

    # Run e2fsck on the inflated image file
    e2fsck_command = ["e2fsck", "-f", "-n", unsparse_image]
    (_, exit_code) = RunCommand(e2fsck_command)

    print("Running %s command, exit code = %d" % (e2fsck_command, exit_code))
    os.remove(unsparse_image)

  return exit_code == 0