fetch2: add stub latest_versionstring to FetchMethod
PATCH 1/2 fetch2: add stub latest_versionstring to FetchMethod
Signed-off-by Ross Burton <[email protected]>
--- bitbake/lib/bb/fetch2/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+)
bitbake/lib/bb/fetch2/__init__.py +8 -0
@@ -1559,6 +1559,14 @@ class FetchMethod(object): key = self._revision_key(ud, d, name) return "%s-%s" % (key, d.getVar("PN") or "") + def latest_versionstring(self, ud, d): + """ + Compute the latest release name like "x.y.x" in "x.y.x+gitHASH" + by searching through the tags output of ls-remote, comparing + versions and returning the highest match as a (version, revision) pair. + """ + return ('', '') + class Fetch(object): def __init__(self, urls, d, cache = True, localonly = False, connection_cache = None): if localonly and cache:
Signature · 1 line
2.11.0
PATCH 2/2 tests/fetch: handle network failures gracefully
If there is a network failure the return value from latest_versionstring() is ('','') which later causes an exception when comparing versions.
Improve this by checking the return value and failing the test early.
[ YOCTO #12053 ]
Signed-off-by Ross Burton <[email protected]>
--- bitbake/lib/bb/tests/fetch.py | 2 ++ 1 file changed, 2 insertions(+)
bitbake/lib/bb/tests/fetch.py +2 -0
@@ -793,6 +793,7 @@ class FetchLatestVersionTest(FetcherTest): ud = bb.fetch2.FetchData(k[1], self.d) pupver= ud.method.latest_versionstring(ud, self.d) verstring = pupver[0] + self.assertTrue(verstring, msg="Could not find upstream version") r = bb.utils.vercmp_string(v, verstring) self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
@@ -804,6 +805,7 @@ class FetchLatestVersionTest(FetcherTest): ud = bb.fetch2.FetchData(k[1], self.d) pupver = ud.method.latest_versionstring(ud, self.d) verstring = pupver[0] + self.assertTrue(verstring, msg="Could not find upstream version") r = bb.utils.vercmp_string(v, verstring) self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
Signature · 1 line
2.11.0