From f68016e5de86d4530def5eae3cc6809bb2e156c4 Mon Sep 17 00:00:00 2001 From: Thomas Perale Date: Mon, 3 Nov 2025 22:11:41 +0100 Subject: [PATCH] support/scripts/cve.py: remove print from cve.py library The `support/script/cve.py` file is used as a library. Depending on how you use this library you might not want to write content to stdout when calling its function. This patch move the 'updating' log to the 'pkg-stats' script and write the alert when LooseVersion doesn't have a version to stderr. Signed-off-by: Thomas Perale Signed-off-by: Peter Korsgaard (cherry picked from commit 4b318dea1712d212270d0a19f206a50d37852130) Signed-off-by: Thomas Perale --- support/scripts/cve.py | 3 +-- support/scripts/pkg-stats | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/support/scripts/cve.py b/support/scripts/cve.py index ba41762fa0..5ff67585e2 100755 --- a/support/scripts/cve.py +++ b/support/scripts/cve.py @@ -69,7 +69,6 @@ class CVE: @staticmethod def download_nvd(nvd_git_dir): - print(f"Updating from {NVD_BASE_URL}") if os.path.exists(nvd_git_dir): subprocess.check_call( ["git", "pull"], @@ -192,7 +191,7 @@ class CVE: pkg_version = distutils.version.LooseVersion(version) if not hasattr(pkg_version, "version"): - print("Cannot parse package '%s' version '%s'" % (name, version)) + print("Cannot parse package '%s' version '%s'" % (name, version), file=sys.stderr) pkg_version = None # if we don't have a cpeid, build one based on name and version diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index a0a46aa8cb..8710dda795 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -675,6 +675,7 @@ def check_package_cves(nvd_path, packages): else: cpe_product_pkgs[pkg.name].append(pkg) + print(f"Updating NVD database in '{nvd_path}'") for cve in cvecheck.CVE.read_nvd_dir(nvd_path): check_package_cve_affects(cve, cpe_product_pkgs)