diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-19 14:13:48 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-19 23:03:43 +0000 |
commit | 12c76723fb65437a3439d2c1f429ae73a00edc4b (patch) | |
tree | 3b9a6bfe4b5a5836f684ac3b55e22389133dd23b /bitbake/lib/bb/tests/fetch.py | |
parent | e222be06386698e24c664171bd6a1ea07bf28efa (diff) | |
download | poky-12c76723fb65437a3439d2c1f429ae73a00edc4b.tar.gz |
bitbake: fetch2: Add crate fetcher
This imports the crate fetcher from OE-Core to resolve various module issues
and adds some very very basic tests of that new fetcher.
(Bitbake rev: 1f06f326fa8b47e2a4dce756d57a9369a2225201)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 2a046d0ded..ec7d83c959 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -2260,6 +2260,41 @@ class GitURLWithSpacesTest(FetcherTest): | |||
2260 | self.assertEqual(ud.clonedir, os.path.join(self.dldir, "git2", ref['gitsrcname'])) | 2260 | self.assertEqual(ud.clonedir, os.path.join(self.dldir, "git2", ref['gitsrcname'])) |
2261 | self.assertEqual(ud.fullmirror, os.path.join(self.dldir, "git2_" + ref['gitsrcname'] + '.tar.gz')) | 2261 | self.assertEqual(ud.fullmirror, os.path.join(self.dldir, "git2_" + ref['gitsrcname'] + '.tar.gz')) |
2262 | 2262 | ||
2263 | class CrateTest(FetcherTest): | ||
2264 | def test_crate_url(self): | ||
2265 | |||
2266 | uri = "crate://crates.io/glob/0.2.11" | ||
2267 | self.d.setVar('SRC_URI', uri) | ||
2268 | |||
2269 | uris = self.d.getVar('SRC_URI').split() | ||
2270 | d = self.d | ||
2271 | |||
2272 | fetcher = bb.fetch2.Fetch(uris, self.d) | ||
2273 | fetcher.download() | ||
2274 | fetcher.unpack(self.tempdir) | ||
2275 | self.assertEqual(sorted(os.listdir(self.tempdir)), ['cargo_home', 'download' , 'unpacked']) | ||
2276 | self.assertEqual(sorted(os.listdir(self.tempdir + "/download")), ['glob-0.2.11.crate', 'glob-0.2.11.crate.done']) | ||
2277 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/.cargo-checksum.json")) | ||
2278 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/src/lib.rs")) | ||
2279 | |||
2280 | def test_crate_url_multi(self): | ||
2281 | |||
2282 | uri = "crate://crates.io/glob/0.2.11 crate://crates.io/time/0.1.35" | ||
2283 | self.d.setVar('SRC_URI', uri) | ||
2284 | |||
2285 | uris = self.d.getVar('SRC_URI').split() | ||
2286 | d = self.d | ||
2287 | |||
2288 | fetcher = bb.fetch2.Fetch(uris, self.d) | ||
2289 | fetcher.download() | ||
2290 | fetcher.unpack(self.tempdir) | ||
2291 | self.assertEqual(sorted(os.listdir(self.tempdir)), ['cargo_home', 'download' , 'unpacked']) | ||
2292 | self.assertEqual(sorted(os.listdir(self.tempdir + "/download")), ['glob-0.2.11.crate', 'glob-0.2.11.crate.done', 'time-0.1.35.crate', 'time-0.1.35.crate.done']) | ||
2293 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/.cargo-checksum.json")) | ||
2294 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/src/lib.rs")) | ||
2295 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/time-0.1.35/.cargo-checksum.json")) | ||
2296 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/time-0.1.35/src/lib.rs")) | ||
2297 | |||
2263 | class NPMTest(FetcherTest): | 2298 | class NPMTest(FetcherTest): |
2264 | def skipIfNoNpm(): | 2299 | def skipIfNoNpm(): |
2265 | import shutil | 2300 | import shutil |