diff options
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 27 |
2 files changed, 34 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) |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 429998b34f..64cdf3d90c 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -977,6 +977,33 @@ class FetcherNetworkTest(FetcherTest): | |||
977 | self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/third_party/googletest/config')), msg='Missing submodule config "third_party/googletest/config"') | 977 | self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/third_party/googletest/config')), msg='Missing submodule config "third_party/googletest/config"') |
978 | self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/third_party/HdrHistogram_c/config')), msg='Missing submodule config "third_party/HdrHistogram_c/config"') | 978 | self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/third_party/HdrHistogram_c/config')), msg='Missing submodule config "third_party/HdrHistogram_c/config"') |
979 | 979 | ||
980 | def test_git_submodule_iotedge(self): | ||
981 | """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """ | ||
982 | |||
983 | # This repository also has submodules where the module (name), path and url do not align | ||
984 | url = "gitsm://github.com/azure/iotedge.git;protocol=git;rev=d76e0316c6f324345d77c48a83ce836d09392699" | ||
985 | fetcher = bb.fetch.Fetch([url], self.d) | ||
986 | fetcher.download() | ||
987 | # Previous cwd has been deleted | ||
988 | os.chdir(os.path.dirname(self.unpackdir)) | ||
989 | fetcher.unpack(self.unpackdir) | ||
990 | |||
991 | repo_path = os.path.join(self.tempdir, 'unpacked', 'git') | ||
992 | |||
993 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared/README.md')), msg='Missing submodule checkout') | ||
994 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared/testtools/ctest/README.md')), msg='Missing submodule checkout') | ||
995 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared/testtools/testrunner/readme.md')), msg='Missing submodule checkout') | ||
996 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared/testtools/umock-c/readme.md')), msg='Missing submodule checkout') | ||
997 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared/testtools/umock-c/deps/ctest/README.md')), msg='Missing submodule checkout') | ||
998 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/c-shared/testtools/umock-c/deps/testrunner/readme.md')), msg='Missing submodule checkout') | ||
999 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/README.md')), msg='Missing submodule checkout') | ||
1000 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/README.md')), msg='Missing submodule checkout') | ||
1001 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/ctest/README.md')), msg='Missing submodule checkout') | ||
1002 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/testrunner/readme.md')), msg='Missing submodule checkout') | ||
1003 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/umock-c/readme.md')), msg='Missing submodule checkout') | ||
1004 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/umock-c/deps/ctest/README.md')), msg='Missing submodule checkout') | ||
1005 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/umock-c/deps/testrunner/readme.md')), msg='Missing submodule checkout') | ||
1006 | |||
980 | class TrustedNetworksTest(FetcherTest): | 1007 | class TrustedNetworksTest(FetcherTest): |
981 | def test_trusted_network(self): | 1008 | def test_trusted_network(self): |
982 | # Ensure trusted_network returns False when the host IS in the list. | 1009 | # Ensure trusted_network returns False when the host IS in the list. |