1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

utility-tasks.bbclass: add automatic version check for GIT/SVN proto

both git/svn supports remote information query: 'git ls-remote', and
'svn info'. With them, now upstream version will be automatically
checked for git/svn packages.

In the meantime, manual latest version tagged in distro tracking
fields are also compared as one alternative if upstream check fails.
Also such check is one indicator whether tracking field is missing.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Kevin Tian
2010-07-08 15:42:42 +08:00
committed by Saul Wold
parent 43bd793679
commit 90ceeff258
4 changed files with 70 additions and 14 deletions
+64 -8
View File
@@ -276,7 +276,6 @@ python do_checkpkg() {
"""generate package information from .bb file"""
pname = bb.data.getVar('PN', d, 1)
pcurver = bb.data.getVar('PV', d, 1)
pdesc = bb.data.getVar('DESCRIPTION', d, 1)
pgrp = bb.data.getVar('SECTION', d, 1)
@@ -295,6 +294,11 @@ python do_checkpkg() {
pstatus = "ErrUnknown"
(type, host, path, user, pswd, parm) = bb.decodeurl(uri)
if type in ['http', 'https', 'ftp']:
pcurver = bb.data.getVar('PV', d, 1)
else:
pcurver = bb.data.getVar("SRCREV", d, 1)
if type in ['http', 'https', 'ftp']:
newver = pcurver
altpath = path
@@ -342,12 +346,52 @@ python do_checkpkg() {
if re.match("Err", newver):
pstatus = newver + ":" + altpath + ":" + dirver + ":" + curname
elif type == 'git':
"""N.B. Now hardcode UPDATE for git/svn/cvs."""
pupver = "master"
pstatus = "UPDATE"
if user:
gituser = user + '@'
else:
gituser = ""
if 'protocol' in parm:
gitproto = parm['protocol']
else:
gitproto = "rsync"
gitcmd = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path)
print gitcmd
ver = os.popen(gitcmd).read()
if ver and re.search("HEAD", ver):
pupver = ver.split("\t")[0]
if pcurver == pupver:
pstatus = "MATCH"
else:
pstatus = "UPDATE"
else:
pstatus = "ErrGitAccess"
elif type == 'svn':
pupver = "HEAD"
pstatus = "UPDATE"
options = []
if user:
options.append("--username %s" % user)
if pswd:
options.append("--password %s" % pswd)
svnproto = 'svn'
if 'proto' in parm:
svnproto = parm['proto']
if 'rev' in parm:
pcurver = parm['rev']
svncmd = "svn info %s %s://%s%s/%s/ 2>&1" % (" ".join(options), svnproto, host, path, parm["module"])
print svncmd
svninfo = os.popen(svncmd).read()
for line in svninfo.split("\n"):
if re.search("^Last Changed Rev:", line):
pupver = line.split(" ")[-1]
if pcurver == pupver:
pstatus = "MATCH"
else:
pstatus = "UPDATE"
if re.match("Err", pstatus):
pstatus = "ErrSvnAccess"
elif type == 'cvs':
pupver = "HEAD"
pstatus = "UPDATE"
@@ -360,10 +404,22 @@ python do_checkpkg() {
if re.match("Err", pstatus):
pstatus += ":%s%s" % (host, path)
"""Read from manual distro tracking fields as alternative"""
pmver = bb.data.getVar("RECIPE_LATEST_VERSION", d, 1)
if not pmver:
pmver = "N/A"
pmstatus = "ErrNoRecipeData"
else:
if pmver == pcurver:
pmstatus = "MATCH"
else:
pmstatus = "UPDATE"
lf = bb.utils.lockfile(logfile + ".lock")
f = open(logfile, "a")
f.write("\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % \
(pname, pgrp, pproto, pcurver, pupver, pstatus, pdesc))
f.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % \
(pname, pgrp, pproto, pcurver, pmver, pupver, pmstatus, pstatus, pdesc))
f.close()
bb.utils.unlockfile(lf)
}