[bitbake][wrynose][2.18][PATCH v2 4/8] fetch2/crate: skip yanked versions when reading cargo index

Yoann Congal <[email protected]> Thu, 11 Jun 2026 15:11:26 +0200
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <f457e8a4ba2b5b601c0eefa94072d69bae4d461b.1781183212.git.yoann.congal@smile.fr>
From: Thomas Perrot <[email protected]>

The cargo sparse index marks yanked crate versions with "yanked": true.
Treat those the same way as non-existing versions so that version
checking never promotes a yanked release as the latest one.

Signed-off-by: Thomas Perrot <[email protected]>
Signed-off-by: Mathieu Dubois-Briand <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
(cherry picked from commit 0d757e8dfff7c5d338a01437960d60312e9af490)
Signed-off-by: Yoann Congal <[email protected]>
---
 lib/bb/fetch2/crate.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch2/crate.py
index b89817ab9..d84bae0bc 100644
--- a/lib/bb/fetch2/crate.py
+++ b/lib/bb/fetch2/crate.py
@@ -178,7 +178,8 @@ class Crate(Wget):
         response = self._fetch_index(ud.versionsurl, ud, d)
         for line in response.splitlines():
             data = json.loads(line)
-            versions.append((0, data["vers"], ""))
+            if not data.get("yanked", False):
+                versions.append((0, data["vers"], ""))
 
         versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
         return (versions[-1][1], "")