From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: linux-amarula@amarulasolutions.com, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH V2 2/2] scripts/cve: Restart the clone if the pull generate an exception
Date: Tue, 3 Sep 2024 20:52:16 +0200 [thread overview]
Message-ID: <20240903205216.09ea5f17@windsurf> (raw)
In-Reply-To: <20240903085745.2594893-2-michael@amarulasolutions.com>
On Tue, 3 Sep 2024 10:57:45 +0200
Michael Trimarchi <michael@amarulasolutions.com> wrote:
> diff --git a/support/scripts/cve.py b/support/scripts/cve.py
> index dcb3a63925..6cd9aab963 100755
> --- a/support/scripts/cve.py
> +++ b/support/scripts/cve.py
> @@ -21,6 +21,7 @@ import datetime
> import os
> import distutils.version
> import json
> +import shutil
> import subprocess
> import sys
> import operator
> @@ -69,15 +70,21 @@ class CVE:
>
> @staticmethod
> def download_nvd(nvd_git_dir):
> + done = False
> print(f"Updating from {NVD_BASE_URL}")
> if os.path.exists(nvd_git_dir):
> - subprocess.check_call(
> - ["git", "pull", "--depth", "1"],
> - cwd=nvd_git_dir,
> - stdout=subprocess.DEVNULL,
> - stderr=subprocess.DEVNULL,
> - )
> - else:
> + try:
> + subprocess.check_call(
> + ["git", "pull", "--depth", "1"],
> + cwd=nvd_git_dir,
> + stdout=subprocess.DEVNULL,
> + stderr=subprocess.DEVNULL,
> + )
> + done = True
> + except:
> + shutil.rmtree(nvd_git_dir)
The thing I'm worried about is that you can also get a failure of "git
pull" for example due to a network timeout or something like that,
which doesn't need a full git clone, but just a "try again" later...
and now we're going to wipe out the entire local clone, and try to
clone everything again. Is that a good idea?
Also, perhaps we need to show an error message if the "git pull"
failed, and saying we're falling back to a full clone, or something?
> + if (not done):
if not done:
is sufficient, we are not writing C code here :-)
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-09-03 18:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240903205216.09ea5f17@windsurf \
--to=buildroot@buildroot.org \
--cc=linux-amarula@amarulasolutions.com \
--cc=michael@amarulasolutions.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.