From e0ed05cc007eed630dd44b7f129903a76fab6981 Mon Sep 17 00:00:00 2001 From: Michael Trimarchi Date: Tue, 3 Sep 2024 10:57:44 +0200 Subject: [PATCH] scripts/support/cve.py: avoid a complete clone of the CVE git repository Just a simple clone and pull with --depth 1 should be enough to parse the CVE data and generate the pkg-stats report. From a full clone and a depth-1 clone, and the size delta is 2.9GiB vs. 2.2GiB. The download size does change: from 983.55MiB down to 270.78MiB. It's a net time win too: 2m17s vs 1min7s (on a 100Mbps link). Signed-off-by: Michael Trimarchi Signed-off-by: Thomas Petazzoni --- support/scripts/cve.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/scripts/cve.py b/support/scripts/cve.py index e25825581e..dcb3a63925 100755 --- a/support/scripts/cve.py +++ b/support/scripts/cve.py @@ -72,7 +72,7 @@ class CVE: print(f"Updating from {NVD_BASE_URL}") if os.path.exists(nvd_git_dir): subprocess.check_call( - ["git", "pull"], + ["git", "pull", "--depth", "1"], cwd=nvd_git_dir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, @@ -82,7 +82,7 @@ class CVE: # happily clones into an empty directory. os.makedirs(nvd_git_dir) subprocess.check_call( - ["git", "clone", NVD_BASE_URL, nvd_git_dir], + ["git", "clone", "--depth", "1", NVD_BASE_URL, nvd_git_dir], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, )