allow to use local apks
This commit is contained in:
parent
c66927898f
commit
1309d7ea24
1 changed files with 27 additions and 13 deletions
|
@ -203,9 +203,17 @@ if __name__ == "__main__":
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--task", help="[debug] Name of the task to perform", type=str, action="store"
|
"--task", help="[debug] Name of the task to perform", type=str, action="store"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
app_group = parser.add_mutually_exclusive_group()
|
||||||
|
app_group.add_argument(
|
||||||
"--sha", help="[debug] sha to make the --task on", type=str, action="store"
|
"--sha", help="[debug] sha to make the --task on", type=str, action="store"
|
||||||
)
|
)
|
||||||
|
app_group.add_argument(
|
||||||
|
"--apk-path",
|
||||||
|
help="[debug] apk to make the --task on",
|
||||||
|
type=Path,
|
||||||
|
action="store",
|
||||||
|
)
|
||||||
|
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
group.add_argument("--docker", action="store_true")
|
group.add_argument("--docker", action="store_true")
|
||||||
group.add_argument("--singularity", action="store_true")
|
group.add_argument("--singularity", action="store_true")
|
||||||
|
@ -303,20 +311,26 @@ if __name__ == "__main__":
|
||||||
raise Exception("Debug mode must be used with BOTH --task and --sha")
|
raise Exception("Debug mode must be used with BOTH --task and --sha")
|
||||||
task = args.task
|
task = args.task
|
||||||
# sha = str(args.sha).upper() # TMP patch
|
# sha = str(args.sha).upper() # TMP patch
|
||||||
sha = str(args.sha)
|
# sha = str(args.sha)
|
||||||
if len(sha) != 64:
|
if args.sha is not None and len(args.sha) != 64:
|
||||||
# raise Exception("invalid --sha value")
|
# raise Exception("invalid --sha value")
|
||||||
print("invalid --sha value, exception disabled for tests")
|
print("invalid --sha value, exception disabled for tests")
|
||||||
|
if args.sha is not None:
|
||||||
apk_blob = get_apk_from_androzoo(
|
apk_blob = get_apk_from_androzoo(
|
||||||
sha256=sha,
|
sha256=args.sha,
|
||||||
apikey=androzoo_apikey,
|
apikey=androzoo_apikey,
|
||||||
base_url=androzoo_base_url,
|
base_url=androzoo_base_url,
|
||||||
reraise=False,
|
reraise=False,
|
||||||
local_cache=androzoo_local_cache,
|
local_cache=androzoo_local_cache,
|
||||||
)
|
)
|
||||||
|
sha = args.sha
|
||||||
if apk_blob is None:
|
if apk_blob is None:
|
||||||
print(f"Unable to obtain apk for sha={sha}")
|
print(f"Unable to obtain apk for sha={sha}")
|
||||||
else:
|
else:
|
||||||
|
with args.apk_path.open("rb") as fp:
|
||||||
|
apk_blob = fp.read()
|
||||||
|
sha = args.apk_path.name.removesuffix(".apk") # no a sha, but good enough
|
||||||
|
if apk_blob is not None:
|
||||||
# do_one_job(sha256: str, tool_name: str, base_dir: str, apk_blob, container_mode, container_image, keep_tmp_dir=False):
|
# do_one_job(sha256: str, tool_name: str, base_dir: str, apk_blob, container_mode, container_image, keep_tmp_dir=False):
|
||||||
res = do_one_job(
|
res = do_one_job(
|
||||||
sha256=sha,
|
sha256=sha,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue