Rename ota_utils.Payload to PayloadGenerator
There's also a Payload class in system/update_engine/scripts. To avoid
name collision, rename the one in releasetools to PayloadGenerator.
No functional changes in this CL.
Bug: 227848550
Test: th
Change-Id: Ib7d4c7ad9839d99416d965e3a3661b8cee7b7693
diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py
index c6c4117..161bec3 100644
--- a/tools/releasetools/test_ota_from_target_files.py
+++ b/tools/releasetools/test_ota_from_target_files.py
@@ -17,6 +17,7 @@
import copy
import os
import os.path
+import tempfile
import zipfile
import common
@@ -24,15 +25,14 @@
import test_utils
from ota_utils import (
BuildLegacyOtaMetadata, CalculateRuntimeDevicesAndFingerprints,
- ConstructOtaApexInfo, FinalizeMetadata, GetPackageMetadata, PropertyFiles)
+ ConstructOtaApexInfo, FinalizeMetadata, GetPackageMetadata, PropertyFiles, AbOtaPropertyFiles, PayloadGenerator, StreamingPropertyFiles)
from ota_from_target_files import (
- _LoadOemDicts, AbOtaPropertyFiles,
+ _LoadOemDicts,
GetTargetFilesZipForCustomImagesUpdates,
GetTargetFilesZipForPartialUpdates,
GetTargetFilesZipForSecondaryImages,
GetTargetFilesZipWithoutPostinstallConfig,
- Payload, POSTINSTALL_CONFIG,
- StreamingPropertyFiles, AB_PARTITIONS)
+ POSTINSTALL_CONFIG, AB_PARTITIONS)
from apex_utils import GetApexInfoFromTargetFiles
from test_utils import PropertyFilesTestCase
from common import OPTIONS
@@ -975,7 +975,7 @@
@test_utils.SkipIfExternalToolsUnavailable()
def test_GetPayloadMetadataOffsetAndSize(self):
target_file = construct_target_files()
- payload = Payload()
+ payload = PayloadGenerator()
payload.Generate(target_file)
payload_signer = PayloadSigner()
@@ -1040,7 +1040,7 @@
def construct_zip_package_withValidPayload(with_metadata=False):
# Cannot use construct_zip_package() since we need a "valid" payload.bin.
target_file = construct_target_files()
- payload = Payload()
+ payload = PayloadGenerator()
payload.Generate(target_file)
payload_signer = PayloadSigner()
@@ -1222,7 +1222,7 @@
@staticmethod
def _create_payload_full(secondary=False):
target_file = construct_target_files(secondary)
- payload = Payload(secondary)
+ payload = PayloadGenerator(secondary)
payload.Generate(target_file)
return payload
@@ -1230,7 +1230,7 @@
def _create_payload_incremental():
target_file = construct_target_files()
source_file = construct_target_files()
- payload = Payload()
+ payload = PayloadGenerator()
payload.Generate(target_file, source_file)
return payload
@@ -1248,7 +1248,7 @@
def test_Generate_additionalArgs(self):
target_file = construct_target_files()
source_file = construct_target_files()
- payload = Payload()
+ payload = PayloadGenerator()
# This should work the same as calling payload.Generate(target_file,
# source_file).
payload.Generate(
@@ -1259,7 +1259,7 @@
def test_Generate_invalidInput(self):
target_file = construct_target_files()
common.ZipDelete(target_file, 'IMAGES/vendor.img')
- payload = Payload()
+ payload = PayloadGenerator()
self.assertRaises(common.ExternalError, payload.Generate, target_file)
@test_utils.SkipIfExternalToolsUnavailable()
@@ -1327,13 +1327,13 @@
with zipfile.ZipFile(output_file) as verify_zip:
# First make sure we have the essential entries.
namelist = verify_zip.namelist()
- self.assertIn(Payload.PAYLOAD_BIN, namelist)
- self.assertIn(Payload.PAYLOAD_PROPERTIES_TXT, namelist)
+ self.assertIn(PayloadGenerator.PAYLOAD_BIN, namelist)
+ self.assertIn(PayloadGenerator.PAYLOAD_PROPERTIES_TXT, namelist)
# Then assert these entries are stored.
for entry_info in verify_zip.infolist():
- if entry_info.filename not in (Payload.PAYLOAD_BIN,
- Payload.PAYLOAD_PROPERTIES_TXT):
+ if entry_info.filename not in (PayloadGenerator.PAYLOAD_BIN,
+ PayloadGenerator.PAYLOAD_PROPERTIES_TXT):
continue
self.assertEqual(zipfile.ZIP_STORED, entry_info.compress_type)
@@ -1365,14 +1365,14 @@
with zipfile.ZipFile(output_file) as verify_zip:
# First make sure we have the essential entries.
namelist = verify_zip.namelist()
- self.assertIn(Payload.SECONDARY_PAYLOAD_BIN, namelist)
- self.assertIn(Payload.SECONDARY_PAYLOAD_PROPERTIES_TXT, namelist)
+ self.assertIn(PayloadGenerator.SECONDARY_PAYLOAD_BIN, namelist)
+ self.assertIn(PayloadGenerator.SECONDARY_PAYLOAD_PROPERTIES_TXT, namelist)
# Then assert these entries are stored.
for entry_info in verify_zip.infolist():
if entry_info.filename not in (
- Payload.SECONDARY_PAYLOAD_BIN,
- Payload.SECONDARY_PAYLOAD_PROPERTIES_TXT):
+ PayloadGenerator.SECONDARY_PAYLOAD_BIN,
+ PayloadGenerator.SECONDARY_PAYLOAD_PROPERTIES_TXT):
continue
self.assertEqual(zipfile.ZIP_STORED, entry_info.compress_type)