diff mbox series

[v4,12/12] support/scripts/pkg-stats: add status for cve check

Message ID 20200302145013.9574-13-heiko.thiery@gmail.com
State Superseded
Headers show
Series pkg-stats json output improvements | expand

Commit Message

Heiko Thiery March 2, 2020, 2:50 p.m. UTC
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 support/scripts/pkg-stats | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 9d058ca67d..b0ae681c22 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -619,6 +619,12 @@  def check_package_cves(nvd_path, packages):
             if pkg_name in packages and cve.affects(packages[pkg_name]):
                 packages[pkg_name].cves.append(cve.identifier)
 
+    for pkg_name, pkg in packages.items():
+        if len(pkg.cves) > 0:
+            pkg.status['cve'] = ('error', 'affected by cve')
+        else:
+            pkg.status['cve'] = ('ok', 'no cve found')
+
 
 def calculate_stats(packages):
     stats = defaultdict(int)