summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2019-05-15 07:53:20 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-18 11:43:22 +0100
commit12a8a51e960d4ce31a64f5a7dc02c201238e760c (patch)
tree22a5c4dac6d924ca99007f575ba0127d33fac8a2 /bitbake/lib/bb/fetch2
parent33f9b99a47cc2ecf80e8d3258a68b45cc8116e03 (diff)
downloadpoky-12a8a51e960d4ce31a64f5a7dc02c201238e760c.tar.gz
bitbake: gitsm: Fix a bug where the wrong path was used for the submodule init
Because we are trying to avoid network activity and use our own fetcher, the system emulates the behavior of 'git submodule init'. git submodule init uses the .gitmodules file, where typically the module name and path are the same. However, in this case the module name and path (in the tree) were different. i.e.: [submodule "edgelet/hsm-sys/azure-iot-hsm-c/deps/azure-c-shared-utility"] path = edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared url = https://github.com/Azure/azure-c-shared-utility.git Previously the code assumed the 'path' was both the checkout location under .git/modules, as well as the path to extract the components. This proved to be incorrect as the .git/modules path needs to match the submodule 'name'. This causes the components that were fetched to be initialized in the wrong location, which later caused the 'git submodule update' process to skip not properly initialized modules. A test case was added for this specific case to ensure a regression does not appear in the future. (Bitbake rev: 2a823584a5dbc2427060352f3b4798dbb2640cfd) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/gitsm.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index 32389130bd..a07eb7e7ee 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -129,7 +129,7 @@ class GitSM(Git):
129 129
130 url += ';protocol=%s' % proto 130 url += ';protocol=%s' % proto
131 url += ";name=%s" % module 131 url += ";name=%s" % module
132 url += ";subpath=%s" % paths[module] 132 url += ";subpath=%s" % module
133 133
134 ld = d.createCopy() 134 ld = d.createCopy()
135 # Not necessary to set SRC_URI, since we're passing the URI to 135 # Not necessary to set SRC_URI, since we're passing the URI to
@@ -196,7 +196,7 @@ class GitSM(Git):
196 196
197 try: 197 try:
198 newfetch = Fetch([url], d, cache=False) 198 newfetch = Fetch([url], d, cache=False)
199 newfetch.unpack(root=os.path.dirname(os.path.join(repo_conf, 'modules', modpath))) 199 newfetch.unpack(root=os.path.dirname(os.path.join(repo_conf, 'modules', module)))
200 except Exception as e: 200 except Exception as e:
201 logger.error('gitsm: submodule unpack failed: %s %s' % (type(e).__name__, str(e))) 201 logger.error('gitsm: submodule unpack failed: %s %s' % (type(e).__name__, str(e)))
202 raise 202 raise
@@ -211,9 +211,9 @@ class GitSM(Git):
211 211
212 # Ensure the submodule repository is NOT set to bare, since we're checking it out... 212 # Ensure the submodule repository is NOT set to bare, since we're checking it out...
213 try: 213 try:
214 runfetchcmd("%s config core.bare false" % (ud.basecmd), d, quiet=True, workdir=os.path.join(repo_conf, 'modules', modpath)) 214 runfetchcmd("%s config core.bare false" % (ud.basecmd), d, quiet=True, workdir=os.path.join(repo_conf, 'modules', module))
215 except: 215 except:
216 logger.error("Unable to set git config core.bare to false for %s" % os.path.join(repo_conf, 'modules', modpath)) 216 logger.error("Unable to set git config core.bare to false for %s" % os.path.join(repo_conf, 'modules', module))
217 raise 217 raise
218 218
219 Git.unpack(self, ud, destdir, d) 219 Git.unpack(self, ud, destdir, d)
@@ -221,5 +221,7 @@ class GitSM(Git):
221 ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d) 221 ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d)
222 222
223 if not ud.bareclone and ret: 223 if not ud.bareclone and ret:
224 # Run submodule update, this sets up the directories -- without touching the config 224 # All submodules should already be downloaded and configured in the tree. This simply sets
225 # up the configuration and checks out the files. The main project config should remain
226 # unmodified, and no download from the internet should occur.
225 runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir) 227 runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)