From 5f8330ed3a16a97177449d0260c86d22ee0dd13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20K=C3=A1rolyi?= Date: Wed, 17 Nov 2021 16:47:28 +0100 Subject: [PATCH] Intermediate commit --- tools/pkgmirror-jailrevalidator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/pkgmirror-jailrevalidator.py b/tools/pkgmirror-jailrevalidator.py index 16ff6a2..434147a 100755 --- a/tools/pkgmirror-jailrevalidator.py +++ b/tools/pkgmirror-jailrevalidator.py @@ -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() +