diff options
author | Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | 2023-04-05 14:21:25 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-06 14:28:59 +0100 |
commit | b92918eb0eb25e737e2ad044323a6607c37dab28 (patch) | |
tree | 1ccf671dfdf22dc50c51c9e67726cdef13794a8c /bitbake | |
parent | 08d564bd92fc476d7f0b4a6201b752e51cf93776 (diff) | |
download | poky-b92918eb0eb25e737e2ad044323a6607c37dab28.tar.gz |
bitbake: fetch2/crate: create versioned 'name' entries
It is common for rust packages to depend on different versions of the
same crate. E.g.
| crate://crates.io/windows_x86_64_msvc/0.42.2 \
| crate://crates.io/windows_x86_64_msvc/0.48.0 \
Identification only by the plain crate name makes the sha256sum
ambiguous
| SRC_URI[windows_x86_64_msvc.sha256sum] = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
| SRC_URI[windows_x86_64_msvc.sha256sum] = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
and requires lot of manual work to fix the SRC_URI list.
Making the 'name' property unique by appending the version allows
direct copy & paste of reported sha256sum errors to complete the
crates list.
(Bitbake rev: ae2efb05196f9e29ef56ad9a84e2eae5fbdd8030)
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/crate.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/bitbake/lib/bb/fetch2/crate.py b/bitbake/lib/bb/fetch2/crate.py index 590dc9c126..a7021e5b36 100644 --- a/bitbake/lib/bb/fetch2/crate.py +++ b/bitbake/lib/bb/fetch2/crate.py | |||
@@ -72,7 +72,7 @@ class Crate(Wget): | |||
72 | ud.url = "https://%s/%s/%s/download" % (host, name, version) | 72 | ud.url = "https://%s/%s/%s/download" % (host, name, version) |
73 | ud.parm['downloadfilename'] = "%s-%s.crate" % (name, version) | 73 | ud.parm['downloadfilename'] = "%s-%s.crate" % (name, version) |
74 | if 'name' not in ud.parm: | 74 | if 'name' not in ud.parm: |
75 | ud.parm['name'] = name | 75 | ud.parm['name'] = '%s-%s' % (name, version) |
76 | 76 | ||
77 | logger.debug2("Fetching %s to %s" % (ud.url, ud.parm['downloadfilename'])) | 77 | logger.debug2("Fetching %s to %s" % (ud.url, ud.parm['downloadfilename'])) |
78 | 78 | ||
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index da67168900..6ef0836f2b 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -2380,7 +2380,7 @@ class CrateTest(FetcherTest): | |||
2380 | ud = fetcher.ud[fetcher.urls[0]] | 2380 | ud = fetcher.ud[fetcher.urls[0]] |
2381 | 2381 | ||
2382 | self.assertIn("name", ud.parm) | 2382 | self.assertIn("name", ud.parm) |
2383 | self.assertEqual(ud.parm["name"], "glob") | 2383 | self.assertEqual(ud.parm["name"], "glob-0.2.11") |
2384 | self.assertIn("downloadfilename", ud.parm) | 2384 | self.assertIn("downloadfilename", ud.parm) |
2385 | self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate") | 2385 | self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate") |
2386 | 2386 | ||
@@ -2428,13 +2428,13 @@ class CrateTest(FetcherTest): | |||
2428 | ud = fetcher.ud[fetcher.urls[0]] | 2428 | ud = fetcher.ud[fetcher.urls[0]] |
2429 | 2429 | ||
2430 | self.assertIn("name", ud.parm) | 2430 | self.assertIn("name", ud.parm) |
2431 | self.assertEqual(ud.parm["name"], "glob") | 2431 | self.assertEqual(ud.parm["name"], "glob-0.2.11") |
2432 | self.assertIn("downloadfilename", ud.parm) | 2432 | self.assertIn("downloadfilename", ud.parm) |
2433 | self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate") | 2433 | self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate") |
2434 | 2434 | ||
2435 | ud = fetcher.ud[fetcher.urls[1]] | 2435 | ud = fetcher.ud[fetcher.urls[1]] |
2436 | self.assertIn("name", ud.parm) | 2436 | self.assertIn("name", ud.parm) |
2437 | self.assertEqual(ud.parm["name"], "time") | 2437 | self.assertEqual(ud.parm["name"], "time-0.1.35") |
2438 | self.assertIn("downloadfilename", ud.parm) | 2438 | self.assertIn("downloadfilename", ud.parm) |
2439 | self.assertEqual(ud.parm["downloadfilename"], "time-0.1.35.crate") | 2439 | self.assertEqual(ud.parm["downloadfilename"], "time-0.1.35.crate") |
2440 | 2440 | ||
@@ -2451,7 +2451,7 @@ class CrateTest(FetcherTest): | |||
2451 | def test_crate_incorrect_cksum(self): | 2451 | def test_crate_incorrect_cksum(self): |
2452 | uri = "crate://crates.io/aho-corasick/0.7.20" | 2452 | uri = "crate://crates.io/aho-corasick/0.7.20" |
2453 | self.d.setVar('SRC_URI', uri) | 2453 | self.d.setVar('SRC_URI', uri) |
2454 | self.d.setVarFlag("SRC_URI", "aho-corasick.sha256sum", hashlib.sha256("Invalid".encode("utf-8")).hexdigest()) | 2454 | self.d.setVarFlag("SRC_URI", "aho-corasick-0.7.20.sha256sum", hashlib.sha256("Invalid".encode("utf-8")).hexdigest()) |
2455 | 2455 | ||
2456 | uris = self.d.getVar('SRC_URI').split() | 2456 | uris = self.d.getVar('SRC_URI').split() |
2457 | 2457 | ||