Loading tools/releasetools/ota_from_target_files.py +15 −9 Original line number Diff line number Diff line Loading @@ -250,7 +250,12 @@ UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*'] TARGET_DIFFING_UNZIP_PATTERN = ['BOOT', 'RECOVERY', 'SYSTEM/*', 'VENDOR/*', 'PRODUCT/*', 'SYSTEM_EXT/*', 'ODM/*'] RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS] SECONDARY_IMAGES_SKIP_PARTITIONS = ['odm', 'product', 'system_ext', 'vendor'] # Images to be excluded from secondary payload. We essentially only keep # 'system_other' and bootloader partitions. SECONDARY_PAYLOAD_SKIPPED_IMAGES = [ 'boot', 'dtbo', 'modem', 'odm', 'product', 'radio', 'recovery', 'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor'] class BuildInfo(object): Loading Loading @@ -1834,7 +1839,7 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): if key == 'dynamic_partition_list' or key.endswith(LIST_SUFFIX): partitions = value.split() partitions = [partition for partition in partitions if partition not in SECONDARY_IMAGES_SKIP_PARTITIONS] not in SECONDARY_PAYLOAD_SKIPPED_IMAGES] output_list.append('{}={}'.format(key, ' '.join(partitions))) else: output_list.append(line) Loading @@ -1856,10 +1861,13 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): elif info.filename in ('IMAGES/system.img', 'IMAGES/system.map'): pass # Images like vendor and product are not needed in the secondary payload. elif info.filename in ['IMAGES/{}.img'.format(partition) for partition in SECONDARY_IMAGES_SKIP_PARTITIONS]: pass # Copy images that are not in SECONDARY_PAYLOAD_SKIPPED_IMAGES. elif info.filename.startswith(('IMAGES/', 'RADIO/')): image_name = os.path.basename(info.filename) if image_name not in ['{}.img'.format(partition) for partition in SECONDARY_PAYLOAD_SKIPPED_IMAGES]: common.ZipWrite(target_zip, unzipped_file, arcname=info.filename) # Skip copying the postinstall config if requested. elif skip_postinstall and info.filename == POSTINSTALL_CONFIG: Loading @@ -1872,7 +1880,7 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): with open(unzipped_file) as f: partition_list = f.read().splitlines() partition_list = [partition for partition in partition_list if partition and partition not in SECONDARY_IMAGES_SKIP_PARTITIONS] and partition not in SECONDARY_PAYLOAD_SKIPPED_IMAGES] common.ZipWriteStr(target_zip, info.filename, '\n'.join(partition_list)) # Remove the unnecessary partitions from the dynamic partitions list. elif (info.filename == 'META/misc_info.txt' or Loading @@ -1881,8 +1889,6 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): common.ZipWriteStr(target_zip, info.filename, modified_info) else: common.ZipWrite(target_zip, unzipped_file, arcname=info.filename) elif info.filename.startswith(('IMAGES/', 'RADIO/')): common.ZipWrite(target_zip, unzipped_file, arcname=info.filename) common.ZipClose(target_zip) Loading tools/releasetools/test_ota_from_target_files.py +7 −7 Original line number Diff line number Diff line Loading @@ -599,16 +599,16 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): ab_partitions = verify_zip.read('META/ab_partitions.txt') self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn('RADIO/bootloader.img', namelist) self.assertIn('RADIO/modem.img', namelist) self.assertIn(POSTINSTALL_CONFIG, namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) self.assertNotIn('RADIO/modem.img', namelist) expected_ab_partitions = ['boot', 'system', 'bootloader', 'modem'] expected_ab_partitions = ['system', 'bootloader'] self.assertEqual('\n'.join(expected_ab_partitions), ab_partitions) @test_utils.SkipIfExternalToolsUnavailable() Loading @@ -621,13 +621,13 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): namelist = verify_zip.namelist() self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn('RADIO/bootloader.img', namelist) self.assertIn('RADIO/modem.img', namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) self.assertNotIn('RADIO/modem.img', namelist) self.assertNotIn(POSTINSTALL_CONFIG, namelist) @test_utils.SkipIfExternalToolsUnavailable() Loading @@ -641,10 +641,10 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): namelist = verify_zip.namelist() self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn(POSTINSTALL_CONFIG, namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) self.assertNotIn('RADIO/bootloader.img', namelist) Loading Loading @@ -681,12 +681,12 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): 'META/dynamic_partitions_info.txt') self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn(POSTINSTALL_CONFIG, namelist) self.assertIn('META/misc_info.txt', namelist) self.assertIn('META/dynamic_partitions_info.txt', namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) Loading Loading
tools/releasetools/ota_from_target_files.py +15 −9 Original line number Diff line number Diff line Loading @@ -250,7 +250,12 @@ UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*'] TARGET_DIFFING_UNZIP_PATTERN = ['BOOT', 'RECOVERY', 'SYSTEM/*', 'VENDOR/*', 'PRODUCT/*', 'SYSTEM_EXT/*', 'ODM/*'] RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS] SECONDARY_IMAGES_SKIP_PARTITIONS = ['odm', 'product', 'system_ext', 'vendor'] # Images to be excluded from secondary payload. We essentially only keep # 'system_other' and bootloader partitions. SECONDARY_PAYLOAD_SKIPPED_IMAGES = [ 'boot', 'dtbo', 'modem', 'odm', 'product', 'radio', 'recovery', 'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor'] class BuildInfo(object): Loading Loading @@ -1834,7 +1839,7 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): if key == 'dynamic_partition_list' or key.endswith(LIST_SUFFIX): partitions = value.split() partitions = [partition for partition in partitions if partition not in SECONDARY_IMAGES_SKIP_PARTITIONS] not in SECONDARY_PAYLOAD_SKIPPED_IMAGES] output_list.append('{}={}'.format(key, ' '.join(partitions))) else: output_list.append(line) Loading @@ -1856,10 +1861,13 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): elif info.filename in ('IMAGES/system.img', 'IMAGES/system.map'): pass # Images like vendor and product are not needed in the secondary payload. elif info.filename in ['IMAGES/{}.img'.format(partition) for partition in SECONDARY_IMAGES_SKIP_PARTITIONS]: pass # Copy images that are not in SECONDARY_PAYLOAD_SKIPPED_IMAGES. elif info.filename.startswith(('IMAGES/', 'RADIO/')): image_name = os.path.basename(info.filename) if image_name not in ['{}.img'.format(partition) for partition in SECONDARY_PAYLOAD_SKIPPED_IMAGES]: common.ZipWrite(target_zip, unzipped_file, arcname=info.filename) # Skip copying the postinstall config if requested. elif skip_postinstall and info.filename == POSTINSTALL_CONFIG: Loading @@ -1872,7 +1880,7 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): with open(unzipped_file) as f: partition_list = f.read().splitlines() partition_list = [partition for partition in partition_list if partition and partition not in SECONDARY_IMAGES_SKIP_PARTITIONS] and partition not in SECONDARY_PAYLOAD_SKIPPED_IMAGES] common.ZipWriteStr(target_zip, info.filename, '\n'.join(partition_list)) # Remove the unnecessary partitions from the dynamic partitions list. elif (info.filename == 'META/misc_info.txt' or Loading @@ -1881,8 +1889,6 @@ def GetTargetFilesZipForSecondaryImages(input_file, skip_postinstall=False): common.ZipWriteStr(target_zip, info.filename, modified_info) else: common.ZipWrite(target_zip, unzipped_file, arcname=info.filename) elif info.filename.startswith(('IMAGES/', 'RADIO/')): common.ZipWrite(target_zip, unzipped_file, arcname=info.filename) common.ZipClose(target_zip) Loading
tools/releasetools/test_ota_from_target_files.py +7 −7 Original line number Diff line number Diff line Loading @@ -599,16 +599,16 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): ab_partitions = verify_zip.read('META/ab_partitions.txt') self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn('RADIO/bootloader.img', namelist) self.assertIn('RADIO/modem.img', namelist) self.assertIn(POSTINSTALL_CONFIG, namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) self.assertNotIn('RADIO/modem.img', namelist) expected_ab_partitions = ['boot', 'system', 'bootloader', 'modem'] expected_ab_partitions = ['system', 'bootloader'] self.assertEqual('\n'.join(expected_ab_partitions), ab_partitions) @test_utils.SkipIfExternalToolsUnavailable() Loading @@ -621,13 +621,13 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): namelist = verify_zip.namelist() self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn('RADIO/bootloader.img', namelist) self.assertIn('RADIO/modem.img', namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) self.assertNotIn('RADIO/modem.img', namelist) self.assertNotIn(POSTINSTALL_CONFIG, namelist) @test_utils.SkipIfExternalToolsUnavailable() Loading @@ -641,10 +641,10 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): namelist = verify_zip.namelist() self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn(POSTINSTALL_CONFIG, namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) self.assertNotIn('RADIO/bootloader.img', namelist) Loading Loading @@ -681,12 +681,12 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): 'META/dynamic_partitions_info.txt') self.assertIn('META/ab_partitions.txt', namelist) self.assertIn('IMAGES/boot.img', namelist) self.assertIn('IMAGES/system.img', namelist) self.assertIn(POSTINSTALL_CONFIG, namelist) self.assertIn('META/misc_info.txt', namelist) self.assertIn('META/dynamic_partitions_info.txt', namelist) self.assertNotIn('IMAGES/boot.img', namelist) self.assertNotIn('IMAGES/system_other.img', namelist) self.assertNotIn('IMAGES/system.map', namelist) Loading