diff options
author | Frederic Martinsons <frederic.martinsons@gmail.com> | 2023-03-15 14:40:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-17 17:20:05 +0000 |
commit | ee5e6a86fd0d2f81a6a3db4fba7ec5158555e595 (patch) | |
tree | 02ec29c630883b3aa162fd885be55f728b74ad2d /bitbake/lib/bb/tests | |
parent | dc2ac3ca4f8146e8f75682543596639a537e5695 (diff) | |
download | poky-ee5e6a86fd0d2f81a6a3db4fba7ec5158555e595.tar.gz |
bitbake: crate.py: authorize crate url with parameters
This allow to have classic fetch parameters
(like destsuffix, sha256, name ...) not being
considered by crate fetcher itself (and so mess
up its download)
Moreover, it allow to overload the name of the downloaded
crate (maybe usefull if there is a naming clash between
two crates coming from different repositories)
(Bitbake rev: 278bd2f1758b8af97552af8d23d16ffb5127a131)
Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 73eefc5938..1533d52b1e 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -2385,6 +2385,30 @@ class CrateTest(FetcherTest): | |||
2385 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/src/lib.rs")) | 2385 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/src/lib.rs")) |
2386 | 2386 | ||
2387 | @skipIfNoNetwork() | 2387 | @skipIfNoNetwork() |
2388 | def test_crate_url_params(self): | ||
2389 | |||
2390 | uri = "crate://crates.io/aho-corasick/0.7.20;name=aho-corasick-renamed" | ||
2391 | self.d.setVar('SRC_URI', uri) | ||
2392 | |||
2393 | uris = self.d.getVar('SRC_URI').split() | ||
2394 | d = self.d | ||
2395 | |||
2396 | fetcher = bb.fetch2.Fetch(uris, self.d) | ||
2397 | ud = fetcher.ud[fetcher.urls[0]] | ||
2398 | |||
2399 | self.assertIn("name", ud.parm) | ||
2400 | self.assertEqual(ud.parm["name"], "aho-corasick-renamed") | ||
2401 | self.assertIn("downloadfilename", ud.parm) | ||
2402 | self.assertEqual(ud.parm["downloadfilename"], "aho-corasick-0.7.20.crate") | ||
2403 | |||
2404 | fetcher.download() | ||
2405 | fetcher.unpack(self.tempdir) | ||
2406 | self.assertEqual(sorted(os.listdir(self.tempdir)), ['cargo_home', 'download' , 'unpacked']) | ||
2407 | self.assertEqual(sorted(os.listdir(self.tempdir + "/download")), ['aho-corasick-0.7.20.crate', 'aho-corasick-0.7.20.crate.done']) | ||
2408 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/aho-corasick-0.7.20/.cargo-checksum.json")) | ||
2409 | self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/aho-corasick-0.7.20/src/lib.rs")) | ||
2410 | |||
2411 | @skipIfNoNetwork() | ||
2388 | def test_crate_url_multi(self): | 2412 | def test_crate_url_multi(self): |
2389 | 2413 | ||
2390 | uri = "crate://crates.io/glob/0.2.11 crate://crates.io/time/0.1.35" | 2414 | uri = "crate://crates.io/glob/0.2.11 crate://crates.io/time/0.1.35" |