Intermediate commit

This commit is contained in:
László Károlyi 2021-11-17 16:47:28 +01:00
parent d29daf843e
commit 5f8330ed3a
Signed by: karolyi
GPG Key ID: 2DCAF25E55735BFE
1 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
from argparse import ArgumentParser, Namespace
from collections import defaultdict
from hashlib import sha256
from http.client import HTTPResponse
@ -20,11 +20,16 @@ parser.add_argument(
dest='jail_root', type=str, help='path of the jail (chroot)')
parser.add_argument(
dest='packages', type=str, help='space separated list of packages')
parser.add_argument(
'-v', '--verbose', dest='verbose', action='store_true',
help='Verbose logging')
def _get_abi(jail_root: str) -> str:
def _get_abi(args: Namespace) -> str:
'Return the used `$ABI` in the future jail.'
output = check_output(['pkg', '--chroot', jail_root, 'config', 'abi'])
output = check_output(['pkg', '--chroot', args.jail_root, 'config', 'abi'])
if args.verbose:
print('')
return output.strip().decode('utf-8')
@ -178,7 +183,7 @@ def run():
if not path_jailroot.is_dir():
raise FileNotFoundError(path_jailroot)
passed_packages = set(args.packages.split())
abi = _get_abi(jail_root=args.jail_root)
abi = _get_abi(args=args)
_check_pkgmirror_url(url=args.pkgmirror_url)
lines = _revalidate_packagesite(abi=abi, pkgmirror_url=args.pkgmirror_url)
loaded_packages = _load_packages(lines=lines)
@ -193,3 +198,4 @@ def run():
if __name__ == '__main__':
run()