From 5e22d28ecb162c2d59ffab5d2cc7899d40a9e2a6 Mon Sep 17 00:00:00 2001 From: Jeongik Cha Date: Wed, 7 Aug 2019 10:43:20 +0900 Subject: [PATCH] Add 'unzip' option unzip option: 'unzip -qd target target/* search_path/*' before execution Bug: 138639389 Test: place zip file in the dir, and then run compare_images with -u Change-Id: I8ad442f32d8ab5a5e504882c6db0cae166fef42c --- vndk/tools/image-diff-tool/compare_images_and_print.sh | 2 +- vndk/tools/image-diff-tool/diff.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vndk/tools/image-diff-tool/compare_images_and_print.sh b/vndk/tools/image-diff-tool/compare_images_and_print.sh index a5d09a5e7..fc8b67b0b 100755 --- a/vndk/tools/image-diff-tool/compare_images_and_print.sh +++ b/vndk/tools/image-diff-tool/compare_images_and_print.sh @@ -2,7 +2,7 @@ build/soong/soong_ui.bash --make-mode compare_images . build/envsetup.sh lunch aosp_arm64 -out/host/linux-x86/bin/compare_images $1 +out/host/linux-x86/bin/compare_images $1 -u echo " - Common parts" cat common.csv echo diff --git a/vndk/tools/image-diff-tool/diff.py b/vndk/tools/image-diff-tool/diff.py index ecc0ba083..fc4e80f96 100644 --- a/vndk/tools/image-diff-tool/diff.py +++ b/vndk/tools/image-diff-tool/diff.py @@ -106,11 +106,17 @@ def main(all_targets, search_paths, ignore_signing_key=False): if __name__ == "__main__": - parser = argparse.ArgumentParser(prog="compare_images", usage="compare_images -t model1 model2 [model...] -s dir1 [dir...] [-i]") + parser = argparse.ArgumentParser(prog="compare_images", usage="compare_images -t model1 model2 [model...] -s dir1 [dir...] [-i] [-u]") parser.add_argument("-t", "--target", nargs='+', required=True) parser.add_argument("-s", "--search_path", nargs='+', required=True) parser.add_argument("-i", "--ignore_signing_key", action='store_true') + parser.add_argument("-u", "--unzip", action='store_true') args = parser.parse_args() if len(args.target) < 2: parser.error("The number of targets has to be at least two.") + if args.unzip: + for t in args.target: + unzip_cmd = ["unzip", "-qd", t, os.path.join(t, "*.zip")] + unzip_cmd.extend([os.path.join(s, "*") for s in args.search_path]) + subprocess.call(unzip_cmd) main(args.target, args.search_path, args.ignore_signing_key)