Merge "Remove the support for BRILLO_VENDOR_PARTITIONS." am: c904a89c93

am: cd64a00c03

Change-Id: Ic56244f0e323c7a56214cc10a29a75ea89ae0cbf
This commit is contained in:
Tao Bao 2018-04-18 14:51:23 -07:00 committed by android-build-merger
commit bf46541b73
3 changed files with 6 additions and 57 deletions

View File

@ -2494,10 +2494,6 @@ $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
endif
ifeq ($(AB_OTA_UPDATER),true)
ifdef BRILLO_VENDOR_PARTITIONS
$(BUILT_TARGET_FILES_PACKAGE): $(foreach p,$(BRILLO_VENDOR_PARTITIONS),\
$(call word-colon,1,$(p))/$(call word-colon,2,$(p)))
endif
ifdef OSRELEASED_DIRECTORY
$(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
$(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
@ -2740,17 +2736,6 @@ ifeq ($(AB_OTA_UPDATER),true)
@# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
$(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
ifdef BRILLO_VENDOR_PARTITIONS
$(hide) mkdir -p $(zip_root)/VENDOR_IMAGES
$(hide) for f in $(BRILLO_VENDOR_PARTITIONS); do \
pair1="$$(echo $$f | awk -F':' '{print $$1}')"; \
pair2="$$(echo $$f | awk -F':' '{print $$2}')"; \
src=$${pair1}/$${pair2}; \
dest=$(zip_root)/VENDOR_IMAGES/$${pair2}; \
mkdir -p $$(dirname "$${dest}"); \
cp $${src} $${dest}; \
done;
endif
ifdef OSRELEASED_DIRECTORY
$(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
$(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt

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,