[oe-commits] [bitbake] 01/02: fetch2/git: Fix clean to remove clonedir

git at git.openembedded.org git at git.openembedded.org
Thu Mar 21 23:42:52 UTC 2019


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

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

commit 452e2200ad2c29dec3753f5f7a8cbc9183ec7dd8
Author: Robert Yang <liezhi.yang at windriver.com>
AuthorDate: Thu Mar 14 17:28:17 2019 +0800

    fetch2/git: Fix clean to remove clonedir
    
    The localpath is a symlink to clonedir when it is cloned from a mirror, for
    example:
    $ bitbake systemtap-native -cfetch
    $ ls downloads/git2
    sourceware.org.git.systemtap.git -> /path/to/downloads/git2/mirror.path.git.sourceware.org.git.systemtap.git
    mirror.path.git.sourceware.org.git.systemtap.git
    
    There are both sourceware.org.git.systemtap.git and
    mirror.path.git.sourceware.org.git.systemtap.git in DL_DIR/git2, the symlink
    sourceware.org.git.systemtap.git is created by try_mirror_url(), but
    do_cleanall" only removed the symlink, didn't remove the real dir
    mirror.path.git.sourceware.org.git.systemtap.git, this may cause confusions,
    for example, I assumed that do_cleanall removed everything, but it didn't, and
    it would the re-used next time when do_fetch. This patch fixes the problem.
    
    Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 1a8ebe3..cf8bee7 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -522,9 +522,17 @@ class Git(FetchMethod):
     def clean(self, ud, d):
         """ clean the git directory """
 
-        bb.utils.remove(ud.localpath, True)
-        bb.utils.remove(ud.fullmirror)
-        bb.utils.remove(ud.fullmirror + ".done")
+        to_remove = [ud.localpath, ud.fullmirror, ud.fullmirror + ".done"]
+        # The localpath is a symlink to clonedir when it is cloned from a
+        # mirror, so remove both of them.
+        if os.path.islink(ud.localpath):
+            clonedir = os.path.realpath(ud.localpath)
+            to_remove.append(clonedir)
+
+        for r in to_remove:
+            if os.path.exists(r):
+                bb.note('Removing %s' % r)
+                bb.utils.remove(r, True)
 
     def supports_srcrev(self):
         return True

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


More information about the Openembedded-commits mailing list