fetcher: Fixed remote removal not throwing exception.
PATCH 1/1 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/lib/bb/fetch2/git.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
bitbake/lib/bb/fetch2/git.py +3 -4
@@ -353,10 +353,9 @@ class Git(FetchMethod): break if needupdate: - try: - runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) - except bb.fetch2.FetchError: - logger.debug(1, "No Origin") + output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir) + if "origin" in output: + runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir) fetch_cmd = "LANG=C %s fetch -f --prune --progress %s refs/*:refs/*" % (ud.basecmd, repourl)
Signature · 1 line
2.7.4
This will try to rm origin even if there's an 'originfoo' remote, as you don't check for an exact match on a line, but a general substring search. Unlikely, I admit, but we should still work as correctly as possible, I think.
Quoted 65 lines · Paulo Neves
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=12728Signed-off-by Paulo Neves <[email protected]>--- bitbake/lib/bb/fetch2/git.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)bitbake/lib/bb/fetch2/git.py +3
-4@@ -353,10 +353,9 @@ class Git(FetchMethod): break if needupdate: - try: - runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) - except bb.fetch2.FetchError: - logger.debug(1, "No Origin") + output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir) + if "origin" in output: + runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir) fetch_cmd = "LANG=C %s fetch -f --prune --progress %srefs/*:refs/*" % (ud.basecmd, repourl)
--
2.7.4--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel
Signature · 4 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics