diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/distrodata.bbclass | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index 5e34441610..c85f7b3474 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass | |||
@@ -261,12 +261,44 @@ python do_checkpkg() { | |||
261 | from bb.utils import vercmp_string | 261 | from bb.utils import vercmp_string |
262 | from bb.fetch2 import FetchError, NoMethodError, decodeurl | 262 | from bb.fetch2 import FetchError, NoMethodError, decodeurl |
263 | 263 | ||
264 | """first check whether a uri is provided""" | 264 | def get_upstream_version_and_status(): |
265 | src_uri = (d.getVar('SRC_URI') or '').split() | 265 | |
266 | if src_uri: | 266 | # set if the upstream check fails reliably, e.g. absent git tags, or weird version format used on our or on upstream side. |
267 | uri_type, _, _, _, _, _ = decodeurl(src_uri[0]) | 267 | upstream_version_unknown = localdata.getVar('UPSTREAM_VERSION_UNKNOWN') |
268 | else: | 268 | # set if the upstream check cannot be reliably performed due to transient network failures, or server behaving weirdly. |
269 | uri_type = "none" | 269 | # This one should be used sparingly, as it completely excludes a recipe from upstream checking. |
270 | upstream_check_unreliable = localdata.getVar('UPSTREAM_CHECK_UNRELIABLE') | ||
271 | |||
272 | if upstream_check_unreliable == "1": | ||
273 | return "N/A", "CHECK_IS_UNRELIABLE" | ||
274 | |||
275 | try: | ||
276 | uv = oe.recipeutils.get_recipe_upstream_version(localdata) | ||
277 | pupver = uv['version'] if uv['version'] else "N/A" | ||
278 | except Exception as e: | ||
279 | pupver = "N/A" | ||
280 | |||
281 | if pupver == "N/A": | ||
282 | pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN" | ||
283 | else: | ||
284 | src_uri = (localdata.getVar('SRC_URI') or '').split() | ||
285 | if src_uri: | ||
286 | uri_type, _, _, _, _, _ = decodeurl(src_uri[0]) | ||
287 | else: | ||
288 | uri_type = "none" | ||
289 | pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type) | ||
290 | upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type) | ||
291 | |||
292 | cmp = vercmp_string(pv, upv) | ||
293 | if cmp == -1: | ||
294 | pstatus = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN" | ||
295 | elif cmp == 0: | ||
296 | pstatus = "MATCH" if not upstream_version_unknown else "KNOWN_BROKEN" | ||
297 | else: | ||
298 | pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN" | ||
299 | |||
300 | return pupver, pstatus | ||
301 | |||
270 | 302 | ||
271 | """initialize log files.""" | 303 | """initialize log files.""" |
272 | logpath = d.getVar('LOG_DIR') | 304 | logpath = d.getVar('LOG_DIR') |
@@ -313,34 +345,7 @@ python do_checkpkg() { | |||
313 | psrcuri = localdata.getVar('SRC_URI') | 345 | psrcuri = localdata.getVar('SRC_URI') |
314 | maintainer = localdata.getVar('RECIPE_MAINTAINER') | 346 | maintainer = localdata.getVar('RECIPE_MAINTAINER') |
315 | 347 | ||
316 | """ Get upstream version version """ | 348 | pupver, pstatus = get_upstream_version_and_status() |
317 | pupver = "" | ||
318 | pstatus = "" | ||
319 | |||
320 | try: | ||
321 | uv = oe.recipeutils.get_recipe_upstream_version(localdata) | ||
322 | |||
323 | pupver = uv['version'] | ||
324 | except Exception as e: | ||
325 | if e is FetchError: | ||
326 | pstatus = "ErrAccess" | ||
327 | elif e is NoMethodError: | ||
328 | pstatus = "ErrUnsupportedProto" | ||
329 | else: | ||
330 | pstatus = "ErrUnknown" | ||
331 | |||
332 | """Set upstream version status""" | ||
333 | if not pupver: | ||
334 | pupver = "N/A" | ||
335 | else: | ||
336 | pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type) | ||
337 | upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type) | ||
338 | |||
339 | cmp = vercmp_string(pv, upv) | ||
340 | if cmp == -1: | ||
341 | pstatus = "UPDATE" | ||
342 | elif cmp == 0: | ||
343 | pstatus = "MATCH" | ||
344 | 349 | ||
345 | if psrcuri: | 350 | if psrcuri: |
346 | psrcuri = psrcuri.split()[0] | 351 | psrcuri = psrcuri.split()[0] |