From: Chen Qi <[email protected]>
We need to handle the situation of LTS upgrades. This means for version
such as 1.0.0, we need to find the upgradable version of 1.0.1 instead of
something like 1.1.0.
Add optional major_version parameter to crate fetcher to support such
case.
Signed-off-by: Chen Qi <[email protected]>
---
lib/bb/fetch2/crate.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch2/crate.py
index 2d3078899..4ac71946d 100644
--- a/lib/bb/fetch2/crate.py
+++ b/lib/bb/fetch2/crate.py
@@ -144,10 +144,16 @@ class Crate(Wget):
with open(mdpath, "w") as f:
json.dump(metadata, f)
- def latest_versionstring(self, ud, d):
+ def latest_versionstring(self, ud, d, major_version=None):
from functools import cmp_to_key
json_data = json.loads(self._fetch_index(ud.versionsurl, ud, d))
versions = [(0, i["num"], "") for i in json_data["versions"]]
+ if major_version:
+ filtered_versions = []
+ for v in versions:
+ if v[1].startswith(major_version+'.'):
+ filtered_versions.append(v)
+ versions = filtered_versions
versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
return (versions[-1][1], "")
--
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.