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(
|
||||
"--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"
|
||||
)
|
||||
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.add_argument("--docker", 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")
|
||||
task = args.task
|
||||
# sha = str(args.sha).upper() # TMP patch
|
||||
sha = str(args.sha)
|
||||
if len(sha) != 64:
|
||||
# sha = str(args.sha)
|
||||
if args.sha is not None and len(args.sha) != 64:
|
||||
# raise Exception("invalid --sha value")
|
||||
print("invalid --sha value, exception disabled for tests")
|
||||
apk_blob = get_apk_from_androzoo(
|
||||
sha256=sha,
|
||||
apikey=androzoo_apikey,
|
||||
base_url=androzoo_base_url,
|
||||
reraise=False,
|
||||
local_cache=androzoo_local_cache,
|
||||
)
|
||||
if apk_blob is None:
|
||||
print(f"Unable to obtain apk for sha={sha}")
|
||||
if args.sha is not None:
|
||||
apk_blob = get_apk_from_androzoo(
|
||||
sha256=args.sha,
|
||||
apikey=androzoo_apikey,
|
||||
base_url=androzoo_base_url,
|
||||
reraise=False,
|
||||
local_cache=androzoo_local_cache,
|
||||
)
|
||||
sha = args.sha
|
||||
if apk_blob is None:
|
||||
print(f"Unable to obtain apk for sha={sha}")
|
||||
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):
|
||||
res = do_one_job(
|
||||
sha256=sha,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue