mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 00:20:38 -09:00
support/scripts/pkg-stats: add -N/--needs-update option
This commit adds the -N/--needs-update option, disabled by default, to list only packages with newer upstream versions. All other packages will be excluded from the HTML or JSON output. Signed-off-by: Kadambini Nema <kadambini.nema@gmail.com> Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
This commit is contained in:
committed by
Arnout Vandecappelle
parent
fbad192a4d
commit
ed9466e7f9
@@ -1313,12 +1313,22 @@ def parse_args():
|
||||
default=[])
|
||||
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
||||
help='Increase verbosity')
|
||||
parser.add_argument('-N', '--needs-update', dest='needs_update', action='store_true',
|
||||
help='Only include packages with newer versions available')
|
||||
args = parser.parse_args()
|
||||
if not args.html and not args.json:
|
||||
parser.error('at least one of --html or --json (or both) is required')
|
||||
return args
|
||||
|
||||
|
||||
def is_newer_version_available(pkg):
|
||||
return not (
|
||||
pkg.latest_version['status'] in (RM_API_STATUS_ERROR, RM_API_STATUS_NOT_FOUND) or
|
||||
pkg.latest_version['version'] is None or
|
||||
pkg.latest_version['version'] == pkg.current_version
|
||||
)
|
||||
|
||||
|
||||
def __main__():
|
||||
global cvecheck
|
||||
|
||||
@@ -1376,6 +1386,8 @@ def __main__():
|
||||
if "cve" not in args.disable and args.nvd_path:
|
||||
print("Checking packages CVEs")
|
||||
check_package_cves(args.nvd_path, packages)
|
||||
if args.needs_update:
|
||||
packages = [pkg for pkg in packages if is_newer_version_available(pkg)]
|
||||
print("Calculate stats")
|
||||
stats = calculate_stats(packages)
|
||||
if args.html:
|
||||
|
||||
Reference in New Issue
Block a user