Remove the support for BRILLO_VENDOR_PARTITIONS.

It was initially introduced in commit
2e735ca34e, where it packs additional
vendor images into target_files zip in order to generate OTAs. We can
acheive the same goal with INSTALLED_RADIOIMAGE_TARGET, which is the way
being actively used across all targets, including IoT (the former
Brillo) targets.

Bug: 78201540
Test: `m dist` with aosp_marlin-userdebug
Test: Code search shows no active user of BRILLO_VENDOR_PARTITIONS.
Test: `python -m unittest test_add_img_to_target_files`
Change-Id: I8803d5377b5a39304a701cceafb243f9a228347d
This commit is contained in:
Tao Bao
2018-04-17 18:26:41 -07:00
parent 1cd44482db
commit 36d7c5666d
3 changed files with 6 additions and 57 deletions

View File

@@ -405,7 +405,7 @@ def AddVBMeta(output_zip, partitions):
if os.path.exists(image_path):
continue
found = False
for dir_name in ['IMAGES', 'RADIO', 'VENDOR_IMAGES', 'PREBUILT_IMAGES']:
for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']:
alt_path = os.path.join(
OPTIONS.input_tmp, dir_name, os.path.basename(image_path))
if os.path.exists(alt_path):
@@ -488,9 +488,8 @@ def AddCache(output_zip):
def AddRadioImagesForAbOta(output_zip, ab_partitions):
"""Adds the radio images needed for A/B OTA to the output file.
It parses the list of A/B partitions, looks for the missing ones from RADIO/
or VENDOR_IMAGES/ dirs, and copies them to IMAGES/ of the output file (or
dir).
It parses the list of A/B partitions, looks for the missing ones from RADIO/,
and copies them to IMAGES/ of the output file (or dir).
It also ensures that on returning from the function all the listed A/B
partitions must have their images available under IMAGES/.
@@ -518,17 +517,6 @@ def AddRadioImagesForAbOta(output_zip, ab_partitions):
shutil.copy(img_radio_path, prebuilt_path)
continue
# Walk through VENDOR_IMAGES/ since files could be under subdirs.
img_vendor_dir = os.path.join(OPTIONS.input_tmp, "VENDOR_IMAGES")
for root, _, files in os.walk(img_vendor_dir):
if img_name in files:
if output_zip:
common.ZipWrite(output_zip, os.path.join(root, img_name),
"IMAGES/" + img_name)
else:
shutil.copy(os.path.join(root, img_name), prebuilt_path)
break
# Assert that the image is present under IMAGES/ now.
if output_zip:
# Zip spec says: All slashes MUST be forward slashes.
@@ -763,9 +751,9 @@ def AddImagesToTargetFiles(filename):
with open(ab_partitions_txt, 'r') as f:
ab_partitions = f.readlines()
# For devices using A/B update, copy over images from RADIO/ and/or
# VENDOR_IMAGES/ to IMAGES/ and make sure we have all the needed
# images ready under IMAGES/. All images should have '.img' as extension.
# For devices using A/B update, copy over images from RADIO/ to IMAGES/ and
# make sure we have all the needed images ready under IMAGES/. All images
# should have '.img' as extension.
AddRadioImagesForAbOta(output_zip, ab_partitions)
# Generate care_map.txt for system and vendor partitions (if present), then

View File

@@ -85,30 +85,6 @@ class AddImagesToTargetFilesTest(unittest.TestCase):
for image in images:
self.assertIn('IMAGES/' + image + '.img', verify_zip.namelist())
def test_AddRadioImagesForAbOta_copyFromVendorImages(self):
"""Tests the case that copies images from VENDOR_IMAGES/."""
vendor_images_path = os.path.join(OPTIONS.input_tmp, 'VENDOR_IMAGES')
os.mkdir(vendor_images_path)
partitions = ['aboot', 'xbl']
for index, partition in enumerate(partitions):
subdir = os.path.join(vendor_images_path, 'subdir-{}'.format(index))
os.mkdir(subdir)
partition_image_path = os.path.join(subdir, partition + '.img')
with open(partition_image_path, 'wb') as partition_fp:
partition_fp.write(partition.encode())
# Set up the output dir.
images_path = os.path.join(OPTIONS.input_tmp, 'IMAGES')
os.mkdir(images_path)
AddRadioImagesForAbOta(None, partitions)
for partition in partitions:
self.assertTrue(
os.path.exists(os.path.join(images_path, partition + '.img')))
def test_AddRadioImagesForAbOta_missingImages(self):
images, _ = self._create_images(['aboot', 'xbl'], 'RADIO')
self.assertRaises(AssertionError, AddRadioImagesForAbOta, None,