From e0765b40de796f1862d01148154a06d6a28acde1 Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Fri, 8 Nov 2019 13:57:53 +0800 Subject: [PATCH] Use prebuilt llvm tools - objdump -> llvm-objdump: diff.py depends on prebuilt llvm-binutils - llvm-objdump expects long options to start with '--' Test: Manual Change-Id: I9f3986444ef2f17eb37b4b1c1c66f5c1ccb47299 --- vndk/tools/image-diff-tool/diff.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/vndk/tools/image-diff-tool/diff.py b/vndk/tools/image-diff-tool/diff.py index fc4e80f96..a623d65a5 100644 --- a/vndk/tools/image-diff-tool/diff.py +++ b/vndk/tools/image-diff-tool/diff.py @@ -41,18 +41,16 @@ def sha1sum_without_signing_key(filepath): return hashlib.sha1(",".join(l).encode()).hexdigest() def strip_and_sha1sum(filepath): - strip_all = lambda: silent_call(["llvm-strip", "--strip-all", "-keep-section=.ARM.attributes", filepath, "-o", filepath + ".tmp"]) - remove_build_id = lambda: silent_call(["llvm-strip", "-remove-section=.note.gnu.build-id", filepath + ".tmp", "-o", filepath + ".tmp.no-build-id"]) + tmp_filepath = filepath + '.tmp.no-build-id' + strip_all_and_remove_build_id = lambda: silent_call(["llvm-strip", "--strip-all", "--keep-section=.ARM.attributes", "--remove-section=.note.gnu.build-id", filepath, "-o", tmp_filepath]) try: - if strip_all() and remove_build_id(): - return sha1sum(filepath + ".tmp.no-build-id") + if strip_all_and_remove_build_id(): + return sha1sum(tmp_filepath) else: return sha1sum(filepath) finally: - if os.path.exists(filepath + ".tmp"): - os.remove(filepath + ".tmp") - if os.path.exists(filepath + ".tmp.no-build-id"): - os.remove(filepath + ".tmp.no-build-id") + if os.path.exists(tmp_filepath): + os.remove(tmp_filepath) return sha1sum(filepath) @@ -72,7 +70,7 @@ def main(all_targets, search_paths, ignore_signing_key=False): paths = [str(path) for path in Path(target).glob('**/*') if valid_path(str(path))] def run(path): - is_native_component = silent_call(["objdump", "-a", path]) + is_native_component = silent_call(["llvm-objdump", "-a", path]) is_apk = path.endswith('.apk') if is_native_component: return strip_and_sha1sum(path), path[len(target):]