summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2019-01-26 20:04:23 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-28 23:14:27 +0000
commita7774aced031de1c8e42d0559182e802df8bcaa8 (patch)
tree4095835e9b15703cfb3f952819ef56e227b68dad
parent99fc8d54d6b42278b15502f6cd3aa6b9b183abcf (diff)
downloadpoky-a7774aced031de1c8e42d0559182e802df8bcaa8.tar.gz
bitbake: gitsm: The fetcher did not process some recursive submodules properly.
Move the submodule processing outside of the if statement to avoid any optimizations that may happen. Update the test cases to include the additional case, and split the other test cases into individual tests to make it easier to figure out what the failure may be. (Bitbake rev: 0ec98c01ae50f95c9c74acf53013ac59e0e72b08) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/gitsm.py4
-rw-r--r--bitbake/lib/bb/tests/fetch.py20
2 files changed, 23 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index f45546b49b..b21fed2669 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -198,6 +198,8 @@ class GitSM(Git):
198 198
199 Git.unpack(self, ud, destdir, d) 199 Git.unpack(self, ud, destdir, d)
200 200
201 if not ud.bareclone and self.process_submodules(ud, ud.destdir, unpack_submodules, d): 201 ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d)
202
203 if not ud.bareclone and ret:
202 # Run submodule update, this sets up the directories -- without touching the config 204 # Run submodule update, this sets up the directories -- without touching the config
203 runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir) 205 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 e9ad807677..522d2024fa 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -912,6 +912,7 @@ class FetcherNetworkTest(FetcherTest):
912 if os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1')): 912 if os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1')):
913 self.assertTrue(os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1', 'bitbake')), msg='submodule of submodule missing') 913 self.assertTrue(os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1', 'bitbake')), msg='submodule of submodule missing')
914 914
915 def test_git_submodule_dbus_broker(self):
915 # The following external repositories have show failures in fetch and unpack operations 916 # The following external repositories have show failures in fetch and unpack operations
916 # We want to avoid regressions! 917 # We want to avoid regressions!
917 url = "gitsm://github.com/bus1/dbus-broker;protocol=git;rev=fc874afa0992d0c75ec25acb43d344679f0ee7d2" 918 url = "gitsm://github.com/bus1/dbus-broker;protocol=git;rev=fc874afa0992d0c75ec25acb43d344679f0ee7d2"
@@ -928,16 +929,35 @@ class FetcherNetworkTest(FetcherTest):
928 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/subprojects/c-sundry/config')), msg='Missing submodule config "subprojects/c-sundry"') 929 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/subprojects/c-sundry/config')), msg='Missing submodule config "subprojects/c-sundry"')
929 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/subprojects/c-utf8/config')), msg='Missing submodule config "subprojects/c-utf8"') 930 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/subprojects/c-utf8/config')), msg='Missing submodule config "subprojects/c-utf8"')
930 931
932 def test_git_submodule_CLI11(self):
931 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf" 933 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf"
932 fetcher = bb.fetch.Fetch([url], self.d) 934 fetcher = bb.fetch.Fetch([url], self.d)
933 fetcher.download() 935 fetcher.download()
934 # Previous cwd has been deleted 936 # Previous cwd has been deleted
935 os.chdir(os.path.dirname(self.unpackdir)) 937 os.chdir(os.path.dirname(self.unpackdir))
936 fetcher.unpack(self.unpackdir) 938 fetcher.unpack(self.unpackdir)
939
940 repo_path = os.path.join(self.tempdir, 'unpacked', 'git')
937 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/extern/googletest/config')), msg='Missing submodule config "extern/googletest"') 941 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/extern/googletest/config')), msg='Missing submodule config "extern/googletest"')
938 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/extern/json/config')), msg='Missing submodule config "extern/json"') 942 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/extern/json/config')), msg='Missing submodule config "extern/json"')
939 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/extern/sanitizers/config')), msg='Missing submodule config "extern/sanitizers"') 943 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/extern/sanitizers/config')), msg='Missing submodule config "extern/sanitizers"')
940 944
945 def test_git_submodule_aktualizr(self):
946 url = "gitsm://github.com/advancedtelematic/aktualizr;branch=master;protocol=git;rev=d00d1a04cc2366d1a5f143b84b9f507f8bd32c44"
947 fetcher = bb.fetch.Fetch([url], self.d)
948 fetcher.download()
949 # Previous cwd has been deleted
950 os.chdir(os.path.dirname(self.unpackdir))
951 fetcher.unpack(self.unpackdir)
952
953 repo_path = os.path.join(self.tempdir, 'unpacked', 'git')
954 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/partial/extern/isotp-c/config')), msg='Missing submodule config "partial/extern/isotp-c/config"')
955 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/partial/extern/isotp-c/modules/deps/bitfield-c/config')), msg='Missing submodule config "partial/extern/isotp-c/modules/deps/bitfield-c/config"')
956 self.assertTrue(os.path.exists(os.path.join(repo_path, 'partial/extern/isotp-c/deps/bitfield-c/.git')), msg="Submodule of submodule isotp-c did not unpack properly")
957 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/tests/tuf-test-vectors/config')), msg='Missing submodule config "tests/tuf-test-vectors/config"')
958 self.assertTrue(os.path.exists(os.path.join(repo_path, '.git/modules/third_party/googletest/config')), msg='Missing submodule config "third_party/googletest/config"')
959 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"')
960
941class TrustedNetworksTest(FetcherTest): 961class TrustedNetworksTest(FetcherTest):
942 def test_trusted_network(self): 962 def test_trusted_network(self):
943 # Ensure trusted_network returns False when the host IS in the list. 963 # Ensure trusted_network returns False when the host IS in the list.