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

Commit 9c496542 authored by Spandan Das's avatar Spandan Das Committed by Automerger Merge Worker
Browse files

Merge "Parse fingerprint and timestamp unconditionally" into main am: 8382f29f

parents 1ed06305 8382f29f
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -677,24 +677,31 @@ def TryParseFingerprint(glob_dict: dict):
      glob_dict["fingerprint"] = fingerprint
      return


def ImagePropFromGlobalDict(glob_dict, mount_point):
  """Build an image property dictionary from the global dictionary.
def TryParseFingerprintAndTimestamp(glob_dict):
  """Helper function that parses fingerprint and timestamp from the global dictionary.

  Args:
    glob_dict: the global dictionary from the build system.
    mount_point: such as "system", "data" etc.
  """
  d = {}
  TryParseFingerprint(glob_dict)

  # Set fixed timestamp for building the OTA package.
  if "use_fixed_timestamp" in glob_dict:
    d["timestamp"] = FIXED_FILE_TIMESTAMP
    glob_dict["timestamp"] = FIXED_FILE_TIMESTAMP
  if "build.prop" in glob_dict:
    timestamp = glob_dict["build.prop"].GetProp("ro.build.date.utc")
    if timestamp:
      d["timestamp"] = timestamp
      glob_dict["timestamp"] = timestamp

def ImagePropFromGlobalDict(glob_dict, mount_point):
  """Build an image property dictionary from the global dictionary.

  Args:
    glob_dict: the global dictionary from the build system.
    mount_point: such as "system", "data" etc.
  """
  d = {}
  TryParseFingerprintAndTimestamp(glob_dict)

  def copy_prop(src_p, dest_p):
    """Copy a property from the global dictionary.
@@ -730,6 +737,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
      "avb_avbtool",
      "use_dynamic_partition_size",
      "fingerprint",
      "timestamp",
  )
  for p in common_props:
    copy_prop(p, p)
@@ -992,6 +1000,7 @@ def main(argv):
    # The caller knows the mount point and provides a dictionary needed by
    # BuildImage().
    image_properties = glob_dict
    TryParseFingerprintAndTimestamp(image_properties)
  else:
    image_filename = os.path.basename(args.out_file)
    mount_point = ""