diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-04-19 22:02:49 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-04-19 22:02:49 +0300 |
commit | 36caa12533da01d4319c5ffe7613711a0ec7dea7 (patch) | |
tree | 591c2077bb14cfd9d23893d32cca71fa7a01bc9c /poky/bitbake/lib/bb/tests/fetch.py | |
parent | 12bef3e1bf292dec5ac15af9fb41e86f7bcfb0cb (diff) | |
parent | 3cec7f5a630c1ddcad058eb76e1f732a5fa20d59 (diff) | |
download | openbmc-36caa12533da01d4319c5ffe7613711a0ec7dea7.tar.xz |
Merge tag '0.45' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'poky/bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | poky/bitbake/lib/bb/tests/fetch.py | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/poky/bitbake/lib/bb/tests/fetch.py b/poky/bitbake/lib/bb/tests/fetch.py index 1452d7615..7b2dac7b8 100644 --- a/poky/bitbake/lib/bb/tests/fetch.py +++ b/poky/bitbake/lib/bb/tests/fetch.py @@ -87,6 +87,25 @@ class URITest(unittest.TestCase): }, 'relative': False }, + # Check that trailing semicolons are handled correctly + "http://www.example.org/index.html?qparam1=qvalue1;param2=value2;" : { + 'uri': 'http://www.example.org/index.html?qparam1=qvalue1;param2=value2', + 'scheme': 'http', + 'hostname': 'www.example.org', + 'port': None, + 'hostport': 'www.example.org', + 'path': '/index.html', + 'userinfo': '', + 'username': '', + 'password': '', + 'params': { + 'param2': 'value2' + }, + 'query': { + 'qparam1': 'qvalue1' + }, + 'relative': False + }, "http://www.example.com:8080/index.html" : { 'uri': 'http://www.example.com:8080/index.html', 'scheme': 'http', @@ -2089,13 +2108,14 @@ class GitLfsTest(FetcherTest): cwd = self.gitdir return bb.process.run(cmd, cwd=cwd)[0] - def fetch(self, uri=None): + def fetch(self, uri=None, download=True): uris = self.d.getVar('SRC_URI').split() uri = uris[0] d = self.d fetcher = bb.fetch2.Fetch(uris, d) - fetcher.download() + if download: + fetcher.download() ud = fetcher.ud[uri] return fetcher, ud @@ -2105,16 +2125,21 @@ class GitLfsTest(FetcherTest): uri = 'git://%s;protocol=file;subdir=${S};lfs=1' % self.srcdir self.d.setVar('SRC_URI', uri) - fetcher, ud = self.fetch() + # Careful: suppress initial attempt at downloading until + # we know whether git-lfs is installed. + fetcher, ud = self.fetch(uri=None, download=False) self.assertIsNotNone(ud.method._find_git_lfs) - # If git-lfs can be found, the unpack should be successful - ud.method._find_git_lfs = lambda d: True - shutil.rmtree(self.gitdir, ignore_errors=True) - fetcher.unpack(self.d.getVar('WORKDIR')) + # If git-lfs can be found, the unpack should be successful. Only + # attempt this with the real live copy of git-lfs installed. + if ud.method._find_git_lfs(self.d): + fetcher.download() + shutil.rmtree(self.gitdir, ignore_errors=True) + fetcher.unpack(self.d.getVar('WORKDIR')) # If git-lfs cannot be found, the unpack should throw an error with self.assertRaises(bb.fetch2.FetchError): + fetcher.download() ud.method._find_git_lfs = lambda d: False shutil.rmtree(self.gitdir, ignore_errors=True) fetcher.unpack(self.d.getVar('WORKDIR')) @@ -2125,10 +2150,16 @@ class GitLfsTest(FetcherTest): uri = 'git://%s;protocol=file;subdir=${S};lfs=0' % self.srcdir self.d.setVar('SRC_URI', uri) + # In contrast to test_lfs_enabled(), allow the implicit download + # done by self.fetch() to occur here. The point of this test case + # is to verify that the fetcher can survive even if the source + # repository has Git LFS usage configured. fetcher, ud = self.fetch() self.assertIsNotNone(ud.method._find_git_lfs) - # If git-lfs can be found, the unpack should be successful + # If git-lfs can be found, the unpack should be successful. A + # live copy of git-lfs is not required for this case, so + # unconditionally forge its presence. ud.method._find_git_lfs = lambda d: True shutil.rmtree(self.gitdir, ignore_errors=True) fetcher.unpack(self.d.getVar('WORKDIR')) |