summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-06-02 11:51:19 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-08 17:32:45 +0100
commiteb296224f24d4bcc833d81a86a71345dfd0e9db4 (patch)
treee472d0c2d1f672421f4f66c909124e227b2566ae /meta
parentc53917e79dc34757a482c94e653568619868fff4 (diff)
downloadopenembedded-core-eb296224f24d4bcc833d81a86a71345dfd0e9db4.tar.gz
openembedded-core-eb296224f24d4bcc833d81a86a71345dfd0e9db4.tar.bz2
openembedded-core-eb296224f24d4bcc833d81a86a71345dfd0e9db4.zip
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. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/distrodata.bbclass84
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() {
import re
import tempfile
import subprocess
+ import oe.recipeutils
+ from bb.utils import vercmp_string
+ from bb.fetch2 import FetchError, NoMethodError, decodeurl
"""first check whether a uri is provided"""
src_uri = d.getVar('SRC_URI', True)
if not src_uri:
return
+ uri_type, _, _, _, _, _ = decodeurl(src_uri)
"""initialize log files."""
logpath = d.getVar('LOG_DIR', True)
@@ -310,10 +314,7 @@ python do_checkpkg() {
pdesc = localdata.getVar('DESCRIPTION', True)
pgrp = localdata.getVar('SECTION', True)
- if localdata.getVar('PRSPV', True):
- pversion = localdata.getVar('PRSPV', True)
- else:
- pversion = localdata.getVar('PV', True)
+ pversion = localdata.getVar('PV', True)
plicense = localdata.getVar('LICENSE', True)
psection = localdata.getVar('SECTION', True)
phome = localdata.getVar('HOMEPAGE', True)
@@ -325,61 +326,50 @@ python do_checkpkg() {
maintainer = localdata.getVar('RECIPE_MAINTAINER', True)
""" Get upstream version version """
- pupver = None
- pstatus = "ErrUnknown"
- found = 0
-
- for uri in src_uri.split():
- m = re.compile('(?P<type>[^:]*)').match(uri)
- if not m:
- raise MalformedUrl(uri)
- elif m.group('type') in ('http', 'https', 'ftp', 'cvs', 'svn', 'git'):
- found = 1
- psrcuri = uri
- pproto = m.group('type')
- break
- if not found:
- pproto = "file"
-
- if pproto in ['http', 'https', 'ftp', 'git']:
- try:
- ud = bb.fetch2.FetchData(psrcuri, d)
- pupver = ud.method.latest_versionstring(ud, d)
- if pproto == 'git':
- if pupver == "":
- pupver = pversion.rsplit("+")[0]
- if re.search(pversion, "gitrAUTOINC"):
- pupver += "+gitrAUTOINC+"
- else:
- pupver += "+gitAUTOINC+"
- latest_revision = ud.method.latest_revision(ud, d, ud.names[0])
- pupver += latest_revision[:10]
- except Exception as inst:
- bb.warn("%s: unexpected error: %s" % (pname, repr(inst)))
+ pupver = ""
+ pstatus = ""
+
+ try:
+ uv = oe.recipeutils.get_recipe_upstream_version(localdata)
+
+ pupver = uv['version']
+ except Exception as e:
+ if e is FetchError:
pstatus = "ErrAccess"
- elif pproto == "file":
- """Local files are always updated"""
- pupver = pversion
- else:
- pstatus = "ErrUnsupportedProto"
- bb.note("do_checkpkg, protocol %s isn't implemented" % pproto)
+ elif e is NoMethodError:
+ pstatus = "ErrUnsupportedProto"
+ else:
+ pstatus = "ErrUnknown"
+ """Set upstream version status"""
if not pupver:
pupver = "N/A"
- elif pupver == pversion:
- pstatus = "MATCH"
else:
- pstatus = "UPDATE"
+ pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type)
+ upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type)
+
+ cmp = vercmp_string(pv, upv)
+ if cmp == -1:
+ pstatus = "UPDATE"
+ elif cmp == 0:
+ pstatus = "MATCH"
"""Read from manual distro tracking fields as alternative"""
pmver = d.getVar("RECIPE_UPSTREAM_VERSION", True)
if not pmver:
pmver = "N/A"
pmstatus = "ErrNoRecipeData"
- elif pmver == pupver:
- pmstatus = "MATCH"
else:
- pmstatus = "UPDATE"
+ mpv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pmver, uri_type)
+ upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type)
+
+ cmp = vercmp_string(mpv, upv)
+ if cmp == -1:
+ pmstatus = "UPDATE"
+ elif cmp == 0:
+ pmstatus = "MATCH"
+ else:
+ pmstatus = ""
pdepends = "".join(pdepends.split("\t"))
pdesc = "".join(pdesc.split("\t"))