1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 12:29:55 +00:00

distrodata.bbaclass: change in git and svn package reporting

For git packages the Package Reporting System should always report the
latest HEAD.
For svn packages the new version reporting has the following format:
	version+svn[r|-]revision

(From OE-Core rev: 43c28375f97161e618fa54349c65be2058c33c53)

Signed-off-by: Emilia Ciobanu <emilia.maria.silvia.ciobanu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Emilia Ciobanu
2013-07-12 17:43:33 +03:00
committed by Richard Purdie
parent 5c9281e87b
commit 06ae127aed
+50 -27
View File
@@ -663,15 +663,25 @@ python do_checkpkg() {
gitproto = parm['protocol'] gitproto = parm['protocol']
else: else:
gitproto = "git" gitproto = "git"
gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path)
# Get all tags and HEAD
if d.getVar('GIT_REGEX', True):
gitcmd = "git ls-remote %s://%s%s%s %s 2>&1" % (gitproto, gituser, host, path, d.getVar('GIT_REGEX', True))
else:
gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path)
gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path) gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path)
tmp = os.popen(gitcmd).read() tmp = os.popen(gitcmd).read()
if 'unable to connect' in tmp:
tmp = None
tmp2 = os.popen(gitcmd2).read() tmp2 = os.popen(gitcmd2).read()
#This is for those repo have tag like: refs/tags/1.2.2 if 'unable to connect' in tmp2:
tmp2 = None
#This is for those repos have tag like: refs/tags/1.2.2
phash = pversion.rsplit("+")[-1]
if tmp: if tmp:
tmpline = tmp.split("\n") tmpline = tmp.split("\n")
verflag = 0 verflag = 0
phash = tmpline[0].rsplit("\t")[0]
pupver = pversion pupver = pversion
for line in tmpline: for line in tmpline:
if len(line)==0: if len(line)==0:
@@ -681,46 +691,52 @@ python do_checkpkg() {
if upstr_regex: if upstr_regex:
puptag = re.search(upstr_regex, puptag) puptag = re.search(upstr_regex, puptag)
else: else:
puptag = re.search("([0-9][\.|_]?)+", puptag) puptag = re.search("(?P<pver>([0-9][\.|_]?)+)", puptag)
if puptag == None: if puptag == None:
continue; continue
puptag = puptag.group() puptag = puptag.group('pver')
puptag = re.sub("_",".",puptag) puptag = re.sub("_",".",puptag)
plocaltag = pupver.split("+git")[0] plocaltag = pupver.split("+git")[0]
if "git" in plocaltag: if "git" in plocaltag:
plocaltag = plocaltag.split("-")[0] plocaltag = plocaltag.split("-")[0]
result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, "")) result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, ""))
if result > 0: if result > 0:
verflag = 1 verflag = 1
pstatus = "UPDATE" pupver = puptag
pupver = puptag
phash = line.split("\t")[0]
elif verflag == 0 : elif verflag == 0 :
pupver = plocaltag pupver = plocaltag
pstatus = "MATCH"
#This is for those no tag repo #This is for those no tag repo
elif tmp2: elif tmp2:
pupver = tmp2.split("\t")[0] pupver = pversion.rsplit("+")[0]
phash = pupver phash = pupver
if pupver in pversion:
pstatus = "MATCH"
else:
pstatus = "UPDATE"
else: else:
pstatus = "ErrGitAccess" pstatus = "ErrGitAccess"
if not ('ErrGitAccess' in pstatus):
tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>(.+))', pversion) latest_head = tmp2.rsplit("\t")[0][:7]
if tmp3: tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pversion)
pversion = tmp3.group('git_ver') + tmp3.group('git_prefix') + tmp3.group('head_md5')[:7] tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pupver)
git_prefix = tmp3.group('git_prefix') if not tmp4:
if not (git_prefix in pupver): tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)', pupver)
if len(pupver) < 40:
"""This is not the HEAD of the repository""" if tmp3:
pupver = pupver + tmp3.group('git_prefix') + phash[:7] # Get status of the package - MATCH/UPDATE
result = bb.utils.vercmp(("0", tmp3.group('git_ver'), ""), ("0",tmp3.group('git_ver') , ""))
# Get the latest tag
pstatus = 'MATCH'
if result < 0:
latest_pv = tmp3.group('git_ver')
else: else:
"""This is the HEAD of the repository""" latest_pv = pupver
pupver = tmp3.group('git_ver') + tmp3.group('git_prefix') + phash[:7] if not(tmp3.group('head_md5')[:7] in latest_head) or not(latest_head in tmp3.group('head_md5')[:7]):
pstatus = 'UPDATE'
git_prefix = tmp3.group('git_prefix')
pupver = latest_pv + tmp3.group('git_prefix') + latest_head
else:
if not tmp3:
bb.plain("#DEBUG# Current version (%s) doesn't match the usual pattern" %pversion)
elif type == 'svn': elif type == 'svn':
options = [] options = []
if user: if user:
@@ -750,6 +766,13 @@ python do_checkpkg() {
if re.match("Err", pstatus): if re.match("Err", pstatus):
pstatus = "ErrSvnAccess" pstatus = "ErrSvnAccess"
if pstatus != "ErrSvnAccess":
tag = pversion.rsplit("+svn")[0]
svn_prefix = re.search('(\+svn[r|\-]?)', pversion)
if tag and svn_prefix:
pupver = tag + svn_prefix.group() + pupver
elif type == 'cvs': elif type == 'cvs':
pupver = "HEAD" pupver = "HEAD"
pstatus = "UPDATE" pstatus = "UPDATE"