[Buildroot] [PATCH] utils/pkg-stats: Add stats for active, lagging and inactive packages.
Dowan Gullient via buildroot <[email protected]>
| Newsgroups | net.busybox.buildroot |
|---|---|
| Message-ID | <[email protected]> |
This patch is following commit [1] and adds statistics ath the end of the page for the number of packages that are considered active, lagging or inactive based on their upstream activity for github and gitlab hosted repositories. This patch also adjusts the logic for determining upstream status. A package is considered inactive if it has not had any upstream activity for 3 years or more, lagging if it has not had any upstream activity for 1 year or more, and active otherwise. Tested locally. Signed-off-by: Dowan Gullient <[email protected]> [1] https://lore.kernel.org/all/[email protected]/ --- support/scripts/pkg-stats | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 29376b9e78..e98028ad30 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -605,9 +605,11 @@ async def check_git_status(session, pkg, npkgs, verbose=False): now = datetime.datetime.now(datetime.timezone.utc) delta = now - pub_date - if delta.days >= 365: + # 3 years without any activity can be considered as inactive + if delta.days >= 1095: pkg.upstream_status = ("inactive", "inactive") - elif delta.days >= 180: + # 1 year without any activity can be considered as lagging + elif delta.days >= 365: pkg.upstream_status = ("lagging", "lagging") else: pkg.upstream_status = ("active", "active") @@ -866,6 +868,12 @@ def calculate_stats(packages): else: stats["version-not-uptodate"] += 1 stats["patches"] += pkg.patch_count + if pkg.upstream_status[0] == "active": + stats["active-packages"] += 1 + elif pkg.upstream_status[0] == "lagging": + stats["lagging-packages"] += 1 + elif pkg.upstream_status[0] == "inactive": + stats["inactive-packages"] += 1 stats["total-cves"] += len(pkg.cves) stats["total-unsure-cves"] += len(pkg.unsure_cves) stats["total-stale-cve-ignores"] += len(pkg.stale_cve_ignores) @@ -1370,6 +1378,12 @@ def dump_html_stats(f, stats): stats["version-not-uptodate"]) f.write('<div class="data">Packages with no known upstream version</div><div class="data">%s</div>\n' % stats["version-unknown"]) + f.write('<div class="data">Packages with an active upstream</div><div class="data">%s</div>\n' % + stats["active-packages"]) + f.write('<div class="data">Packages with a lagging upstream</div><div class="data">%s</div>\n' % + stats["lagging-packages"]) + f.write('<div class="data">Packages with an inactive upstream</div><div class="data">%s</div>\n' % + stats["inactive-packages"]) f.write('<div class="data">Packages affected by CVEs</div><div class="data">%s</div>\n' % stats["pkg-cves"]) f.write('<div class="data">Total number of CVEs affecting all packages</div><div class="data">%s</div>\n' % -- 2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot