summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2024-04-19 14:17:13 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-05-08 14:51:43 +0100
commit551fdabc54f34b6ffa940dfd616b44ef4858277d (patch)
tree072780439e91f9a6d09658769d6b198bd6eaa064 /bitbake/lib/bb/tests
parentf6de2b033d32c0f92f19f5a4a8c4c8874a00a8f7 (diff)
downloadpoky-551fdabc54f34b6ffa940dfd616b44ef4858277d.tar.gz
bitbake: fetch2/crate: add upstream latest version check function
This is actually rather easy: crate web API provides a json with all the versions, for example: https://crates.io/api/v1/crates/cargo-c/versions (Bitbake rev: f6c2755db9a1f88c8534193b420fa31d135945e6) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/fetch.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 85c1f79ff3..e5d85f9dac 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -1493,6 +1493,12 @@ class FetchLatestVersionTest(FetcherTest):
1493 : "2.8", 1493 : "2.8",
1494 } 1494 }
1495 1495
1496 test_crate_uris = {
1497 # basic example; version pattern "A.B.C+cargo-D.E.F"
1498 ("cargo-c", "crate://crates.io/cargo-c/0.9.18+cargo-0.69")
1499 : "0.9.29"
1500 }
1501
1496 @skipIfNoNetwork() 1502 @skipIfNoNetwork()
1497 def test_git_latest_versionstring(self): 1503 def test_git_latest_versionstring(self):
1498 for k, v in self.test_git_uris.items(): 1504 for k, v in self.test_git_uris.items():
@@ -1532,6 +1538,16 @@ class FetchLatestVersionTest(FetcherTest):
1532 finally: 1538 finally:
1533 server.stop() 1539 server.stop()
1534 1540
1541 @skipIfNoNetwork()
1542 def test_crate_latest_versionstring(self):
1543 for k, v in self.test_crate_uris.items():
1544 self.d.setVar("PN", k[0])
1545 ud = bb.fetch2.FetchData(k[1], self.d)
1546 pupver = ud.method.latest_versionstring(ud, self.d)
1547 verstring = pupver[0]
1548 self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0])
1549 r = bb.utils.vercmp_string(v, verstring)
1550 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
1535 1551
1536class FetchCheckStatusTest(FetcherTest): 1552class FetchCheckStatusTest(FetcherTest):
1537 test_wget_uris = ["https://downloads.yoctoproject.org/releases/sato/sato-engine-0.1.tar.gz", 1553 test_wget_uris = ["https://downloads.yoctoproject.org/releases/sato/sato-engine-0.1.tar.gz",