diff options
author | Hongguang Chen <hgchen@google.com> | 2020-05-03 21:24:26 -0700 |
---|---|---|
committer | Hongguang Chen <hgchen@google.com> | 2020-05-04 20:45:33 +0000 |
commit | 34354032843fb2b7eef0a51d67c196c059be00cc (patch) | |
tree | 776da476b9185a7cc92f7cb421e6ac0a2dd3809f /tools | |
parent | c3b0b52e58e4a9cf0604fe0adac20325835c9a80 (diff) | |
download | build_make-34354032843fb2b7eef0a51d67c196c059be00cc.tar.gz build_make-34354032843fb2b7eef0a51d67c196c059be00cc.tar.bz2 build_make-34354032843fb2b7eef0a51d67c196c059be00cc.zip |
Skip _oem_props if oem_dicts is None.
The oem_dicts in BuildInfo is only available to ota_from_target_files
when it's called with "--oem_settings" input. However, aosp/1135332
starts to use BuildInfo in add_img_to_target_files w/o oem_dicts. An
assert is triggered due to it when oem_fingerprint_properties is in the
info_dict.
This change skips _oem_props reading if oem_dicts is None to allow this
case.
BUG: 155360923
BUG: 154171021
Test: Sign images with oem_fingerprint_properties.
Change-Id: I6a73feecd9567fd4d85f4eab3d4e11c5df28fe39
Merged-In: Idfd41c8b20b23d50e4895f24500f9a25625b7d98
Diffstat (limited to 'tools')
-rw-r--r-- | tools/releasetools/common.py | 9 | ||||
-rw-r--r-- | tools/releasetools/test_common.py | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index df57e3775d..d4c73a49e1 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -360,10 +360,13 @@ class BuildInfo(object): self.oem_dicts = oem_dicts self._is_ab = info_dict.get("ab_update") == "true" - self._oem_props = info_dict.get("oem_fingerprint_properties") - if self._oem_props: - assert oem_dicts, "OEM source required for this build" + # Skip _oem_props if oem_dicts is None to use BuildInfo in + # sign_target_files_apks + if self.oem_dicts: + self._oem_props = info_dict.get("oem_fingerprint_properties") + else: + self._oem_props = None def check_fingerprint(fingerprint): if (" " in fingerprint or any(ord(ch) > 127 for ch in fingerprint)): diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py index 029d46f07b..173ef53ccd 100644 --- a/tools/releasetools/test_common.py +++ b/tools/releasetools/test_common.py @@ -175,10 +175,6 @@ class BuildInfoTest(test_utils.ReleaseToolsTestCase): self.assertEqual('brand3/product-name/device3:build-thumbprint', target_info.fingerprint) - # Missing oem_dict should be rejected. - self.assertRaises(AssertionError, common.BuildInfo, - self.TEST_INFO_DICT_USES_OEM_PROPS, None) - def test_init_badFingerprint(self): info_dict = copy.deepcopy(self.TEST_INFO_DICT) info_dict['build.prop']['ro.build.fingerprint'] = 'bad fingerprint' |