summaryrefslogtreecommitdiffstats
path: root/meta/classes/distrodata.bbclass
diff options
context:
space:
mode:
authorEmilia Ciobanu <emilia.maria.silvia.ciobanu@intel.com>2013-07-12 17:43:33 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-07-13 18:23:38 +0100
commit06ae127aedef3585371e054fe4aa17a3d3382a55 (patch)
treee63a7ef0e19880ca1b46e59f7397658ac110d53a /meta/classes/distrodata.bbclass
parent5c9281e87bcb301827d019e62d009ff2dec51867 (diff)
downloadpoky-06ae127aedef3585371e054fe4aa17a3d3382a55.tar.gz
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>
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-rw-r--r--meta/classes/distrodata.bbclass79
1 files changed, 51 insertions, 28 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index be95b1ce38..204612c378 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -663,15 +663,25 @@ python do_checkpkg() {
663 gitproto = parm['protocol'] 663 gitproto = parm['protocol']
664 else: 664 else:
665 gitproto = "git" 665 gitproto = "git"
666 gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path) 666
667 # Get all tags and HEAD
668 if d.getVar('GIT_REGEX', True):
669 gitcmd = "git ls-remote %s://%s%s%s %s 2>&1" % (gitproto, gituser, host, path, d.getVar('GIT_REGEX', True))
670 else:
671 gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path)
667 gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path) 672 gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path)
673
668 tmp = os.popen(gitcmd).read() 674 tmp = os.popen(gitcmd).read()
675 if 'unable to connect' in tmp:
676 tmp = None
669 tmp2 = os.popen(gitcmd2).read() 677 tmp2 = os.popen(gitcmd2).read()
670 #This is for those repo have tag like: refs/tags/1.2.2 678 if 'unable to connect' in tmp2:
679 tmp2 = None
680 #This is for those repos have tag like: refs/tags/1.2.2
681 phash = pversion.rsplit("+")[-1]
671 if tmp: 682 if tmp:
672 tmpline = tmp.split("\n") 683 tmpline = tmp.split("\n")
673 verflag = 0 684 verflag = 0
674 phash = tmpline[0].rsplit("\t")[0]
675 pupver = pversion 685 pupver = pversion
676 for line in tmpline: 686 for line in tmpline:
677 if len(line)==0: 687 if len(line)==0:
@@ -681,46 +691,52 @@ python do_checkpkg() {
681 if upstr_regex: 691 if upstr_regex:
682 puptag = re.search(upstr_regex, puptag) 692 puptag = re.search(upstr_regex, puptag)
683 else: 693 else:
684 puptag = re.search("([0-9][\.|_]?)+", puptag) 694 puptag = re.search("(?P<pver>([0-9][\.|_]?)+)", puptag)
685 if puptag == None: 695 if puptag == None:
686 continue; 696 continue
687 puptag = puptag.group() 697 puptag = puptag.group('pver')
688 puptag = re.sub("_",".",puptag) 698 puptag = re.sub("_",".",puptag)
689 plocaltag = pupver.split("+git")[0] 699 plocaltag = pupver.split("+git")[0]
690 if "git" in plocaltag: 700 if "git" in plocaltag:
691 plocaltag = plocaltag.split("-")[0] 701 plocaltag = plocaltag.split("-")[0]
692 result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, "")) 702 result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, ""))
703
693 if result > 0: 704 if result > 0:
694 verflag = 1 705 verflag = 1
695 pstatus = "UPDATE" 706 pupver = puptag
696 pupver = puptag
697 phash = line.split("\t")[0]
698 elif verflag == 0 : 707 elif verflag == 0 :
699 pupver = plocaltag 708 pupver = plocaltag
700 pstatus = "MATCH"
701 #This is for those no tag repo 709 #This is for those no tag repo
702 elif tmp2: 710 elif tmp2:
703 pupver = tmp2.split("\t")[0] 711 pupver = pversion.rsplit("+")[0]
704 phash = pupver 712 phash = pupver
705 if pupver in pversion:
706 pstatus = "MATCH"
707 else:
708 pstatus = "UPDATE"
709 else: 713 else:
710 pstatus = "ErrGitAccess" 714 pstatus = "ErrGitAccess"
711 715 if not ('ErrGitAccess' in pstatus):
712 tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>(.+))', pversion) 716
713 if tmp3: 717 latest_head = tmp2.rsplit("\t")[0][:7]
714 pversion = tmp3.group('git_ver') + tmp3.group('git_prefix') + tmp3.group('head_md5')[:7] 718 tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pversion)
715 git_prefix = tmp3.group('git_prefix') 719 tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pupver)
716 if not (git_prefix in pupver): 720 if not tmp4:
717 if len(pupver) < 40: 721 tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)', pupver)
718 """This is not the HEAD of the repository""" 722
719 pupver = pupver + tmp3.group('git_prefix') + phash[:7] 723 if tmp3:
724 # Get status of the package - MATCH/UPDATE
725 result = bb.utils.vercmp(("0", tmp3.group('git_ver'), ""), ("0",tmp3.group('git_ver') , ""))
726 # Get the latest tag
727 pstatus = 'MATCH'
728 if result < 0:
729 latest_pv = tmp3.group('git_ver')
720 else: 730 else:
721 """This is the HEAD of the repository""" 731 latest_pv = pupver
722 pupver = tmp3.group('git_ver') + tmp3.group('git_prefix') + phash[:7] 732 if not(tmp3.group('head_md5')[:7] in latest_head) or not(latest_head in tmp3.group('head_md5')[:7]):
733 pstatus = 'UPDATE'
723 734
735 git_prefix = tmp3.group('git_prefix')
736 pupver = latest_pv + tmp3.group('git_prefix') + latest_head
737 else:
738 if not tmp3:
739 bb.plain("#DEBUG# Current version (%s) doesn't match the usual pattern" %pversion)
724 elif type == 'svn': 740 elif type == 'svn':
725 options = [] 741 options = []
726 if user: 742 if user:
@@ -750,6 +766,13 @@ python do_checkpkg() {
750 766
751 if re.match("Err", pstatus): 767 if re.match("Err", pstatus):
752 pstatus = "ErrSvnAccess" 768 pstatus = "ErrSvnAccess"
769
770 if pstatus != "ErrSvnAccess":
771 tag = pversion.rsplit("+svn")[0]
772 svn_prefix = re.search('(\+svn[r|\-]?)', pversion)
773 if tag and svn_prefix:
774 pupver = tag + svn_prefix.group() + pupver
775
753 elif type == 'cvs': 776 elif type == 'cvs':
754 pupver = "HEAD" 777 pupver = "HEAD"
755 pstatus = "UPDATE" 778 pstatus = "UPDATE"