Merge "Fix signapk not found error when running ota_from_target_files locally"

This commit is contained in:
Treehugger Robot 2021-11-19 23:25:05 +00:00 committed by Gerrit Code Review
commit 1fb1088e88
2 changed files with 11 additions and 1 deletions

View file

@ -68,6 +68,9 @@ class Options(object):
self.search_path = os.path.dirname(os.path.dirname(exec_path))
self.signapk_path = "framework/signapk.jar" # Relative to search_path
if not os.path.exists(os.path.join(self.search_path, self.signapk_path)):
if "ANDROID_HOST_OUT" in os.environ:
self.search_path = os.environ["ANDROID_HOST_OUT"]
self.signapk_shared_library_path = "lib64" # Relative to search_path
self.extra_signapk_args = []
self.java_path = "java" # Use the one on the path by default.
@ -973,6 +976,8 @@ class PartitionBuildProps(object):
break
except KeyError:
logger.warning('Failed to read %s', prop_file)
if data == '':
logger.warning("Failed to read build.prop for partition {}".format(name))
return data
@staticmethod

View file

@ -1479,7 +1479,7 @@ def main(argv):
# Only check for existence of key file if using the default signer.
# Because the custom signer might not need the key file AT all.
# b/191704641
if not OPTIONS.signapk_path:
if not OPTIONS.payload_signer:
private_key_path = OPTIONS.package_key + OPTIONS.private_key_suffix
if not os.path.exists(private_key_path):
raise common.ExternalError(
@ -1487,6 +1487,11 @@ def main(argv):
" correct key path through -k option".format(
private_key_path)
)
signapk_abs_path = os.path.join(
OPTIONS.search_path, OPTIONS.signapk_path)
if not os.path.exists(signapk_abs_path):
raise common.ExternalError(
"Failed to find sign apk binary {} in search path {}. Make sure the correct search path is passed via -p".format(OPTIONS.signapk_path, OPTIONS.search_path))
if OPTIONS.source_info_dict:
source_build_prop = OPTIONS.source_info_dict["build.prop"]