From 89f854e1c5533bc49c59e7b5ab839463615df5c9 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 14 Aug 2023 11:38:45 +0200 Subject: just-mr py: Add support for 7zip archives --- bin/just-mr.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/just-mr.py b/bin/just-mr.py index 216c1390..b97e8dc7 100755 --- a/bin/just-mr.py +++ b/bin/just-mr.py @@ -449,9 +449,21 @@ def archive_checkout(desc, repo_type="archive"): try_rmtree(target_tmp) os.makedirs(target_tmp) if repo_type == "zip": - run_cmd(["unzip", "-d", ".", cas_path(content_id)], cwd=target_tmp) + try: + run_cmd(["unzip", "-d", ".", cas_path(content_id)], cwd=target_tmp) + except: + try: + run_cmd(["7z", "x", cas_path(content_id)], cwd=target_tmp) + except: + print("Failed to extract zip-like archive %s" % + (cas_path(content_id), )) + sys.exit(1) else: - run_cmd(["tar", "xf", cas_path(content_id)], cwd=target_tmp) + try: + run_cmd(["tar", "xf", cas_path(content_id)], cwd=target_tmp) + except: + print("Failed to extract tarball %s" % (cas_path(content_id), )) + sys.exit(1) if ALWAYS_FILE: move_to_place(target_tmp, target) return ["file", subdir_path(target, desc)] -- cgit v1.2.3