mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 14:01:57 -09:00
support/scripts/pkg-stats: add --disable option
When debugging pkg-stats, it's quite useful to be able to disable some
features that are quite long (checking upstream URL, checking latest
version, checking CVE). This commit adds a --disable option, which can
take a comma-separated list of features to disable, such as:
./support/scripts/pkg-stats --disable url,upstream
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit b102352b62)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
67be1ff4f7
commit
679d40823b
@@ -1061,6 +1061,10 @@ def resolvepath(path):
|
|||||||
return os.path.abspath(os.path.expanduser(path))
|
return os.path.abspath(os.path.expanduser(path))
|
||||||
|
|
||||||
|
|
||||||
|
def list_str(values):
|
||||||
|
return values.split(',')
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
output = parser.add_argument_group('output', 'Output file(s)')
|
output = parser.add_argument_group('output', 'Output file(s)')
|
||||||
@@ -1077,6 +1081,9 @@ def parse_args():
|
|||||||
help='List of packages (comma separated)')
|
help='List of packages (comma separated)')
|
||||||
parser.add_argument('--nvd-path', dest='nvd_path',
|
parser.add_argument('--nvd-path', dest='nvd_path',
|
||||||
help='Path to the local NVD database', type=resolvepath)
|
help='Path to the local NVD database', type=resolvepath)
|
||||||
|
parser.add_argument('--disable', type=list_str,
|
||||||
|
help='Features to disable, comma-separated (cve, upstream, url)',
|
||||||
|
default=[])
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if not args.html and not args.json:
|
if not args.html and not args.json:
|
||||||
parser.error('at least one of --html or --json (or both) is required')
|
parser.error('at least one of --html or --json (or both) is required')
|
||||||
@@ -1123,13 +1130,15 @@ def __main__():
|
|||||||
pkg.set_url()
|
pkg.set_url()
|
||||||
pkg.set_ignored_cves()
|
pkg.set_ignored_cves()
|
||||||
pkg.set_developers(developers)
|
pkg.set_developers(developers)
|
||||||
print("Checking URL status")
|
if not "url" in args.disable:
|
||||||
loop = asyncio.get_event_loop()
|
print("Checking URL status")
|
||||||
loop.run_until_complete(check_package_urls(packages))
|
loop = asyncio.get_event_loop()
|
||||||
print("Getting latest versions ...")
|
loop.run_until_complete(check_package_urls(packages))
|
||||||
loop = asyncio.get_event_loop()
|
if not "upstream" in args.disable:
|
||||||
loop.run_until_complete(check_package_latest_version(packages))
|
print("Getting latest versions ...")
|
||||||
if args.nvd_path:
|
loop = asyncio.get_event_loop()
|
||||||
|
loop.run_until_complete(check_package_latest_version(packages))
|
||||||
|
if not "cve" in args.disable and args.nvd_path:
|
||||||
print("Checking packages CVEs")
|
print("Checking packages CVEs")
|
||||||
check_package_cves(args.nvd_path, packages)
|
check_package_cves(args.nvd_path, packages)
|
||||||
check_package_cpes(args.nvd_path, packages)
|
check_package_cpes(args.nvd_path, packages)
|
||||||
|
|||||||
Reference in New Issue
Block a user