summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-08 20:57:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-14 11:32:01 +0000
commit83a30dfd495f0b8e90b7b5725c946c659ecbd93d (patch)
treee9c4f702b9d02036602be3032afaaeb4493abf08 /bitbake/lib/bb/fetch2/git.py
parentc45589a55c67bfd0bf9da5050141f4d18835e113 (diff)
downloadpoky-83a30dfd495f0b8e90b7b5725c946c659ecbd93d.tar.gz
bitbake: fetch/git: Improve ls-remote handling for latest_revision
Currently the code ignores lightweight tags which has caused some user complaints. We can't put the right search list in place easily since the results don't come back in a good order, head happens to sort before tags. In the end I refactored the function so we get the complete list of remotes and then we can filter it ourselves in the order we chose, including checking for light weight tags, preferring the proper ones. Hopefully this resolves the issues people have been seeing. [YOCTO #6881] (Bitbake rev: 07ad307065bb15a48f0015b9e4a643201abdc283) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index f771fd02b6..44fc27193e 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -340,12 +340,19 @@ class Git(FetchMethod):
340 """ 340 """
341 Compute the HEAD revision for the url 341 Compute the HEAD revision for the url
342 """ 342 """
343 output = self._lsremote(ud, d, "")
344 # Tags of the form ^{} may not work, need to fallback to other form
343 if ud.unresolvedrev[name][:5] == "refs/": 345 if ud.unresolvedrev[name][:5] == "refs/":
344 search = "%s %s^{}" % (ud.unresolvedrev[name], ud.unresolvedrev[name]) 346 head = ud.unresolvedrev[name]
347 tag = ud.unresolvedrev[name]
345 else: 348 else:
346 search = "refs/heads/%s refs/tags/%s^{}" % (ud.unresolvedrev[name], ud.unresolvedrev[name]) 349 head = "refs/heads/%s" % ud.unresolvedrev[name]
347 output = self._lsremote(ud, d, search) 350 tag = "refs/tags/%s" % ud.unresolvedrev[name]
348 return output.split()[0] 351 for s in [head, tag + "^{}", tag]:
352 for l in output.split('\n'):
353 if s in l:
354 return l.split()[0]
355 raise bb.fetch2.FetchError("Unable to resolve '%s' in upstream git repository in git ls-remote output" % ud.unresolvedrev[name])
349 356
350 def latest_versionstring(self, ud, d): 357 def latest_versionstring(self, ud, d):
351 """ 358 """