Loading tools/releasetools/common.py +18 −2 Original line number Diff line number Diff line Loading @@ -1410,7 +1410,22 @@ def SharedUidPartitionViolations(uid_dict, partition_groups): return errors def RunHostInitVerifier(product_out, partition_map): def RunVendoredHostInitVerifier(product_out, partition_map): """Runs vendor host_init_verifier on the init rc files within selected partitions. host_init_verifier searches the etc/init path within each selected partition. Args: product_out: PRODUCT_OUT directory, containing partition directories. partition_map: A map of partition name -> relative path within product_out. """ return RunHostInitVerifier( product_out, partition_map, tool=os.path.join(OPTIONS.vendor_otatools, 'bin', 'host_init_verifier')) def RunHostInitVerifier(product_out, partition_map, tool="host_init_verifier"): """Runs host_init_verifier on the init rc files within partitions. host_init_verifier searches the etc/init path within each partition. Loading @@ -1418,9 +1433,10 @@ def RunHostInitVerifier(product_out, partition_map): Args: product_out: PRODUCT_OUT directory, containing partition directories. partition_map: A map of partition name -> relative path within product_out. tool: Full path to host_init_verifier or binary name """ allowed_partitions = ("system", "system_ext", "product", "vendor", "odm") cmd = ["host_init_verifier"] cmd = [tool] for partition, path in partition_map.items(): if partition not in allowed_partitions: raise ExternalError("Unable to call host_init_verifier for partition %s" % Loading tools/releasetools/merge/merge_compatibility_checks.py +12 −1 Original line number Diff line number Diff line Loading @@ -95,8 +95,19 @@ def CheckShareduidViolation(target_files_dir, partition_map): def CheckInitRcFiles(target_files_dir, partition_map): """Check for any init.rc issues using host_init_verifier.""" try: vendor_partitions = set() if OPTIONS.vendor_otatools: vendor_partitions = {"vendor", "odm"} common.RunVendoredHostInitVerifier( product_out=target_files_dir, partition_map={p: partition_map[p] for p in vendor_partitions}) common.RunHostInitVerifier( product_out=target_files_dir, partition_map=partition_map) product_out=target_files_dir, partition_map={ p: partition_map[p] for p in partition_map.keys() - vendor_partitions }) except RuntimeError as err: return [str(err)] return [] Loading tools/releasetools/merge/merge_target_files.py +10 −7 Original line number Diff line number Diff line Loading @@ -87,8 +87,8 @@ Usage: merge_target_files [args] If provided, rebuilds odm.img or vendor.img to include merged sepolicy files. If odm is present then odm is preferred. --vendor-otatools otatools.zip If provided, use this otatools.zip when recompiling the odm or vendor --vendor-otatools otatools.zip or directory If provided, use these otatools when recompiling the odm or vendor image to include sepolicy. --keep-tmp Loading Loading @@ -312,12 +312,9 @@ def rebuild_image_with_sepolicy(target_files_dir): '%s recompilation will be performed using the vendor otatools.zip', partition_img) # Unzip the vendor build's otatools.zip and target-files archive. vendor_otatools_dir = common.MakeTempDir( prefix='merge_target_files_vendor_otatools_') # Unzip the vendor build's target-files archive. vendor_target_files_dir = common.MakeTempDir( prefix='merge_target_files_vendor_target_files_') common.UnzipToDir(OPTIONS.vendor_otatools, vendor_otatools_dir) merge_utils.CollectTargetFiles( input_zipfile_or_dir=OPTIONS.vendor_target_files, output_dir=vendor_target_files_dir, Loading @@ -335,7 +332,7 @@ def rebuild_image_with_sepolicy(target_files_dir): remove_file_if_exists( os.path.join(vendor_target_files_dir, 'IMAGES', partition_img)) rebuild_partition_command = [ os.path.join(vendor_otatools_dir, 'bin', 'add_img_to_target_files'), os.path.join(OPTIONS.vendor_otatools, 'bin', 'add_img_to_target_files'), '--verbose', '--add_missing', ] Loading Loading @@ -669,6 +666,12 @@ def main(): if OPTIONS.output_item_list: OPTIONS.output_item_list = common.LoadListFromFile(OPTIONS.output_item_list) if OPTIONS.vendor_otatools and zipfile.is_zipfile(OPTIONS.vendor_otatools): vendor_otatools_dir = common.MakeTempDir( prefix='merge_target_files_vendor_otatools_') common.UnzipToDir(OPTIONS.vendor_otatools, vendor_otatools_dir) OPTIONS.vendor_otatools = vendor_otatools_dir if not merge_utils.ValidateConfigLists(): sys.exit(1) Loading Loading
tools/releasetools/common.py +18 −2 Original line number Diff line number Diff line Loading @@ -1410,7 +1410,22 @@ def SharedUidPartitionViolations(uid_dict, partition_groups): return errors def RunHostInitVerifier(product_out, partition_map): def RunVendoredHostInitVerifier(product_out, partition_map): """Runs vendor host_init_verifier on the init rc files within selected partitions. host_init_verifier searches the etc/init path within each selected partition. Args: product_out: PRODUCT_OUT directory, containing partition directories. partition_map: A map of partition name -> relative path within product_out. """ return RunHostInitVerifier( product_out, partition_map, tool=os.path.join(OPTIONS.vendor_otatools, 'bin', 'host_init_verifier')) def RunHostInitVerifier(product_out, partition_map, tool="host_init_verifier"): """Runs host_init_verifier on the init rc files within partitions. host_init_verifier searches the etc/init path within each partition. Loading @@ -1418,9 +1433,10 @@ def RunHostInitVerifier(product_out, partition_map): Args: product_out: PRODUCT_OUT directory, containing partition directories. partition_map: A map of partition name -> relative path within product_out. tool: Full path to host_init_verifier or binary name """ allowed_partitions = ("system", "system_ext", "product", "vendor", "odm") cmd = ["host_init_verifier"] cmd = [tool] for partition, path in partition_map.items(): if partition not in allowed_partitions: raise ExternalError("Unable to call host_init_verifier for partition %s" % Loading
tools/releasetools/merge/merge_compatibility_checks.py +12 −1 Original line number Diff line number Diff line Loading @@ -95,8 +95,19 @@ def CheckShareduidViolation(target_files_dir, partition_map): def CheckInitRcFiles(target_files_dir, partition_map): """Check for any init.rc issues using host_init_verifier.""" try: vendor_partitions = set() if OPTIONS.vendor_otatools: vendor_partitions = {"vendor", "odm"} common.RunVendoredHostInitVerifier( product_out=target_files_dir, partition_map={p: partition_map[p] for p in vendor_partitions}) common.RunHostInitVerifier( product_out=target_files_dir, partition_map=partition_map) product_out=target_files_dir, partition_map={ p: partition_map[p] for p in partition_map.keys() - vendor_partitions }) except RuntimeError as err: return [str(err)] return [] Loading
tools/releasetools/merge/merge_target_files.py +10 −7 Original line number Diff line number Diff line Loading @@ -87,8 +87,8 @@ Usage: merge_target_files [args] If provided, rebuilds odm.img or vendor.img to include merged sepolicy files. If odm is present then odm is preferred. --vendor-otatools otatools.zip If provided, use this otatools.zip when recompiling the odm or vendor --vendor-otatools otatools.zip or directory If provided, use these otatools when recompiling the odm or vendor image to include sepolicy. --keep-tmp Loading Loading @@ -312,12 +312,9 @@ def rebuild_image_with_sepolicy(target_files_dir): '%s recompilation will be performed using the vendor otatools.zip', partition_img) # Unzip the vendor build's otatools.zip and target-files archive. vendor_otatools_dir = common.MakeTempDir( prefix='merge_target_files_vendor_otatools_') # Unzip the vendor build's target-files archive. vendor_target_files_dir = common.MakeTempDir( prefix='merge_target_files_vendor_target_files_') common.UnzipToDir(OPTIONS.vendor_otatools, vendor_otatools_dir) merge_utils.CollectTargetFiles( input_zipfile_or_dir=OPTIONS.vendor_target_files, output_dir=vendor_target_files_dir, Loading @@ -335,7 +332,7 @@ def rebuild_image_with_sepolicy(target_files_dir): remove_file_if_exists( os.path.join(vendor_target_files_dir, 'IMAGES', partition_img)) rebuild_partition_command = [ os.path.join(vendor_otatools_dir, 'bin', 'add_img_to_target_files'), os.path.join(OPTIONS.vendor_otatools, 'bin', 'add_img_to_target_files'), '--verbose', '--add_missing', ] Loading Loading @@ -669,6 +666,12 @@ def main(): if OPTIONS.output_item_list: OPTIONS.output_item_list = common.LoadListFromFile(OPTIONS.output_item_list) if OPTIONS.vendor_otatools and zipfile.is_zipfile(OPTIONS.vendor_otatools): vendor_otatools_dir = common.MakeTempDir( prefix='merge_target_files_vendor_otatools_') common.UnzipToDir(OPTIONS.vendor_otatools, vendor_otatools_dir) OPTIONS.vendor_otatools = vendor_otatools_dir if not merge_utils.ValidateConfigLists(): sys.exit(1) Loading