All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/1] Changes in git and svn package reporting
@ 2013-07-12 14:43 Emilia Ciobanu
  2013-07-12 14:43 ` [PATCH v3 1/1] distrodata.bbaclass: change " Emilia Ciobanu
  0 siblings, 1 reply; 2+ messages in thread
From: Emilia Ciobanu @ 2013-07-12 14:43 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit a63229917a5708de2d161aba0d67168ce0da6365:

  meta-yocto-bsp: update reference board SRCREVs (2013-07-10 09:45:51 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib emac/distrodata_git_svn_version_report_pattern
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=emac/distrodata_git_svn_version_report_pattern

Emilia Ciobanu (1):
  distrodata.bbaclass: change in git and svn package reporting

 meta/classes/distrodata.bbclass |   79 +++++++++++++++++++++++++--------------
 1 file changed, 51 insertions(+), 28 deletions(-)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v3 1/1] distrodata.bbaclass: change in git and svn package reporting
  2013-07-12 14:43 [PATCH v3 0/1] Changes in git and svn package reporting Emilia Ciobanu
@ 2013-07-12 14:43 ` Emilia Ciobanu
  0 siblings, 0 replies; 2+ messages in thread
From: Emilia Ciobanu @ 2013-07-12 14:43 UTC (permalink / raw)
  To: openembedded-core

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

Signed-off-by: Emilia Ciobanu <emilia.maria.silvia.ciobanu@intel.com>
---
 meta/classes/distrodata.bbclass |   79 +++++++++++++++++++++++++--------------
 1 file changed, 51 insertions(+), 28 deletions(-)

diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index be95b1c..204612c 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -663,15 +663,25 @@ python do_checkpkg() {
                         gitproto = parm['protocol']
                 else:
                         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)
+
                 tmp = os.popen(gitcmd).read()
+                if 'unable to connect' in tmp:
+                        tmp = None
                 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:
                         tmpline = tmp.split("\n")
                         verflag = 0
-                        phash = tmpline[0].rsplit("\t")[0]
                         pupver = pversion
                         for line in tmpline:
                                 if len(line)==0:
@@ -681,46 +691,52 @@ python do_checkpkg() {
                                 if upstr_regex:
                                         puptag = re.search(upstr_regex, puptag)
                                 else:
-                                        puptag = re.search("([0-9][\.|_]?)+", puptag)
+                                        puptag = re.search("(?P<pver>([0-9][\.|_]?)+)", puptag)
                                 if puptag == None:
-                                        continue;
-                                puptag = puptag.group()
+                                        continue
+                                puptag = puptag.group('pver')
                                 puptag = re.sub("_",".",puptag)
                                 plocaltag = pupver.split("+git")[0]
                                 if "git" in plocaltag:
                                         plocaltag = plocaltag.split("-")[0]
                                 result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, ""))
+
                                 if result > 0:
-                                        verflag = 1
-                                        pstatus = "UPDATE"
-                                        pupver = puptag
-                                        phash = line.split("\t")[0]
+                                         verflag = 1
+                                         pupver = puptag
                                 elif verflag == 0 :
-                                        pupver = plocaltag
-                                        pstatus = "MATCH"
+                                         pupver = plocaltag
                 #This is for those no tag repo
                 elif tmp2:
-                        pupver = tmp2.split("\t")[0]
+                        pupver = pversion.rsplit("+")[0]
                         phash = pupver
-                        if pupver in pversion:
-                                pstatus = "MATCH"
-                        else:
-                                pstatus = "UPDATE"
                 else:
                         pstatus = "ErrGitAccess"
-
-                tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>(.+))', pversion)
-                if tmp3:
-                        pversion = tmp3.group('git_ver') + tmp3.group('git_prefix') + tmp3.group('head_md5')[:7]
-                        git_prefix = tmp3.group('git_prefix')
-                        if not (git_prefix in pupver):
-                                if len(pupver) < 40:
-                                        """This is not the HEAD of the repository"""
-                                        pupver = pupver + tmp3.group('git_prefix') + phash[:7]
+                if not ('ErrGitAccess' in pstatus):
+
+                        latest_head = tmp2.rsplit("\t")[0][:7]
+                        tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pversion)
+                        tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pupver)
+                        if not tmp4:
+                                tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)', pupver)
+
+                        if tmp3:
+                                # 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:
-                                        """This is the HEAD of the repository"""
-                                        pupver = tmp3.group('git_ver') + tmp3.group('git_prefix') + phash[:7]
+                                        latest_pv = pupver
+                                        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':
                 options = []
                 if user:
@@ -750,6 +766,13 @@ python do_checkpkg() {
 
                 if re.match("Err", pstatus):
                         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':
                 pupver = "HEAD"
                 pstatus = "UPDATE"
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-12 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 14:43 [PATCH v3 0/1] Changes in git and svn package reporting Emilia Ciobanu
2013-07-12 14:43 ` [PATCH v3 1/1] distrodata.bbaclass: change " Emilia Ciobanu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.