[oe-commits] [bitbake] 10/10: fetcher: Fixed remote removal not throwing exception.

git at git.openembedded.org git at git.openembedded.org
Mon Aug 27 23:05:31 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 9c86c582a10c9b23abad7d34b6cbf12f7086294d
Author: Paulo Neves <ptsneves at gmail.com>
AuthorDate: Mon Aug 27 21:38:59 2018 +0200

    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
    
    Signed-off-by: Paulo Neves <ptsneves at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 612aac4..35da14d 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list