Merge changes from topic "productmanifest"
* changes: ota_from_target_files: include metadata when odm / product is changed. Add product manifest.
This commit is contained in:
commit
001ebfcb30
|
@ -2069,29 +2069,6 @@ endif
|
|||
|
||||
FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Final System VINTF manifest including fragments. This is not assembled
|
||||
# on the device because it depends on everything in a given device
|
||||
# image which defines a vintf_fragment.
|
||||
|
||||
ifdef BUILDING_SYSTEM_IMAGE
|
||||
|
||||
BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
|
||||
$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
|
||||
$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
|
||||
$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
|
||||
$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
|
||||
@echo "Verifying system VINTF manifest."
|
||||
PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
|
||||
$(HOST_OUT_EXECUTABLES)/assemble_vintf \
|
||||
-c $(BUILT_VENDOR_MATRIX) \
|
||||
-i $(BUILT_SYSTEM_MANIFEST) \
|
||||
$$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
|
||||
find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
|
||||
sed "s/^/-i /" | tr '\n' ' ') -o $@
|
||||
|
||||
endif # BUILDING_SYSTEM_IMAGE
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
ifdef BUILDING_SYSTEM_IMAGE
|
||||
|
||||
|
@ -2284,7 +2261,6 @@ define build-systemimage-target
|
|||
exit 1 )
|
||||
endef
|
||||
|
||||
$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
|
||||
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
|
||||
$(call build-systemimage-target,$@)
|
||||
|
||||
|
@ -2917,6 +2893,48 @@ INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
|
|||
$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
|
||||
endif
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Final Framework VINTF manifest including fragments. This is not assembled
|
||||
# on the device because it depends on everything in a given device
|
||||
# image which defines a vintf_fragment.
|
||||
|
||||
ifdef BUILDING_SYSTEM_IMAGE
|
||||
|
||||
ifndef BOARD_USES_PRODUCTIMAGE
|
||||
# If no product image at all, check system manifest directly against device matrix.
|
||||
check_framework_manifest := true
|
||||
else ifdef BUILDING_PRODUCT_IMAGE
|
||||
# If device has a product image, only check if the product image is built.
|
||||
check_framework_manifest := true
|
||||
endif
|
||||
|
||||
ifeq ($(check_framework_manifest),true)
|
||||
|
||||
BUILT_ASSEMBLED_FRAMEWORK_MANIFEST := $(PRODUCT_OUT)/verified_assembled_framework_manifest.xml
|
||||
$(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf \
|
||||
$(BUILT_VENDOR_MATRIX) \
|
||||
$(BUILT_SYSTEM_MANIFEST) \
|
||||
$(FULL_SYSTEMIMAGE_DEPS) \
|
||||
$(BUILT_PRODUCT_MANIFEST) \
|
||||
$(BUILT_PRODUCTIMAGE_TARGET)
|
||||
@echo "Verifying framework VINTF manifest."
|
||||
PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
|
||||
$(HOST_OUT_EXECUTABLES)/assemble_vintf \
|
||||
-o $@ \
|
||||
-c $(BUILT_VENDOR_MATRIX) \
|
||||
-i $(BUILT_SYSTEM_MANIFEST) \
|
||||
$(addprefix -i ,\
|
||||
$(filter $(TARGET_OUT)/etc/vintf/manifest/%.xml,$(FULL_SYSTEMIMAGE_DEPS)) \
|
||||
$(BUILT_PRODUCT_MANIFEST) \
|
||||
$(filter $(TARGET_OUT_PRODUCT)/etc/vintf/manifest/%.xml,$(INTERNAL_PRODUCTIMAGE_FILES)))
|
||||
|
||||
droidcore: $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST)
|
||||
|
||||
endif # check_framework_manifest
|
||||
check_framework_manifest :=
|
||||
|
||||
endif # BUILDING_SYSTEM_IMAGE
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# product_services partition image
|
||||
ifdef BUILDING_PRODUCT_SERVICES_IMAGE
|
||||
|
@ -3809,7 +3827,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \
|
|||
$(HOST_OUT_EXECUTABLES)/bsdiff \
|
||||
$(HOST_OUT_EXECUTABLES)/care_map_generator \
|
||||
$(BUILD_IMAGE_SRCS) \
|
||||
$(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
|
||||
$(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) \
|
||||
$(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
|
||||
$(BUILT_SYSTEM_MATRIX) \
|
||||
$(BUILT_VENDOR_MATRIX) \
|
||||
|
@ -4156,8 +4174,8 @@ ifdef BUILDING_SYSTEM_OTHER_IMAGE
|
|||
endif
|
||||
@# Metadata for compatibility verification.
|
||||
$(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
|
||||
ifdef BUILT_ASSEMBLED_SYSTEM_MANIFEST
|
||||
$(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
|
||||
ifdef BUILT_ASSEMBLED_FRAMEWORK_MANIFEST
|
||||
$(hide) cp $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) $(zip_root)/META/system_manifest.xml
|
||||
endif
|
||||
ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
|
||||
$(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
|
||||
|
|
|
@ -19,3 +19,4 @@ PRODUCT_PACKAGES += \
|
|||
healthd \
|
||||
ModuleMetadata \
|
||||
product_compatibility_matrix.xml \
|
||||
product_manifest.xml \
|
||||
|
|
|
@ -268,7 +268,7 @@ PRODUCT_PACKAGES += \
|
|||
|
||||
# VINTF data for system image
|
||||
PRODUCT_PACKAGES += \
|
||||
framework_manifest.xml \
|
||||
system_manifest.xml \
|
||||
system_compatibility_matrix.xml \
|
||||
|
||||
# Host tools to install
|
||||
|
|
|
@ -318,13 +318,24 @@ class BuildInfo(object):
|
|||
|
||||
@property
|
||||
def vendor_fingerprint(self):
|
||||
if "vendor.build.prop" not in self.info_dict:
|
||||
return self._fingerprint_of("vendor")
|
||||
|
||||
@property
|
||||
def product_fingerprint(self):
|
||||
return self._fingerprint_of("product")
|
||||
|
||||
@property
|
||||
def odm_fingerprint(self):
|
||||
return self._fingerprint_of("odm")
|
||||
|
||||
def _fingerprint_of(self, partition):
|
||||
if partition + ".build.prop" not in self.info_dict:
|
||||
return None
|
||||
vendor_build_prop = self.info_dict["vendor.build.prop"]
|
||||
if "ro.vendor.build.fingerprint" in vendor_build_prop:
|
||||
return vendor_build_prop["ro.vendor.build.fingerprint"]
|
||||
if "ro.vendor.build.thumbprint" in vendor_build_prop:
|
||||
return vendor_build_prop["ro.vendor.build.thumbprint"]
|
||||
build_prop = self.info_dict[partition + ".build.prop"]
|
||||
if "ro." + partition + ".build.fingerprint" in build_prop:
|
||||
return build_prop["ro." + partition + ".build.fingerprint"]
|
||||
if "ro." + partition + ".build.thumbprint" in build_prop:
|
||||
return build_prop["ro." + partition + ".build.thumbprint"]
|
||||
return None
|
||||
|
||||
@property
|
||||
|
@ -692,14 +703,26 @@ def HasRecoveryPatch(target_files_zip):
|
|||
"SYSTEM/etc/recovery.img" in namelist)
|
||||
|
||||
|
||||
def HasVendorPartition(target_files_zip):
|
||||
def HasPartition(target_files_zip, partition):
|
||||
try:
|
||||
target_files_zip.getinfo("VENDOR/")
|
||||
target_files_zip.getinfo(partition.upper() + "/")
|
||||
return True
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
|
||||
def HasVendorPartition(target_files_zip):
|
||||
return HasPartition(target_files_zip, "vendor")
|
||||
|
||||
|
||||
def HasProductPartition(target_files_zip):
|
||||
return HasPartition(target_files_zip, "product")
|
||||
|
||||
|
||||
def HasOdmPartition(target_files_zip):
|
||||
return HasPartition(target_files_zip, "odm")
|
||||
|
||||
|
||||
def HasTrebleEnabled(target_files_zip, target_info):
|
||||
return (HasVendorPartition(target_files_zip) and
|
||||
target_info.GetBuildProp("ro.treble.enabled") == "true")
|
||||
|
@ -745,23 +768,24 @@ def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip, target_info,
|
|||
generating an incremental OTA; None otherwise.
|
||||
"""
|
||||
|
||||
def AddCompatibilityArchive(system_updated, vendor_updated):
|
||||
"""Adds compatibility info based on system/vendor update status.
|
||||
def AddCompatibilityArchive(framework_updated, device_updated):
|
||||
"""Adds compatibility info based on update status of both sides of Treble
|
||||
boundary.
|
||||
|
||||
Args:
|
||||
system_updated: If True, the system image will be updated and therefore
|
||||
its metadata should be included.
|
||||
vendor_updated: If True, the vendor image will be updated and therefore
|
||||
its metadata should be included.
|
||||
framework_updated: If True, the system / product image will be updated
|
||||
and therefore their metadata should be included.
|
||||
device_updated: If True, the vendor / odm image will be updated and
|
||||
therefore their metadata should be included.
|
||||
"""
|
||||
# Determine what metadata we need. Files are names relative to META/.
|
||||
compatibility_files = []
|
||||
vendor_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
|
||||
system_metadata = ("system_manifest.xml", "system_matrix.xml")
|
||||
if vendor_updated:
|
||||
compatibility_files += vendor_metadata
|
||||
if system_updated:
|
||||
compatibility_files += system_metadata
|
||||
device_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
|
||||
framework_metadata = ("system_manifest.xml", "system_matrix.xml")
|
||||
if device_updated:
|
||||
compatibility_files += device_metadata
|
||||
if framework_updated:
|
||||
compatibility_files += framework_metadata
|
||||
|
||||
# Create new archive.
|
||||
compatibility_archive = tempfile.NamedTemporaryFile()
|
||||
|
@ -785,6 +809,11 @@ def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip, target_info,
|
|||
arcname="compatibility.zip",
|
||||
compress_type=zipfile.ZIP_STORED)
|
||||
|
||||
def FingerprintChanged(source_fp, target_fp):
|
||||
if source_fp is None or target_fp is None:
|
||||
return True
|
||||
return source_fp != target_fp
|
||||
|
||||
# Will only proceed if the target has enabled the Treble support (as well as
|
||||
# having a /vendor partition).
|
||||
if not HasTrebleEnabled(target_zip, target_info):
|
||||
|
@ -795,7 +824,7 @@ def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip, target_info,
|
|||
if OPTIONS.skip_compatibility_check:
|
||||
return
|
||||
|
||||
# Full OTA carries the info for system/vendor both.
|
||||
# Full OTA carries the info for system/vendor/product/odm
|
||||
if source_info is None:
|
||||
AddCompatibilityArchive(True, True)
|
||||
return
|
||||
|
@ -804,16 +833,19 @@ def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip, target_info,
|
|||
target_fp = target_info.fingerprint
|
||||
system_updated = source_fp != target_fp
|
||||
|
||||
source_fp_vendor = source_info.vendor_fingerprint
|
||||
target_fp_vendor = target_info.vendor_fingerprint
|
||||
# vendor build fingerprints could be possibly blacklisted at build time. For
|
||||
# such a case, we consider the vendor images being changed.
|
||||
if source_fp_vendor is None or target_fp_vendor is None:
|
||||
vendor_updated = True
|
||||
else:
|
||||
vendor_updated = source_fp_vendor != target_fp_vendor
|
||||
# other build fingerprints could be possibly blacklisted at build time. For
|
||||
# such a case, we consider those images being changed.
|
||||
vendor_updated = FingerprintChanged(source_info.vendor_fingerprint,
|
||||
target_info.vendor_fingerprint)
|
||||
product_updated = HasProductPartition(target_zip) and \
|
||||
FingerprintChanged(source_info.product_fingerprint,
|
||||
target_info.product_fingerprint)
|
||||
odm_updated = HasOdmPartition(target_zip) and \
|
||||
FingerprintChanged(source_info.odm_fingerprint,
|
||||
target_info.odm_fingerprint)
|
||||
|
||||
AddCompatibilityArchive(system_updated, vendor_updated)
|
||||
AddCompatibilityArchive(system_updated or product_updated,
|
||||
vendor_updated or odm_updated)
|
||||
|
||||
|
||||
def WriteFullOTAPackage(input_zip, output_file):
|
||||
|
|
Loading…
Reference in New Issue