diff options
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index da17d7f281..4671532f2b 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -939,7 +939,7 @@ class FetcherNetworkTest(FetcherTest): | |||
939 | 939 | ||
940 | @skipIfNoNetwork() | 940 | @skipIfNoNetwork() |
941 | def test_git_submodule_CLI11(self): | 941 | def test_git_submodule_CLI11(self): |
942 | url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf" | 942 | url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf;branch=main" |
943 | fetcher = bb.fetch.Fetch([url], self.d) | 943 | fetcher = bb.fetch.Fetch([url], self.d) |
944 | fetcher.download() | 944 | fetcher.download() |
945 | # Previous cwd has been deleted | 945 | # Previous cwd has been deleted |
@@ -954,12 +954,12 @@ class FetcherNetworkTest(FetcherTest): | |||
954 | @skipIfNoNetwork() | 954 | @skipIfNoNetwork() |
955 | def test_git_submodule_update_CLI11(self): | 955 | def test_git_submodule_update_CLI11(self): |
956 | """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """ | 956 | """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """ |
957 | url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714" | 957 | url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714;branch=main" |
958 | fetcher = bb.fetch.Fetch([url], self.d) | 958 | fetcher = bb.fetch.Fetch([url], self.d) |
959 | fetcher.download() | 959 | fetcher.download() |
960 | 960 | ||
961 | # CLI11 that pulls in a newer nlohmann-json | 961 | # CLI11 that pulls in a newer nlohmann-json |
962 | url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca" | 962 | url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca;branch=main" |
963 | fetcher = bb.fetch.Fetch([url], self.d) | 963 | fetcher = bb.fetch.Fetch([url], self.d) |
964 | fetcher.download() | 964 | fetcher.download() |
965 | # Previous cwd has been deleted | 965 | # Previous cwd has been deleted |
@@ -993,7 +993,7 @@ class FetcherNetworkTest(FetcherTest): | |||
993 | """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """ | 993 | """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """ |
994 | 994 | ||
995 | # This repository also has submodules where the module (name), path and url do not align | 995 | # This repository also has submodules where the module (name), path and url do not align |
996 | url = "gitsm://github.com/azure/iotedge.git;protocol=git;rev=d76e0316c6f324345d77c48a83ce836d09392699" | 996 | url = "gitsm://github.com/azure/iotedge.git;protocol=git;rev=d76e0316c6f324345d77c48a83ce836d09392699;branch=main" |
997 | fetcher = bb.fetch.Fetch([url], self.d) | 997 | fetcher = bb.fetch.Fetch([url], self.d) |
998 | fetcher.download() | 998 | fetcher.download() |
999 | # Previous cwd has been deleted | 999 | # Previous cwd has been deleted |
@@ -1180,7 +1180,7 @@ class FetchLatestVersionTest(FetcherTest): | |||
1180 | ("presentproto", "git://git.yoctoproject.org/bbfetchtests-presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "") | 1180 | ("presentproto", "git://git.yoctoproject.org/bbfetchtests-presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "") |
1181 | : "1.0", | 1181 | : "1.0", |
1182 | # version pattern "pkg_name-vX.Y.Z" | 1182 | # version pattern "pkg_name-vX.Y.Z" |
1183 | ("dtc", "git://git.qemu.org/dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "") | 1183 | ("dtc", "git://git.yoctoproject.org/bbfetchtests-dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "") |
1184 | : "1.4.0", | 1184 | : "1.4.0", |
1185 | # combination version pattern | 1185 | # combination version pattern |
1186 | ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https", "cd44ee6644c3641507fb53b8a2a69137f2971219", "") | 1186 | ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https", "cd44ee6644c3641507fb53b8a2a69137f2971219", "") |
@@ -2051,13 +2051,14 @@ class GitLfsTest(FetcherTest): | |||
2051 | cwd = self.gitdir | 2051 | cwd = self.gitdir |
2052 | return bb.process.run(cmd, cwd=cwd)[0] | 2052 | return bb.process.run(cmd, cwd=cwd)[0] |
2053 | 2053 | ||
2054 | def fetch(self, uri=None): | 2054 | def fetch(self, uri=None, download=True): |
2055 | uris = self.d.getVar('SRC_URI').split() | 2055 | uris = self.d.getVar('SRC_URI').split() |
2056 | uri = uris[0] | 2056 | uri = uris[0] |
2057 | d = self.d | 2057 | d = self.d |
2058 | 2058 | ||
2059 | fetcher = bb.fetch2.Fetch(uris, d) | 2059 | fetcher = bb.fetch2.Fetch(uris, d) |
2060 | fetcher.download() | 2060 | if download: |
2061 | fetcher.download() | ||
2061 | ud = fetcher.ud[uri] | 2062 | ud = fetcher.ud[uri] |
2062 | return fetcher, ud | 2063 | return fetcher, ud |
2063 | 2064 | ||
@@ -2067,16 +2068,21 @@ class GitLfsTest(FetcherTest): | |||
2067 | uri = 'git://%s;protocol=file;subdir=${S};lfs=1' % self.srcdir | 2068 | uri = 'git://%s;protocol=file;subdir=${S};lfs=1' % self.srcdir |
2068 | self.d.setVar('SRC_URI', uri) | 2069 | self.d.setVar('SRC_URI', uri) |
2069 | 2070 | ||
2070 | fetcher, ud = self.fetch() | 2071 | # Careful: suppress initial attempt at downloading until |
2072 | # we know whether git-lfs is installed. | ||
2073 | fetcher, ud = self.fetch(uri=None, download=False) | ||
2071 | self.assertIsNotNone(ud.method._find_git_lfs) | 2074 | self.assertIsNotNone(ud.method._find_git_lfs) |
2072 | 2075 | ||
2073 | # If git-lfs can be found, the unpack should be successful | 2076 | # If git-lfs can be found, the unpack should be successful. Only |
2074 | ud.method._find_git_lfs = lambda d: True | 2077 | # attempt this with the real live copy of git-lfs installed. |
2075 | shutil.rmtree(self.gitdir, ignore_errors=True) | 2078 | if ud.method._find_git_lfs(self.d): |
2076 | fetcher.unpack(self.d.getVar('WORKDIR')) | 2079 | fetcher.download() |
2080 | shutil.rmtree(self.gitdir, ignore_errors=True) | ||
2081 | fetcher.unpack(self.d.getVar('WORKDIR')) | ||
2077 | 2082 | ||
2078 | # If git-lfs cannot be found, the unpack should throw an error | 2083 | # If git-lfs cannot be found, the unpack should throw an error |
2079 | with self.assertRaises(bb.fetch2.FetchError): | 2084 | with self.assertRaises(bb.fetch2.FetchError): |
2085 | fetcher.download() | ||
2080 | ud.method._find_git_lfs = lambda d: False | 2086 | ud.method._find_git_lfs = lambda d: False |
2081 | shutil.rmtree(self.gitdir, ignore_errors=True) | 2087 | shutil.rmtree(self.gitdir, ignore_errors=True) |
2082 | fetcher.unpack(self.d.getVar('WORKDIR')) | 2088 | fetcher.unpack(self.d.getVar('WORKDIR')) |
@@ -2087,10 +2093,16 @@ class GitLfsTest(FetcherTest): | |||
2087 | uri = 'git://%s;protocol=file;subdir=${S};lfs=0' % self.srcdir | 2093 | uri = 'git://%s;protocol=file;subdir=${S};lfs=0' % self.srcdir |
2088 | self.d.setVar('SRC_URI', uri) | 2094 | self.d.setVar('SRC_URI', uri) |
2089 | 2095 | ||
2096 | # In contrast to test_lfs_enabled(), allow the implicit download | ||
2097 | # done by self.fetch() to occur here. The point of this test case | ||
2098 | # is to verify that the fetcher can survive even if the source | ||
2099 | # repository has Git LFS usage configured. | ||
2090 | fetcher, ud = self.fetch() | 2100 | fetcher, ud = self.fetch() |
2091 | self.assertIsNotNone(ud.method._find_git_lfs) | 2101 | self.assertIsNotNone(ud.method._find_git_lfs) |
2092 | 2102 | ||
2093 | # If git-lfs can be found, the unpack should be successful | 2103 | # If git-lfs can be found, the unpack should be successful. A |
2104 | # live copy of git-lfs is not required for this case, so | ||
2105 | # unconditionally forge its presence. | ||
2094 | ud.method._find_git_lfs = lambda d: True | 2106 | ud.method._find_git_lfs = lambda d: True |
2095 | shutil.rmtree(self.gitdir, ignore_errors=True) | 2107 | shutil.rmtree(self.gitdir, ignore_errors=True) |
2096 | fetcher.unpack(self.d.getVar('WORKDIR')) | 2108 | fetcher.unpack(self.d.getVar('WORKDIR')) |