1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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>
This commit is contained in:
Frederic Martinsons
2023-03-15 14:40:29 +01:00
committed by Richard Purdie
parent dc2ac3ca4f
commit ee5e6a86fd
2 changed files with 30 additions and 3 deletions
+24
View File
@@ -2384,6 +2384,30 @@ class CrateTest(FetcherTest):
self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/.cargo-checksum.json"))
self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/src/lib.rs"))
@skipIfNoNetwork()
def test_crate_url_params(self):
uri = "crate://crates.io/aho-corasick/0.7.20;name=aho-corasick-renamed"
self.d.setVar('SRC_URI', uri)
uris = self.d.getVar('SRC_URI').split()
d = self.d
fetcher = bb.fetch2.Fetch(uris, self.d)
ud = fetcher.ud[fetcher.urls[0]]
self.assertIn("name", ud.parm)
self.assertEqual(ud.parm["name"], "aho-corasick-renamed")
self.assertIn("downloadfilename", ud.parm)
self.assertEqual(ud.parm["downloadfilename"], "aho-corasick-0.7.20.crate")
fetcher.download()
fetcher.unpack(self.tempdir)
self.assertEqual(sorted(os.listdir(self.tempdir)), ['cargo_home', 'download' , 'unpacked'])
self.assertEqual(sorted(os.listdir(self.tempdir + "/download")), ['aho-corasick-0.7.20.crate', 'aho-corasick-0.7.20.crate.done'])
self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/aho-corasick-0.7.20/.cargo-checksum.json"))
self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/aho-corasick-0.7.20/src/lib.rs"))
@skipIfNoNetwork()
def test_crate_url_multi(self):