* [Buildroot] [PATCH] download/git: more resilient in case of kill
@ 2018-04-09 21:41 Yann E. MORIN
2018-04-09 21:45 ` Thomas Petazzoni
0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2018-04-09 21:41 UTC (permalink / raw)
To: buildroot
In case the git backend gets killed right in-between it finished
initialising the repository, but before it could add the remote,
we'd end up with a repository without the 'origin' remote, so we
would not be able to change its URL.
Another case that may happen (like in the build failure, below),
is that the repository was initialised with a previous version
of Buildroot, before the commit e17719264b (download/git: don't
require too-recent git) was applied, and that trepository was
still lying around...
Fixes:
http://autobuild.buildroot.org/results/25a/25aae054634368fadb265b97ebe4dda809deff6f/
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
---
support/download/git | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/support/download/git b/support/download/git
index 868dfad0dd..ee6c18a3ec 100755
--- a/support/download/git
+++ b/support/download/git
@@ -47,13 +47,17 @@ git_cache="${dl_dir}/git"
# fetch'ed later.
if [ ! -d "${git_cache}" ]; then
_git init "'${git_cache}'"
+fi
+
+pushd "${git_cache}" >/dev/null
+
+# Ensure the repo has an origin (in case a previous run was killed).
+if git remote |grep -q -E '^origin$'
pushd "${git_cache}" >/dev/null
_git remote add origin "'${uri}'"
popd >/dev/null
fi
-pushd "${git_cache}" >/dev/null
-
_git remote set-url origin "'${uri}'"
# Try to fetch with limited depth, since it is faster than a full clone - but
--
2.14.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Buildroot] [PATCH] download/git: more resilient in case of kill
2018-04-09 21:41 [Buildroot] [PATCH] download/git: more resilient in case of kill Yann E. MORIN
@ 2018-04-09 21:45 ` Thomas Petazzoni
2018-04-09 21:56 ` Yann E. MORIN
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2018-04-09 21:45 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 9 Apr 2018 23:41:55 +0200, Yann E. MORIN wrote:
> +pushd "${git_cache}" >/dev/null
So you're doing the pushd here now.
> +
> +# Ensure the repo has an origin (in case a previous run was killed).
> +if git remote |grep -q -E '^origin$'
> pushd "${git_cache}" >/dev/null
And therefore I'm not sure why it's needed here...
> _git remote add origin "'${uri}'"
> popd >/dev/null
... and this popd would no longer be needed.
> fi
>
> -pushd "${git_cache}" >/dev/null
I am missing something?
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread* [Buildroot] [PATCH] download/git: more resilient in case of kill
2018-04-09 21:45 ` Thomas Petazzoni
@ 2018-04-09 21:56 ` Yann E. MORIN
0 siblings, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2018-04-09 21:56 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2018-04-09 23:45 +0200, Thomas Petazzoni spake thusly:
> Hello,
>
> On Mon, 9 Apr 2018 23:41:55 +0200, Yann E. MORIN wrote:
>
> > +pushd "${git_cache}" >/dev/null
>
> So you're doing the pushd here now.
>
> > +
> > +# Ensure the repo has an origin (in case a previous run was killed).
> > +if git remote |grep -q -E '^origin$'
> > pushd "${git_cache}" >/dev/null
>
> And therefore I'm not sure why it's needed here...
>
> > _git remote add origin "'${uri}'"
> > popd >/dev/null
>
> ... and this popd would no longer be needed.
>
> > fi
> >
> > -pushd "${git_cache}" >/dev/null
>
> I am missing something?
Absolutely nothing.
I will respin.
Thanks.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-09 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-09 21:41 [Buildroot] [PATCH] download/git: more resilient in case of kill Yann E. MORIN
2018-04-09 21:45 ` Thomas Petazzoni
2018-04-09 21:56 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox