[oe-commits] [bitbake] 09/11: fetch2/gitsm: handle submodules nested inside subdirs

git at git.openembedded.org git at git.openembedded.org
Thu Oct 4 13:34:52 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 3dbc84e9c572f43209b79f3656d7dc35a6d982ba
Author: Laurent Bonnans <laurent.bonnans at here.com>
AuthorDate: Mon Oct 1 16:52:13 2018 +0200

    fetch2/gitsm: handle submodules nested inside subdirs
    
    The new gitsm fetcher assumed that submodules were living directly in
    the 'modules' directory, whereas they can be arbitrarily nested inside
    subdirectories.
    
    Solve it by first creating the parent of the destination directory for
    the symlink and copy steps.
    
    Signed-off-by: Laurent Bonnans <laurent.bonnans at here.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/gitsm.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
index 0cdc830..fd5089c 100644
--- a/lib/bb/fetch2/gitsm.py
+++ b/lib/bb/fetch2/gitsm.py
@@ -98,12 +98,14 @@ class GitSM(Git):
 
             # Correct the submodule references to the local download version...
             runfetchcmd("%(basecmd)s config submodule.%(module)s.url %(url)s" % {'basecmd': ud.basecmd, 'module': module, 'url' : local_paths[module]}, d, workdir=ud.clonedir)
-            try:
-                os.mkdir(os.path.join(ud.clonedir, 'modules'))
-            except OSError:
-                pass
-            if not os.path.exists(os.path.join(ud.clonedir, 'modules', paths[module])):
-                os.symlink(local_paths[module], os.path.join(ud.clonedir, 'modules', paths[module]))
+
+            symlink_path = os.path.join(ud.clonedir, 'modules', paths[module])
+            if not os.path.exists(symlink_path):
+                try:
+                    os.makedirs(os.path.dirname(symlink_path), exist_ok=True)
+                except OSError:
+                    pass
+                os.symlink(local_paths[module], symlink_path)
 
         return True
 
@@ -148,6 +150,7 @@ class GitSM(Git):
                 if os.path.exists(modpath):
                     target = os.path.dirname(modpath)
 
+                os.makedirs(os.path.dirname(target), exist_ok=True)
                 runfetchcmd("cp -fpLR %s %s" % (srcpath, target), d)
             elif os.path.exists(modpath):
                 # Module already exists, likely unpacked from a shallow mirror clone

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


More information about the Openembedded-commits mailing list