Merge "Fix non-AB ota generation for directories" am: ea70695d92

Original change: https://android-review.googlesource.com/c/platform/build/+/2585207

Change-Id: I7a6472946360238393a734640e27557f7623446f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Kelvin Zhang 2023-05-10 04:46:20 +00:00 committed by Automerger Merge Worker
commit 06417aaa9e
2 changed files with 18 additions and 5 deletions

View file

@ -23,6 +23,7 @@ import verity_utils
from check_target_files_vintf import CheckVintfIfTrebleEnabled, HasPartition
from common import OPTIONS
from ota_utils import UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata, PropertyFiles
import subprocess
logger = logging.getLogger(__name__)
@ -277,7 +278,8 @@ endif;
needed_property_files = (
NonAbOtaPropertyFiles(),
)
FinalizeMetadata(metadata, staging_file, output_file, needed_property_files, package_key=OPTIONS.package_key)
FinalizeMetadata(metadata, staging_file, output_file,
needed_property_files, package_key=OPTIONS.package_key)
def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
@ -532,7 +534,8 @@ endif;
needed_property_files = (
NonAbOtaPropertyFiles(),
)
FinalizeMetadata(metadata, staging_file, output_file, needed_property_files, package_key=OPTIONS.package_key)
FinalizeMetadata(metadata, staging_file, output_file,
needed_property_files, package_key=OPTIONS.package_key)
def GenerateNonAbOtaPackage(target_file, output_file, source_file=None):
@ -555,8 +558,18 @@ def GenerateNonAbOtaPackage(target_file, output_file, source_file=None):
if OPTIONS.extracted_input is not None:
OPTIONS.input_tmp = OPTIONS.extracted_input
else:
logger.info("unzipping target target-files...")
OPTIONS.input_tmp = common.UnzipTemp(target_file, UNZIP_PATTERN)
if not os.path.isdir(target_file):
logger.info("unzipping target target-files...")
OPTIONS.input_tmp = common.UnzipTemp(target_file, UNZIP_PATTERN)
else:
OPTIONS.input_tmp = target_file
tmpfile = common.MakeTempFile(suffix=".zip")
os.unlink(tmpfile)
common.RunAndCheckOutput(
["zip", tmpfile, "-r", ".", "-0"], cwd=target_file)
assert zipfile.is_zipfile(tmpfile)
target_file = tmpfile
OPTIONS.target_tmp = OPTIONS.input_tmp
# If the caller explicitly specified the device-specific extensions path via

View file

@ -273,7 +273,6 @@ from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata,
PayloadGenerator, SECURITY_PATCH_LEVEL_PROP_NAME, ExtractTargetFiles, CopyTargetFilesDir)
from common import DoesInputFileContain, IsSparseImage
import target_files_diff
from check_target_files_vintf import CheckVintfIfTrebleEnabled
from non_ab_ota import GenerateNonAbOtaPackage
from payload_signer import PayloadSigner
@ -954,6 +953,7 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None):
target_info.info_dict['ab_partitions'] = common.ReadFromInputFile(target_file,
AB_PARTITIONS).strip().split("\n")
from check_target_files_vintf import CheckVintfIfTrebleEnabled
CheckVintfIfTrebleEnabled(target_file, target_info)
# Metadata to comply with Android OTA package format.