summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-07-14 19:30:57 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-22 08:23:49 +0100
commitbd5167d154ac04dbecbda3a157ae8ef6304e0b4e (patch)
treecd5928ca4f7f3f460836f07806c5fbe6a83a12dc /bitbake/lib
parent4bbc5dd6e7454cc35c263707453a6725bc0d54a5 (diff)
downloadpoky-bd5167d154ac04dbecbda3a157ae8ef6304e0b4e.tar.gz
bitbake: fetch2/git.py: latest_versionstring now returns (version, revision)
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] (Bitbake rev: fd175dc90024c503134c11cbd83e77d88c406ac8) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/git.py18
-rw-r--r--bitbake/lib/bb/tests/fetch.py3
2 files changed, 14 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 706fff5691..374d846798 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -371,25 +371,28 @@ class Git(FetchMethod):
371 by searching through the tags output of ls-remote, comparing 371 by searching through the tags output of ls-remote, comparing
372 versions and returning the highest match. 372 versions and returning the highest match.
373 """ 373 """
374 verstring = "" 374 pupver = ('', '')
375
375 tagregex = re.compile(d.getVar('GITTAGREGEX', True) or "(?P<pver>([0-9][\.|_]?)+)") 376 tagregex = re.compile(d.getVar('GITTAGREGEX', True) or "(?P<pver>([0-9][\.|_]?)+)")
376 try: 377 try:
377 output = self._lsremote(ud, d, "refs/tags/*") 378 output = self._lsremote(ud, d, "refs/tags/*")
378 except bb.fetch2.FetchError or bb.fetch2.NetworkAccess: 379 except bb.fetch2.FetchError or bb.fetch2.NetworkAccess:
379 return "" 380 return pupver
380 381
382 verstring = ""
383 revision = ""
381 for line in output.split("\n"): 384 for line in output.split("\n"):
382 if not line: 385 if not line:
383 break 386 break
384 387
385 line = line.split("/")[-1] 388 tag_head = line.split("/")[-1]
386 # Ignore non-released branches 389 # Ignore non-released branches
387 m = re.search("(alpha|beta|rc|final)+", line) 390 m = re.search("(alpha|beta|rc|final)+", tag_head)
388 if m: 391 if m:
389 continue 392 continue
390 393
391 # search for version in the line 394 # search for version in the line
392 tag = tagregex.search(line) 395 tag = tagregex.search(tag_head)
393 if tag == None: 396 if tag == None:
394 continue 397 continue
395 398
@@ -398,9 +401,12 @@ class Git(FetchMethod):
398 401
399 if verstring and bb.utils.vercmp(("0", tag, ""), ("0", verstring, "")) < 0: 402 if verstring and bb.utils.vercmp(("0", tag, ""), ("0", verstring, "")) < 0:
400 continue 403 continue
404
401 verstring = tag 405 verstring = tag
406 revision = line.split()[0]
407 pupver = (verstring, revision)
402 408
403 return verstring 409 return pupver
404 410
405 def _build_revision(self, ud, d, name): 411 def _build_revision(self, ud, d, name):
406 return ud.revisions[name] 412 return ud.revisions[name]
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 13555bd677..8dd8ddb071 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -697,7 +697,8 @@ class FetchMethodTest(FetcherTest):
697 self.d.setVar("SRCREV", k[2]) 697 self.d.setVar("SRCREV", k[2])
698 self.d.setVar("GITTAGREGEX", k[3]) 698 self.d.setVar("GITTAGREGEX", k[3])
699 ud = bb.fetch2.FetchData(k[1], self.d) 699 ud = bb.fetch2.FetchData(k[1], self.d)
700 verstring = ud.method.latest_versionstring(ud, self.d) 700 pupver= ud.method.latest_versionstring(ud, self.d)
701 verstring = pupver[0]
701 r = bb.utils.vercmp_string(v, verstring) 702 r = bb.utils.vercmp_string(v, verstring)
702 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) 703 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
703 704