Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH V2 1/2] scripts/cve: Avoid to do a complete clone of cve git repository
@ 2024-09-03  8:57 Michael Trimarchi
  2024-09-03  8:57 ` [Buildroot] [PATCH V2 2/2] scripts/cve: Restart the clone if the pull generate an exception Michael Trimarchi
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michael Trimarchi @ 2024-09-03  8:57 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Trimarchi, linux-amarula

Just a simple clone and pull with --depth 1 should be enough to parse the
cve 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 <michael@amarulasolutions.com>
---
V1->V2:
    - Add statistics from Yann E. Morin
    - Use git pull --depth 1 for update the repo

---
 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,
             )
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-09-12 10:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03  8:57 [Buildroot] [PATCH V2 1/2] scripts/cve: Avoid to do a complete clone of cve git repository Michael Trimarchi
2024-09-03  8:57 ` [Buildroot] [PATCH V2 2/2] scripts/cve: Restart the clone if the pull generate an exception Michael Trimarchi
2024-09-03 18:52   ` Thomas Petazzoni via buildroot
2024-09-03 18:55     ` Michael Nazzareno Trimarchi
2024-09-03 18:50 ` [Buildroot] [PATCH V2 1/2] scripts/cve: Avoid to do a complete clone of cve git repository Thomas Petazzoni via buildroot
2024-09-03 19:24   ` Yann E. MORIN
2024-09-03 19:34     ` Michael Nazzareno Trimarchi
2024-09-12 10:44 ` Thomas Petazzoni via buildroot
2024-09-12 10:48   ` Michael Nazzareno Trimarchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox