diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2017-08-11 12:45:15 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-16 00:03:13 +0100 |
commit | 36671d14948ee00dc1a5c7cdefbe791f27f3cd1b (patch) | |
tree | da4dc0c1e8aef2ad59ce066467296ec33d0d105c /meta/classes/distrodata.bbclass | |
parent | 3c901c59339a41d75417b0b7b9f8163f0d27ecdf (diff) | |
download | poky-36671d14948ee00dc1a5c7cdefbe791f27f3cd1b.tar.gz |
distrodata.bbclass: add UPSTREAM_VERSION_UNKNOWN and UPSTREAM_CHECK_UNRELIABLE
These are optional per-recipe variables with the following meaning:
UPSTREAM_VERSION_UNKNOWN - set if the upstream version check fails reliably,
e.g. absent git tags, or weird version format used on our or on upstream side.
If this variable is not set and version check fails, or if it is set and
the version check succeeds, then the checkpkg selftest for the recipe will fail.
UPSTREAM_CHECK_UNRELIABLE - set if the upstream check cannot be reliably performed
due to transient network failures, or server behaving weirdly. This one should be used
sparingly, as it completely excludes a recipe from upstream checking, and thus
we don't get automatically notified about new upstream releases.
Also the upstream status string in the checkpkg csv output is clarified with the following
possible values:
MATCH - recipe is providing the latest upstream version
UPDATE - there is a new version released by upstream, recipe should be updated
CHECK_IS_UNRELIABLE - an upstream check was skipped as requested by recipe
via UPSTREAM_CHECK_UNRELIABLE
UNKNOWN - upstream version check was performed, but the upstream verison could
not be determined. The recipe acknowledges this via UPSTREAM_VERSION_UNKNOWN setting.
UNKNWON_BROKEN - same as previous, but the recipe does not include the acknowledgement
and should be fixed.
KNOWN_BROKEN - upstream check worked, but recipe claims it shouldn't; to fix this
remove UPSTREAM_VERSION_UNKNOWN from recipe.
[YOCTO #11896]
(From OE-Core rev: 2a44ac1add0338cd7ff012cda96bf113c9a01bd6)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-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] |