diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-06-02 11:51:19 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-08 17:34:05 +0100 |
commit | 56072bb3bd626c5b5a36f381c18481ebe47c021e (patch) | |
tree | 7f709bd0859c32614545e3ad1ad5d79ba72f063d /meta/classes | |
parent | 2a4ee94667d4d356cad2ca6d60a100a30c92737b (diff) | |
download | poky-56072bb3bd626c5b5a36f381c18481ebe47c021e.tar.gz |
distrodata: checkpkg make usage of oe.recipeutils.get_recipe_upstream_version
Now get_recipe_upstream_version function exists in oe.recipeutils module
to avoid duplicate code make usage of it.
(From OE-Core rev: eb296224f24d4bcc833d81a86a71345dfd0e9db4)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/distrodata.bbclass | 84 |
1 files changed, 37 insertions, 47 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index e1fc6dd3fd..092c372204 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass | |||
@@ -266,11 +266,15 @@ python do_checkpkg() { | |||
266 | import re | 266 | import re |
267 | import tempfile | 267 | import tempfile |
268 | import subprocess | 268 | import subprocess |
269 | import oe.recipeutils | ||
270 | from bb.utils import vercmp_string | ||
271 | from bb.fetch2 import FetchError, NoMethodError, decodeurl | ||
269 | 272 | ||
270 | """first check whether a uri is provided""" | 273 | """first check whether a uri is provided""" |
271 | src_uri = d.getVar('SRC_URI', True) | 274 | src_uri = d.getVar('SRC_URI', True) |
272 | if not src_uri: | 275 | if not src_uri: |
273 | return | 276 | return |
277 | uri_type, _, _, _, _, _ = decodeurl(src_uri) | ||
274 | 278 | ||
275 | """initialize log files.""" | 279 | """initialize log files.""" |
276 | logpath = d.getVar('LOG_DIR', True) | 280 | logpath = d.getVar('LOG_DIR', True) |
@@ -310,10 +314,7 @@ python do_checkpkg() { | |||
310 | 314 | ||
311 | pdesc = localdata.getVar('DESCRIPTION', True) | 315 | pdesc = localdata.getVar('DESCRIPTION', True) |
312 | pgrp = localdata.getVar('SECTION', True) | 316 | pgrp = localdata.getVar('SECTION', True) |
313 | if localdata.getVar('PRSPV', True): | 317 | pversion = localdata.getVar('PV', True) |
314 | pversion = localdata.getVar('PRSPV', True) | ||
315 | else: | ||
316 | pversion = localdata.getVar('PV', True) | ||
317 | plicense = localdata.getVar('LICENSE', True) | 318 | plicense = localdata.getVar('LICENSE', True) |
318 | psection = localdata.getVar('SECTION', True) | 319 | psection = localdata.getVar('SECTION', True) |
319 | phome = localdata.getVar('HOMEPAGE', True) | 320 | phome = localdata.getVar('HOMEPAGE', True) |
@@ -325,61 +326,50 @@ python do_checkpkg() { | |||
325 | maintainer = localdata.getVar('RECIPE_MAINTAINER', True) | 326 | maintainer = localdata.getVar('RECIPE_MAINTAINER', True) |
326 | 327 | ||
327 | """ Get upstream version version """ | 328 | """ Get upstream version version """ |
328 | pupver = None | 329 | pupver = "" |
329 | pstatus = "ErrUnknown" | 330 | pstatus = "" |
330 | found = 0 | 331 | |
331 | 332 | try: | |
332 | for uri in src_uri.split(): | 333 | uv = oe.recipeutils.get_recipe_upstream_version(localdata) |
333 | m = re.compile('(?P<type>[^:]*)').match(uri) | 334 | |
334 | if not m: | 335 | pupver = uv['version'] |
335 | raise MalformedUrl(uri) | 336 | except Exception as e: |
336 | elif m.group('type') in ('http', 'https', 'ftp', 'cvs', 'svn', 'git'): | 337 | if e is FetchError: |
337 | found = 1 | ||
338 | psrcuri = uri | ||
339 | pproto = m.group('type') | ||
340 | break | ||
341 | if not found: | ||
342 | pproto = "file" | ||
343 | |||
344 | if pproto in ['http', 'https', 'ftp', 'git']: | ||
345 | try: | ||
346 | ud = bb.fetch2.FetchData(psrcuri, d) | ||
347 | pupver = ud.method.latest_versionstring(ud, d) | ||
348 | if pproto == 'git': | ||
349 | if pupver == "": | ||
350 | pupver = pversion.rsplit("+")[0] | ||
351 | if re.search(pversion, "gitrAUTOINC"): | ||
352 | pupver += "+gitrAUTOINC+" | ||
353 | else: | ||
354 | pupver += "+gitAUTOINC+" | ||
355 | latest_revision = ud.method.latest_revision(ud, d, ud.names[0]) | ||
356 | pupver += latest_revision[:10] | ||
357 | except Exception as inst: | ||
358 | bb.warn("%s: unexpected error: %s" % (pname, repr(inst))) | ||
359 | pstatus = "ErrAccess" | 338 | pstatus = "ErrAccess" |
360 | elif pproto == "file": | 339 | elif e is NoMethodError: |
361 | """Local files are always updated""" | 340 | pstatus = "ErrUnsupportedProto" |
362 | pupver = pversion | 341 | else: |
363 | else: | 342 | pstatus = "ErrUnknown" |
364 | pstatus = "ErrUnsupportedProto" | ||
365 | bb.note("do_checkpkg, protocol %s isn't implemented" % pproto) | ||
366 | 343 | ||
344 | """Set upstream version status""" | ||
367 | if not pupver: | 345 | if not pupver: |
368 | pupver = "N/A" | 346 | pupver = "N/A" |
369 | elif pupver == pversion: | ||
370 | pstatus = "MATCH" | ||
371 | else: | 347 | else: |
372 | pstatus = "UPDATE" | 348 | pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type) |
349 | upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type) | ||
350 | |||
351 | cmp = vercmp_string(pv, upv) | ||
352 | if cmp == -1: | ||
353 | pstatus = "UPDATE" | ||
354 | elif cmp == 0: | ||
355 | pstatus = "MATCH" | ||
373 | 356 | ||
374 | """Read from manual distro tracking fields as alternative""" | 357 | """Read from manual distro tracking fields as alternative""" |
375 | pmver = d.getVar("RECIPE_UPSTREAM_VERSION", True) | 358 | pmver = d.getVar("RECIPE_UPSTREAM_VERSION", True) |
376 | if not pmver: | 359 | if not pmver: |
377 | pmver = "N/A" | 360 | pmver = "N/A" |
378 | pmstatus = "ErrNoRecipeData" | 361 | pmstatus = "ErrNoRecipeData" |
379 | elif pmver == pupver: | ||
380 | pmstatus = "MATCH" | ||
381 | else: | 362 | else: |
382 | pmstatus = "UPDATE" | 363 | mpv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pmver, uri_type) |
364 | upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type) | ||
365 | |||
366 | cmp = vercmp_string(mpv, upv) | ||
367 | if cmp == -1: | ||
368 | pmstatus = "UPDATE" | ||
369 | elif cmp == 0: | ||
370 | pmstatus = "MATCH" | ||
371 | else: | ||
372 | pmstatus = "" | ||
383 | 373 | ||
384 | pdepends = "".join(pdepends.split("\t")) | 374 | pdepends = "".join(pdepends.split("\t")) |
385 | pdesc = "".join(pdesc.split("\t")) | 375 | pdesc = "".join(pdesc.split("\t")) |