diff options
author | Laurent Bonnans <laurent.bonnans@here.com> | 2018-10-01 16:52:13 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-04 23:00:24 +0100 |
commit | c888446d1229b21bdf428332e8515bd92449b538 (patch) | |
tree | 1193802acb8d18c43b3d9a54d7669d2bde8f2c71 /bitbake | |
parent | fa8ade3695b836fb788c57c0d56b546b47f1603a (diff) | |
download | poky-c888446d1229b21bdf428332e8515bd92449b538.tar.gz |
bitbake: 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.
(Bitbake rev: 3dbc84e9c572f43209b79f3656d7dc35a6d982ba)
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index 0cdc8301d1..fd5089c075 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py | |||
@@ -98,12 +98,14 @@ class GitSM(Git): | |||
98 | 98 | ||
99 | # Correct the submodule references to the local download version... | 99 | # Correct the submodule references to the local download version... |
100 | runfetchcmd("%(basecmd)s config submodule.%(module)s.url %(url)s" % {'basecmd': ud.basecmd, 'module': module, 'url' : local_paths[module]}, d, workdir=ud.clonedir) | 100 | runfetchcmd("%(basecmd)s config submodule.%(module)s.url %(url)s" % {'basecmd': ud.basecmd, 'module': module, 'url' : local_paths[module]}, d, workdir=ud.clonedir) |
101 | try: | 101 | |
102 | os.mkdir(os.path.join(ud.clonedir, 'modules')) | 102 | symlink_path = os.path.join(ud.clonedir, 'modules', paths[module]) |
103 | except OSError: | 103 | if not os.path.exists(symlink_path): |
104 | pass | 104 | try: |
105 | if not os.path.exists(os.path.join(ud.clonedir, 'modules', paths[module])): | 105 | os.makedirs(os.path.dirname(symlink_path), exist_ok=True) |
106 | os.symlink(local_paths[module], os.path.join(ud.clonedir, 'modules', paths[module])) | 106 | except OSError: |
107 | pass | ||
108 | os.symlink(local_paths[module], symlink_path) | ||
107 | 109 | ||
108 | return True | 110 | return True |
109 | 111 | ||
@@ -148,6 +150,7 @@ class GitSM(Git): | |||
148 | if os.path.exists(modpath): | 150 | if os.path.exists(modpath): |
149 | target = os.path.dirname(modpath) | 151 | target = os.path.dirname(modpath) |
150 | 152 | ||
153 | os.makedirs(os.path.dirname(target), exist_ok=True) | ||
151 | runfetchcmd("cp -fpLR %s %s" % (srcpath, target), d) | 154 | runfetchcmd("cp -fpLR %s %s" % (srcpath, target), d) |
152 | elif os.path.exists(modpath): | 155 | elif os.path.exists(modpath): |
153 | # Module already exists, likely unpacked from a shallow mirror clone | 156 | # Module already exists, likely unpacked from a shallow mirror clone |