mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 14:01:57 -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>
(cherry picked from commit ed9466e7f9)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
ba56a26342
commit
efa9144d57
@@ -1313,12 +1313,22 @@ def parse_args():
|
|||||||
default=[])
|
default=[])
|
||||||
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
||||||
help='Increase verbosity')
|
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()
|
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')
|
||||||
return args
|
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__():
|
def __main__():
|
||||||
global cvecheck
|
global cvecheck
|
||||||
|
|
||||||
@@ -1376,6 +1386,8 @@ def __main__():
|
|||||||
if "cve" not in args.disable and args.nvd_path:
|
if "cve" not 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)
|
||||||
|
if args.needs_update:
|
||||||
|
packages = [pkg for pkg in packages if is_newer_version_available(pkg)]
|
||||||
print("Calculate stats")
|
print("Calculate stats")
|
||||||
stats = calculate_stats(packages)
|
stats = calculate_stats(packages)
|
||||||
if args.html:
|
if args.html:
|
||||||
|
|||||||
Reference in New Issue
Block a user