summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorPaulo Neves <ptsneves@gmail.com>2018-08-27 21:38:59 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-10 13:26:25 +0100
commit36d5cee56bd389ecbe66dbfad9e5d57c13b56b95 (patch)
tree17a514bccce41f5b8d77b7d3657021264bb41741 /bitbake/lib/bb/fetch2/git.py
parent2974054b4579e61a91c9d10ef0b394db78583183 (diff)
downloadpoky-36d5cee56bd389ecbe66dbfad9e5d57c13b56b95.tar.gz
bitbake: fetcher: Fixed remote removal not throwing exception.
Before this fix it is assumed that the removal of the remote can only fail because there is not remote to remove. This is a false assumption. Example error which would be ignored: git -c core.fsyncobjectfiles=0 remote rm origin failed with exit code 1, output: Note: A branch outside the refs/remotes/ hierarchy was not removed; to delete it, use: git branch -d master error: could not lock config file config error: Could not remove config section 'remote.origin' Due to the masking of this error a stranger error will be presented to the user, because this time we do not mask the exception: git -c core.fsyncobjectfiles=0 remote add --mirror=fetch origin https://github.com/ptsneves/tl-wn722.git failed with exit code 128, output: fatal: remote origin already exists. The most likely reason that the remote cannot be removed nor modified is that the DL_DIR/git2 does not have permissions compatible with the user running bitbake. This commit fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=12728 (Bitbake rev: 67189588a68b9bcb39421ef12103507b4c8820c3) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 3de83bed17..7b618c6fb1 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -354,10 +354,9 @@ class Git(FetchMethod):
354 if not self._contains_ref(ud, d, name, ud.clonedir): 354 if not self._contains_ref(ud, d, name, ud.clonedir):
355 needupdate = True 355 needupdate = True
356 if needupdate: 356 if needupdate:
357 try: 357 output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir)
358 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) 358 if "origin" in output:
359 except bb.fetch2.FetchError: 359 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
360 logger.debug(1, "No Origin")
361 360
362 runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir) 361 runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir)
363 fetch_cmd = "LANG=C %s fetch -f --prune --progress %s refs/*:refs/*" % (ud.basecmd, repourl) 362 fetch_cmd = "LANG=C %s fetch -f --prune --progress %s refs/*:refs/*" % (ud.basecmd, repourl)