diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 1533030d2952b139e73f1c853e53105657fab84c..64ac95aaffef0ae2bcf2fe8e2d7e6cc4fa41589b 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -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 diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index e99152a5cb248516df470a1df34b6bdd4e1011ba..5d9cbd259765d541a6ab4474623fc2375c7bc229 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -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"]