Openembedded Bitbake Development
 help / color / mirror / Atom feed
* [PATCH 0/4] fetch2 latest_versionstring improvements
@ 2015-07-15  0:30 Aníbal Limón
  2015-07-15  0:30 ` [PATCH 1/4] fetch2/git.py: latest_versionstring search in all tags Aníbal Limón
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Aníbal Limón @ 2015-07-15  0:30 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alexander.kanavin

Changes return of latest_versionstring method now returns current revision
in SCM's like git.

[YOCTO #7605]

Aníbal Limón (4):
  fetch2/git.py: latest_versionstring search in all tags
  fetch2/git.py: latest_versionstring now returns (version, revision)
  fetch2/wget.py: latest_versionstring now returns (version, revision)
  tests/fetch.py: Updated test name FetchMethodTest ->
    FetchLatestVersionTest

 lib/bb/fetch2/git.py  | 20 +++++++++++++-------
 lib/bb/fetch2/wget.py | 12 ++++++------
 lib/bb/tests/fetch.py |  8 +++++---
 3 files changed, 24 insertions(+), 16 deletions(-)

-- 
1.9.1



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

* [PATCH 1/4] fetch2/git.py: latest_versionstring search in all tags
  2015-07-15  0:30 [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
@ 2015-07-15  0:30 ` Aníbal Limón
  2015-07-15  0:30 ` [PATCH 2/4] fetch2/git.py: latest_versionstring now returns (version, revision) Aníbal Limón
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2015-07-15  0:30 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alexander.kanavin

Don't limit the tag search for only tags end with ^{}.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 31fd8a7..706fff5 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -374,7 +374,7 @@ class Git(FetchMethod):
         verstring = ""
         tagregex = re.compile(d.getVar('GITTAGREGEX', True) or "(?P<pver>([0-9][\.|_]?)+)")
         try:
-            output = self._lsremote(ud, d, "refs/tags/*^{}")
+            output = self._lsremote(ud, d, "refs/tags/*")
         except bb.fetch2.FetchError or bb.fetch2.NetworkAccess:
             return ""
 
-- 
1.9.1



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

* [PATCH 2/4] fetch2/git.py: latest_versionstring now returns (version, revision)
  2015-07-15  0:30 [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
  2015-07-15  0:30 ` [PATCH 1/4] fetch2/git.py: latest_versionstring search in all tags Aníbal Limón
@ 2015-07-15  0:30 ` Aníbal Limón
  2015-07-15  0:30 ` [PATCH 3/4] fetch2/wget.py: " Aníbal Limón
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2015-07-15  0:30 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alexander.kanavin

We need to know the revision associated with the upstream version in
SCM like git, this change broke return convention, oe-core recipeutils
get_recipe_upstream_version need to be updated.

tests/fetch.py: Updated git latest_versionstring test for comply new
convention.

[YOCTO #7605]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 lib/bb/fetch2/git.py  | 18 ++++++++++++------
 lib/bb/tests/fetch.py |  3 ++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 706fff5..374d846 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -371,25 +371,28 @@ class Git(FetchMethod):
         by searching through the tags output of ls-remote, comparing
         versions and returning the highest match.
         """
-        verstring = ""
+        pupver = ('', '')
+
         tagregex = re.compile(d.getVar('GITTAGREGEX', True) or "(?P<pver>([0-9][\.|_]?)+)")
         try:
             output = self._lsremote(ud, d, "refs/tags/*")
         except bb.fetch2.FetchError or bb.fetch2.NetworkAccess:
-            return ""
+            return pupver
 
+        verstring = ""
+        revision = ""
         for line in output.split("\n"):
             if not line:
                 break
 
-            line = line.split("/")[-1]
+            tag_head = line.split("/")[-1]
             # Ignore non-released branches
-            m = re.search("(alpha|beta|rc|final)+", line)
+            m = re.search("(alpha|beta|rc|final)+", tag_head)
             if m:
                 continue
 
             # search for version in the line
-            tag = tagregex.search(line)
+            tag = tagregex.search(tag_head)
             if tag == None:
                 continue
 
@@ -398,9 +401,12 @@ class Git(FetchMethod):
 
             if verstring and bb.utils.vercmp(("0", tag, ""), ("0", verstring, "")) < 0:
                 continue
+
             verstring = tag
+            revision = line.split()[0]
+            pupver = (verstring, revision)
 
-        return verstring
+        return pupver
 
     def _build_revision(self, ud, d, name):
         return ud.revisions[name]
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 13555bd..8dd8ddb 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -697,7 +697,8 @@ class FetchMethodTest(FetcherTest):
                 self.d.setVar("SRCREV", k[2])
                 self.d.setVar("GITTAGREGEX", k[3])
                 ud = bb.fetch2.FetchData(k[1], self.d)
-                verstring = ud.method.latest_versionstring(ud, self.d)
+                pupver= ud.method.latest_versionstring(ud, self.d)
+                verstring = pupver[0]
                 r = bb.utils.vercmp_string(v, verstring)
                 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
 
-- 
1.9.1



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

* [PATCH 3/4] fetch2/wget.py: latest_versionstring now returns (version, revision)
  2015-07-15  0:30 [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
  2015-07-15  0:30 ` [PATCH 1/4] fetch2/git.py: latest_versionstring search in all tags Aníbal Limón
  2015-07-15  0:30 ` [PATCH 2/4] fetch2/git.py: latest_versionstring now returns (version, revision) Aníbal Limón
@ 2015-07-15  0:30 ` Aníbal Limón
  2015-07-15  0:30 ` [PATCH 4/4] tests/fetch.py: Updated test name FetchMethodTest -> FetchLatestVersionTest Aníbal Limón
  2015-07-20 19:19 ` [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
  4 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2015-07-15  0:30 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alexander.kanavin

Now latest_versionstring method returns (version, revision) for comply
the new return convention needed by SCM's like git get the current
revision.

bb/tests/fetch.py: Updated wget latest_versionstring test for comply new
convention.

[YOCTO #7605]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 lib/bb/fetch2/wget.py | 12 ++++++------
 lib/bb/tests/fetch.py |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 545f02d..425b6b9 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -507,12 +507,12 @@ class Wget(FetchMethod):
         if not re.search("\d+", package):
             current_version[1] = re.sub('_', '.', current_version[1])
             current_version[1] = re.sub('-', '.', current_version[1])
-            return current_version[1]
+            return (current_version[1], '')
 
         package_regex = self._init_regexes(package, ud, d)
         if package_regex is None:
             bb.warn("latest_versionstring: package %s don't match pattern" % (package))
-            return ""
+            return ('', '')
         bb.debug(3, "latest_versionstring, regex: %s" % (package_regex.pattern))
 
         uri = ""
@@ -530,12 +530,12 @@ class Wget(FetchMethod):
 
                 dirver_pn_regex = re.compile("%s\d?" % (re.escape(pn)))
                 if not dirver_pn_regex.search(dirver):
-                    return self._check_latest_version_by_dir(dirver,
-                        package, package_regex, current_version, ud, d)
+                    return (self._check_latest_version_by_dir(dirver,
+                        package, package_regex, current_version, ud, d), '')
 
             uri = bb.fetch.encodeurl([ud.type, ud.host, path, ud.user, ud.pswd, {}])
         else:
             uri = regex_uri
 
-        return self._check_latest_version(uri, package, package_regex,
-                current_version, ud, d)
+        return (self._check_latest_version(uri, package, package_regex,
+                current_version, ud, d), '')
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 8dd8ddb..bfa31d0 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -708,7 +708,8 @@ class FetchMethodTest(FetcherTest):
                 self.d.setVar("REGEX_URI", k[2])
                 self.d.setVar("REGEX", k[3])
                 ud = bb.fetch2.FetchData(k[1], self.d)
-                verstring = ud.method.latest_versionstring(ud, self.d)
+                pupver = ud.method.latest_versionstring(ud, self.d)
+                verstring = pupver[0]
                 r = bb.utils.vercmp_string(v, verstring)
                 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
 
-- 
1.9.1



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

* [PATCH 4/4] tests/fetch.py: Updated test name FetchMethodTest -> FetchLatestVersionTest
  2015-07-15  0:30 [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
                   ` (2 preceding siblings ...)
  2015-07-15  0:30 ` [PATCH 3/4] fetch2/wget.py: " Aníbal Limón
@ 2015-07-15  0:30 ` Aníbal Limón
  2015-07-20 19:19 ` [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
  4 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2015-07-15  0:30 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alexander.kanavin

Change the test name to be more specific on what is tested.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 lib/bb/tests/fetch.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index bfa31d0..1e61f3a 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -630,7 +630,7 @@ class URLHandle(unittest.TestCase):
             result = bb.fetch.encodeurl(v)
             self.assertEqual(result, k)
 
-class FetchMethodTest(FetcherTest):
+class FetchLatestVersionTest(FetcherTest):
 
     test_git_uris = {
         # version pattern "X.Y.Z"
-- 
1.9.1



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

* Re: [PATCH 0/4] fetch2 latest_versionstring improvements
  2015-07-15  0:30 [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
                   ` (3 preceding siblings ...)
  2015-07-15  0:30 ` [PATCH 4/4] tests/fetch.py: Updated test name FetchMethodTest -> FetchLatestVersionTest Aníbal Limón
@ 2015-07-20 19:19 ` Aníbal Limón
  4 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2015-07-20 19:19 UTC (permalink / raw)
  To: bitbake-devel; +Cc: alexander.kanavin

ping...

On 14/07/15 19:30, Aníbal Limón wrote:
> Changes return of latest_versionstring method now returns current revision
> in SCM's like git.
>
> [YOCTO #7605]
>
> Aníbal Limón (4):
>    fetch2/git.py: latest_versionstring search in all tags
>    fetch2/git.py: latest_versionstring now returns (version, revision)
>    fetch2/wget.py: latest_versionstring now returns (version, revision)
>    tests/fetch.py: Updated test name FetchMethodTest ->
>      FetchLatestVersionTest
>
>   lib/bb/fetch2/git.py  | 20 +++++++++++++-------
>   lib/bb/fetch2/wget.py | 12 ++++++------
>   lib/bb/tests/fetch.py |  8 +++++---
>   3 files changed, 24 insertions(+), 16 deletions(-)
>



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

end of thread, other threads:[~2015-07-20 19:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-15  0:30 [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón
2015-07-15  0:30 ` [PATCH 1/4] fetch2/git.py: latest_versionstring search in all tags Aníbal Limón
2015-07-15  0:30 ` [PATCH 2/4] fetch2/git.py: latest_versionstring now returns (version, revision) Aníbal Limón
2015-07-15  0:30 ` [PATCH 3/4] fetch2/wget.py: " Aníbal Limón
2015-07-15  0:30 ` [PATCH 4/4] tests/fetch.py: Updated test name FetchMethodTest -> FetchLatestVersionTest Aníbal Limón
2015-07-20 19:19 ` [PATCH 0/4] fetch2 latest_versionstring improvements Aníbal Limón

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox