Merge "Revert "releasetools: Support OTAs that have OEM properties changes.""
This commit is contained in:
commit
3c37889299
2 changed files with 40 additions and 68 deletions
|
@ -118,17 +118,6 @@ class EdifyGenerator(object):
|
|||
" or ".join(fp))
|
||||
self.script.append(cmd)
|
||||
|
||||
def AssertFingerprintOrThumbprint(self, fp, tp):
|
||||
"""Assert that the current recovery build fingerprint is fp, or thumbprint
|
||||
is tp."""
|
||||
cmd = ('getprop("ro.build.fingerprint") == "{fp}" ||\n'
|
||||
' getprop("ro.build.thumbprint") == "{tp}" ||\n'
|
||||
' abort("Package expects build fingerprint of {fp} or '
|
||||
'thumbprint of {tp}; this device has a fingerprint of " '
|
||||
'+ getprop("ro.build.fingerprint") and a thumbprint of " '
|
||||
'+ getprop("ro.build.thumbprint") + ".");').format(fp=fp, tp=tp)
|
||||
self.script.append(cmd)
|
||||
|
||||
def AssertOlderBuild(self, timestamp, timestamp_text):
|
||||
"""Assert that the build on the device is older (or the same as)
|
||||
the given timestamp."""
|
||||
|
|
|
@ -439,7 +439,7 @@ def SignOutput(temp_zip_name, output_zip_name):
|
|||
|
||||
def AppendAssertions(script, info_dict, oem_dict=None):
|
||||
oem_props = info_dict.get("oem_fingerprint_properties")
|
||||
if not oem_props:
|
||||
if oem_props is None or len(oem_props) == 0:
|
||||
device = GetBuildProp("ro.product.device", info_dict)
|
||||
script.AssertDevice(device)
|
||||
else:
|
||||
|
@ -528,10 +528,10 @@ def WriteFullOTAPackage(input_zip, output_zip):
|
|||
# in the target build.
|
||||
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
|
||||
|
||||
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
|
||||
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
||||
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
|
||||
oem_dict = None
|
||||
if oem_props:
|
||||
if oem_props is not None and len(oem_props) > 0:
|
||||
if OPTIONS.oem_source is None:
|
||||
raise common.ExternalError("OEM source required for this build")
|
||||
if not OPTIONS.oem_no_mount:
|
||||
|
@ -539,10 +539,9 @@ def WriteFullOTAPackage(input_zip, output_zip):
|
|||
oem_dict = common.LoadDictionaryFromLines(
|
||||
open(OPTIONS.oem_source).readlines())
|
||||
|
||||
target_fp = CalculateFingerprint(oem_props, oem_dict,
|
||||
OPTIONS.target_info_dict)
|
||||
metadata = {
|
||||
"post-build": target_fp,
|
||||
"post-build": CalculateFingerprint(oem_props, oem_dict,
|
||||
OPTIONS.info_dict),
|
||||
"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
|
||||
OPTIONS.info_dict),
|
||||
"post-timestamp": GetBuildProp("ro.build.date.utc", OPTIONS.info_dict),
|
||||
|
@ -611,7 +610,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
|
|||
""" % bcb_dev)
|
||||
|
||||
# Dump fingerprints
|
||||
script.Print("Target: %s" % target_fp)
|
||||
script.Print("Target: %s" % CalculateFingerprint(
|
||||
oem_props, oem_dict, OPTIONS.info_dict))
|
||||
|
||||
device_specific.FullOTA_InstallBegin()
|
||||
|
||||
|
@ -773,18 +773,17 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
target_version = OPTIONS.target_info_dict["recovery_api_version"]
|
||||
|
||||
if source_version == 0:
|
||||
print("WARNING: generating edify script for a source that "
|
||||
"can't install it.")
|
||||
print ("WARNING: generating edify script for a source that "
|
||||
"can't install it.")
|
||||
script = edify_generator.EdifyGenerator(
|
||||
source_version, OPTIONS.target_info_dict,
|
||||
fstab=OPTIONS.source_info_dict["fstab"])
|
||||
|
||||
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
||||
recovery_mount_options = OPTIONS.source_info_dict.get(
|
||||
"recovery_mount_options")
|
||||
source_oem_props = OPTIONS.source_info_dict.get("oem_fingerprint_properties")
|
||||
target_oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
|
||||
oem_dict = None
|
||||
if source_oem_props or target_oem_props:
|
||||
if oem_props is not None and len(oem_props) > 0:
|
||||
if OPTIONS.oem_source is None:
|
||||
raise common.ExternalError("OEM source required for this build")
|
||||
if not OPTIONS.oem_no_mount:
|
||||
|
@ -793,8 +792,8 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
open(OPTIONS.oem_source).readlines())
|
||||
|
||||
metadata = {
|
||||
"pre-device": GetOemProperty("ro.product.device", source_oem_props,
|
||||
oem_dict, OPTIONS.source_info_dict),
|
||||
"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
|
||||
OPTIONS.source_info_dict),
|
||||
"ota-type": "BLOCK",
|
||||
}
|
||||
|
||||
|
@ -829,9 +828,9 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
metadata=metadata,
|
||||
info_dict=OPTIONS.source_info_dict)
|
||||
|
||||
source_fp = CalculateFingerprint(source_oem_props, oem_dict,
|
||||
source_fp = CalculateFingerprint(oem_props, oem_dict,
|
||||
OPTIONS.source_info_dict)
|
||||
target_fp = CalculateFingerprint(target_oem_props, oem_dict,
|
||||
target_fp = CalculateFingerprint(oem_props, oem_dict,
|
||||
OPTIONS.target_info_dict)
|
||||
metadata["pre-build"] = source_fp
|
||||
metadata["post-build"] = target_fp
|
||||
|
@ -927,39 +926,32 @@ else if get_stage("%(bcb_dev)s") != "3/3" then
|
|||
""" % bcb_dev)
|
||||
|
||||
# Dump fingerprints
|
||||
script.Print(source_fp)
|
||||
script.Print(target_fp)
|
||||
script.Print("Source: %s" % CalculateFingerprint(
|
||||
oem_props, oem_dict, OPTIONS.source_info_dict))
|
||||
script.Print("Target: %s" % CalculateFingerprint(
|
||||
oem_props, oem_dict, OPTIONS.target_info_dict))
|
||||
|
||||
script.Print("Verifying current system...")
|
||||
|
||||
device_specific.IncrementalOTA_VerifyBegin()
|
||||
|
||||
# When blockimgdiff version is less than 3 (non-resumable block-based OTA),
|
||||
# patching on a device that's already on the target build will damage the
|
||||
# system. Because operations like move don't check the block state, they
|
||||
# always apply the changes unconditionally.
|
||||
if blockimgdiff_version <= 2:
|
||||
if source_oem_props is None:
|
||||
if oem_props is None:
|
||||
# When blockimgdiff version is less than 3 (non-resumable block-based OTA),
|
||||
# patching on a device that's already on the target build will damage the
|
||||
# system. Because operations like move don't check the block state, they
|
||||
# always apply the changes unconditionally.
|
||||
if blockimgdiff_version <= 2:
|
||||
script.AssertSomeFingerprint(source_fp)
|
||||
else:
|
||||
script.AssertSomeFingerprint(source_fp, target_fp)
|
||||
else:
|
||||
if blockimgdiff_version <= 2:
|
||||
script.AssertSomeThumbprint(
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
|
||||
|
||||
else: # blockimgdiff_version > 2
|
||||
if source_oem_props is None and target_oem_props is None:
|
||||
script.AssertSomeFingerprint(source_fp, target_fp)
|
||||
elif source_oem_props is not None and target_oem_props is not None:
|
||||
else:
|
||||
script.AssertSomeThumbprint(
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict),
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
|
||||
elif source_oem_props is None and target_oem_props is not None:
|
||||
script.AssertFingerprintOrThumbprint(
|
||||
source_fp,
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict))
|
||||
else:
|
||||
script.AssertFingerprintOrThumbprint(
|
||||
target_fp,
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
|
||||
|
||||
# Check the required cache size (i.e. stashed blocks).
|
||||
size = []
|
||||
|
@ -1082,7 +1074,7 @@ def WriteVerifyPackage(input_zip, output_zip):
|
|||
recovery_mount_options = OPTIONS.info_dict.get(
|
||||
"recovery_mount_options")
|
||||
oem_dict = None
|
||||
if oem_props:
|
||||
if oem_props is not None and len(oem_props) > 0:
|
||||
if OPTIONS.oem_source is None:
|
||||
raise common.ExternalError("OEM source required for this build")
|
||||
if not OPTIONS.oem_no_mount:
|
||||
|
@ -1425,18 +1417,17 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
target_version = OPTIONS.target_info_dict["recovery_api_version"]
|
||||
|
||||
if source_version == 0:
|
||||
print("WARNING: generating edify script for a source that "
|
||||
"can't install it.")
|
||||
print ("WARNING: generating edify script for a source that "
|
||||
"can't install it.")
|
||||
script = edify_generator.EdifyGenerator(
|
||||
source_version, OPTIONS.target_info_dict,
|
||||
fstab=OPTIONS.source_info_dict["fstab"])
|
||||
|
||||
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
||||
recovery_mount_options = OPTIONS.source_info_dict.get(
|
||||
"recovery_mount_options")
|
||||
source_oem_props = OPTIONS.source_info_dict.get("oem_fingerprint_properties")
|
||||
target_oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
|
||||
oem_dict = None
|
||||
if source_oem_props or target_oem_props:
|
||||
if oem_props is not None and len(oem_props) > 0:
|
||||
if OPTIONS.oem_source is None:
|
||||
raise common.ExternalError("OEM source required for this build")
|
||||
if not OPTIONS.oem_no_mount:
|
||||
|
@ -1445,8 +1436,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
open(OPTIONS.oem_source).readlines())
|
||||
|
||||
metadata = {
|
||||
"pre-device": GetOemProperty("ro.product.device", source_oem_props,
|
||||
oem_dict, OPTIONS.source_info_dict),
|
||||
"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
|
||||
OPTIONS.source_info_dict),
|
||||
"ota-type": "FILE",
|
||||
}
|
||||
|
||||
|
@ -1489,25 +1480,17 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
else:
|
||||
vendor_diff = None
|
||||
|
||||
target_fp = CalculateFingerprint(target_oem_props, oem_dict,
|
||||
target_fp = CalculateFingerprint(oem_props, oem_dict,
|
||||
OPTIONS.target_info_dict)
|
||||
source_fp = CalculateFingerprint(source_oem_props, oem_dict,
|
||||
source_fp = CalculateFingerprint(oem_props, oem_dict,
|
||||
OPTIONS.source_info_dict)
|
||||
|
||||
if source_oem_props is None and target_oem_props is None:
|
||||
if oem_props is None:
|
||||
script.AssertSomeFingerprint(source_fp, target_fp)
|
||||
elif source_oem_props is not None and target_oem_props is not None:
|
||||
else:
|
||||
script.AssertSomeThumbprint(
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict),
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
|
||||
elif source_oem_props is None and target_oem_props is not None:
|
||||
script.AssertFingerprintOrThumbprint(
|
||||
source_fp,
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict))
|
||||
else:
|
||||
script.AssertFingerprintOrThumbprint(
|
||||
target_fp,
|
||||
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
|
||||
|
||||
metadata["pre-build"] = source_fp
|
||||
metadata["post-build"] = target_fp
|
||||
|
|
Loading…
Reference in a new issue