mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
2a4ee94667
commit
56072bb3bd
@@ -266,11 +266,15 @@ python do_checkpkg() {
|
|||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
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"""
|
"""first check whether a uri is provided"""
|
||||||
src_uri = d.getVar('SRC_URI', True)
|
src_uri = d.getVar('SRC_URI', True)
|
||||||
if not src_uri:
|
if not src_uri:
|
||||||
return
|
return
|
||||||
|
uri_type, _, _, _, _, _ = decodeurl(src_uri)
|
||||||
|
|
||||||
"""initialize log files."""
|
"""initialize log files."""
|
||||||
logpath = d.getVar('LOG_DIR', True)
|
logpath = d.getVar('LOG_DIR', True)
|
||||||
@@ -310,10 +314,7 @@ python do_checkpkg() {
|
|||||||
|
|
||||||
pdesc = localdata.getVar('DESCRIPTION', True)
|
pdesc = localdata.getVar('DESCRIPTION', True)
|
||||||
pgrp = localdata.getVar('SECTION', True)
|
pgrp = localdata.getVar('SECTION', True)
|
||||||
if localdata.getVar('PRSPV', True):
|
pversion = localdata.getVar('PV', True)
|
||||||
pversion = localdata.getVar('PRSPV', True)
|
|
||||||
else:
|
|
||||||
pversion = localdata.getVar('PV', True)
|
|
||||||
plicense = localdata.getVar('LICENSE', True)
|
plicense = localdata.getVar('LICENSE', True)
|
||||||
psection = localdata.getVar('SECTION', True)
|
psection = localdata.getVar('SECTION', True)
|
||||||
phome = localdata.getVar('HOMEPAGE', True)
|
phome = localdata.getVar('HOMEPAGE', True)
|
||||||
@@ -325,61 +326,50 @@ python do_checkpkg() {
|
|||||||
maintainer = localdata.getVar('RECIPE_MAINTAINER', True)
|
maintainer = localdata.getVar('RECIPE_MAINTAINER', True)
|
||||||
|
|
||||||
""" Get upstream version version """
|
""" Get upstream version version """
|
||||||
pupver = None
|
pupver = ""
|
||||||
pstatus = "ErrUnknown"
|
pstatus = ""
|
||||||
found = 0
|
|
||||||
|
|
||||||
for uri in src_uri.split():
|
try:
|
||||||
m = re.compile('(?P<type>[^:]*)').match(uri)
|
uv = oe.recipeutils.get_recipe_upstream_version(localdata)
|
||||||
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']:
|
pupver = uv['version']
|
||||||
try:
|
except Exception as e:
|
||||||
ud = bb.fetch2.FetchData(psrcuri, d)
|
if e is FetchError:
|
||||||
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)))
|
|
||||||
pstatus = "ErrAccess"
|
pstatus = "ErrAccess"
|
||||||
elif pproto == "file":
|
elif e is NoMethodError:
|
||||||
"""Local files are always updated"""
|
pstatus = "ErrUnsupportedProto"
|
||||||
pupver = pversion
|
else:
|
||||||
else:
|
pstatus = "ErrUnknown"
|
||||||
pstatus = "ErrUnsupportedProto"
|
|
||||||
bb.note("do_checkpkg, protocol %s isn't implemented" % pproto)
|
|
||||||
|
|
||||||
|
"""Set upstream version status"""
|
||||||
if not pupver:
|
if not pupver:
|
||||||
pupver = "N/A"
|
pupver = "N/A"
|
||||||
elif pupver == pversion:
|
|
||||||
pstatus = "MATCH"
|
|
||||||
else:
|
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"""
|
"""Read from manual distro tracking fields as alternative"""
|
||||||
pmver = d.getVar("RECIPE_UPSTREAM_VERSION", True)
|
pmver = d.getVar("RECIPE_UPSTREAM_VERSION", True)
|
||||||
if not pmver:
|
if not pmver:
|
||||||
pmver = "N/A"
|
pmver = "N/A"
|
||||||
pmstatus = "ErrNoRecipeData"
|
pmstatus = "ErrNoRecipeData"
|
||||||
elif pmver == pupver:
|
|
||||||
pmstatus = "MATCH"
|
|
||||||
else:
|
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"))
|
pdepends = "".join(pdepends.split("\t"))
|
||||||
pdesc = "".join(pdesc.split("\t"))
|
pdesc = "".join(pdesc.split("\t"))
|
||||||
|
|||||||
Reference in New Issue
Block a user