Fix non-AB ota generation for directories
Test: ota_from_target_files -v --block yukawa-target_files-10097950.zip test.zip Change-Id: I4291010d66cc28bdb6b6b334cdbed06daf3de837
This commit is contained in:
@@ -23,6 +23,7 @@ import verity_utils
|
|||||||
from check_target_files_vintf import CheckVintfIfTrebleEnabled, HasPartition
|
from check_target_files_vintf import CheckVintfIfTrebleEnabled, HasPartition
|
||||||
from common import OPTIONS
|
from common import OPTIONS
|
||||||
from ota_utils import UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata, PropertyFiles
|
from ota_utils import UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata, PropertyFiles
|
||||||
|
import subprocess
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -277,7 +278,8 @@ endif;
|
|||||||
needed_property_files = (
|
needed_property_files = (
|
||||||
NonAbOtaPropertyFiles(),
|
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):
|
def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
|
||||||
@@ -532,7 +534,8 @@ endif;
|
|||||||
needed_property_files = (
|
needed_property_files = (
|
||||||
NonAbOtaPropertyFiles(),
|
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):
|
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:
|
if OPTIONS.extracted_input is not None:
|
||||||
OPTIONS.input_tmp = OPTIONS.extracted_input
|
OPTIONS.input_tmp = OPTIONS.extracted_input
|
||||||
else:
|
else:
|
||||||
logger.info("unzipping target target-files...")
|
if not os.path.isdir(target_file):
|
||||||
OPTIONS.input_tmp = common.UnzipTemp(target_file, UNZIP_PATTERN)
|
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
|
OPTIONS.target_tmp = OPTIONS.input_tmp
|
||||||
|
|
||||||
# If the caller explicitly specified the device-specific extensions path via
|
# If the caller explicitly specified the device-specific extensions path via
|
||||||
|
@@ -273,7 +273,6 @@ from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata,
|
|||||||
PayloadGenerator, SECURITY_PATCH_LEVEL_PROP_NAME, ExtractTargetFiles, CopyTargetFilesDir)
|
PayloadGenerator, SECURITY_PATCH_LEVEL_PROP_NAME, ExtractTargetFiles, CopyTargetFilesDir)
|
||||||
from common import DoesInputFileContain, IsSparseImage
|
from common import DoesInputFileContain, IsSparseImage
|
||||||
import target_files_diff
|
import target_files_diff
|
||||||
from check_target_files_vintf import CheckVintfIfTrebleEnabled
|
|
||||||
from non_ab_ota import GenerateNonAbOtaPackage
|
from non_ab_ota import GenerateNonAbOtaPackage
|
||||||
from payload_signer import PayloadSigner
|
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,
|
target_info.info_dict['ab_partitions'] = common.ReadFromInputFile(target_file,
|
||||||
AB_PARTITIONS).strip().split("\n")
|
AB_PARTITIONS).strip().split("\n")
|
||||||
|
|
||||||
|
from check_target_files_vintf import CheckVintfIfTrebleEnabled
|
||||||
CheckVintfIfTrebleEnabled(target_file, target_info)
|
CheckVintfIfTrebleEnabled(target_file, target_info)
|
||||||
|
|
||||||
# Metadata to comply with Android OTA package format.
|
# Metadata to comply with Android OTA package format.
|
||||||
|
Reference in New Issue
Block a user