Loading tools/releasetools/add_img_to_target_files.py +3 −8 Original line number Original line Diff line number Diff line Loading @@ -337,13 +337,8 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None): # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and # build fingerprint). # build fingerprint). uuid_seed = what + "-" build_info = common.BuildInfo(info_dict) if "build.prop" in info_dict: uuid_seed = what + "-" + build_info.fingerprint build_prop = info_dict["build.prop"] if "ro.build.fingerprint" in build_prop: uuid_seed += build_prop["ro.build.fingerprint"] elif "ro.build.thumbprint" in build_prop: uuid_seed += build_prop["ro.build.thumbprint"] image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed)) image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed)) hash_seed = "hash_seed-" + uuid_seed hash_seed = "hash_seed-" + uuid_seed image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed)) image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed)) Loading Loading @@ -728,7 +723,7 @@ def AddImagesToTargetFiles(filename): # A map between partition names and their paths, which could be used when # A map between partition names and their paths, which could be used when # generating AVB vbmeta image. # generating AVB vbmeta image. partitions = dict() partitions = {} def banner(s): def banner(s): logger.info("\n\n++++ %s ++++\n\n", s) logger.info("\n\n++++ %s ++++\n\n", s) Loading tools/releasetools/common.py +6 −14 Original line number Original line Diff line number Diff line Loading @@ -319,7 +319,7 @@ class BuildInfo(object): _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor", _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor", "system_ext", "system"] "system_ext", "system"] def __init__(self, info_dict, oem_dicts): def __init__(self, info_dict, oem_dicts=None): """Initializes a BuildInfo instance with the given dicts. """Initializes a BuildInfo instance with the given dicts. Note that it only wraps up the given dicts, without making copies. Note that it only wraps up the given dicts, without making copies. Loading Loading @@ -628,18 +628,11 @@ def LoadInfoDict(input_file, repacking=False): read_helper, "{}/etc/build.prop".format(partition.upper())) read_helper, "{}/etc/build.prop".format(partition.upper())) d["build.prop"] = d["system.build.prop"] d["build.prop"] = d["system.build.prop"] # Set up the salt (based on fingerprint or thumbprint) that will be used when # Set up the salt (based on fingerprint) that will be used when adding AVB # adding AVB footer. # hash / hashtree footers. if d.get("avb_enable") == "true": if d.get("avb_enable") == "true": fp = None build_info = BuildInfo(d) if "build.prop" in d: d["avb_salt"] = sha256(build_info.fingerprint).hexdigest() build_prop = d["build.prop"] if "ro.build.fingerprint" in build_prop: fp = build_prop["ro.build.fingerprint"] elif "ro.build.thumbprint" in build_prop: fp = build_prop["ro.build.thumbprint"] if fp: d["avb_salt"] = sha256(fp).hexdigest() return d return d Loading Loading @@ -883,7 +876,6 @@ def GetAvbPartitionArg(partition, image, info_dict=None): if key_path: if key_path: chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict) chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict) return ["--chain_partition", chained_partition_arg] return ["--chain_partition", chained_partition_arg] else: return ["--include_descriptors_from_image", image] return ["--include_descriptors_from_image", image] Loading Loading
tools/releasetools/add_img_to_target_files.py +3 −8 Original line number Original line Diff line number Diff line Loading @@ -337,13 +337,8 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None): # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and # build fingerprint). # build fingerprint). uuid_seed = what + "-" build_info = common.BuildInfo(info_dict) if "build.prop" in info_dict: uuid_seed = what + "-" + build_info.fingerprint build_prop = info_dict["build.prop"] if "ro.build.fingerprint" in build_prop: uuid_seed += build_prop["ro.build.fingerprint"] elif "ro.build.thumbprint" in build_prop: uuid_seed += build_prop["ro.build.thumbprint"] image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed)) image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed)) hash_seed = "hash_seed-" + uuid_seed hash_seed = "hash_seed-" + uuid_seed image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed)) image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed)) Loading Loading @@ -728,7 +723,7 @@ def AddImagesToTargetFiles(filename): # A map between partition names and their paths, which could be used when # A map between partition names and their paths, which could be used when # generating AVB vbmeta image. # generating AVB vbmeta image. partitions = dict() partitions = {} def banner(s): def banner(s): logger.info("\n\n++++ %s ++++\n\n", s) logger.info("\n\n++++ %s ++++\n\n", s) Loading
tools/releasetools/common.py +6 −14 Original line number Original line Diff line number Diff line Loading @@ -319,7 +319,7 @@ class BuildInfo(object): _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor", _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor", "system_ext", "system"] "system_ext", "system"] def __init__(self, info_dict, oem_dicts): def __init__(self, info_dict, oem_dicts=None): """Initializes a BuildInfo instance with the given dicts. """Initializes a BuildInfo instance with the given dicts. Note that it only wraps up the given dicts, without making copies. Note that it only wraps up the given dicts, without making copies. Loading Loading @@ -628,18 +628,11 @@ def LoadInfoDict(input_file, repacking=False): read_helper, "{}/etc/build.prop".format(partition.upper())) read_helper, "{}/etc/build.prop".format(partition.upper())) d["build.prop"] = d["system.build.prop"] d["build.prop"] = d["system.build.prop"] # Set up the salt (based on fingerprint or thumbprint) that will be used when # Set up the salt (based on fingerprint) that will be used when adding AVB # adding AVB footer. # hash / hashtree footers. if d.get("avb_enable") == "true": if d.get("avb_enable") == "true": fp = None build_info = BuildInfo(d) if "build.prop" in d: d["avb_salt"] = sha256(build_info.fingerprint).hexdigest() build_prop = d["build.prop"] if "ro.build.fingerprint" in build_prop: fp = build_prop["ro.build.fingerprint"] elif "ro.build.thumbprint" in build_prop: fp = build_prop["ro.build.thumbprint"] if fp: d["avb_salt"] = sha256(fp).hexdigest() return d return d Loading Loading @@ -883,7 +876,6 @@ def GetAvbPartitionArg(partition, image, info_dict=None): if key_path: if key_path: chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict) chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict) return ["--chain_partition", chained_partition_arg] return ["--chain_partition", chained_partition_arg] else: return ["--include_descriptors_from_image", image] return ["--include_descriptors_from_image", image] Loading