[bitbake-devel] [PATCH] bitbake: bb.fetch2.git: Fix _latest_revision function while using tags

Andrei Gherzan andrei at gherzan.ro
Sun Jan 5 01:53:28 UTC 2014


When getting the revision we must take into consideration if the name we are
looking for is a tag and in that case we need the dereferenced commit ID in
order to check for it existance in a specific branch.

So first search for the reference^{} commit ID and only if that returns nothing
get the name as it is.

Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
---
 bitbake/lib/bb/fetch2/git.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index b4b9368..1584232 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -318,9 +318,13 @@ class Git(FetchMethod):
               (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
         if ud.proto.lower() != 'file':
             bb.fetch2.check_network_access(d, cmd)
-        output = runfetchcmd(cmd, d, True)
+        # Maybe the ref is a tag so try to dereference it first
+        output = runfetchcmd(cmd + '^{}', d, True)
         if not output:
-            raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url)
+            # Dereference gave nothing so try to get it as it is
+            output = runfetchcmd(cmd, d, True)
+            if not output:
+                raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url)
         return output.split()[0]
 
     def _build_revision(self, ud, d, name):
-- 
1.8.1.4




More information about the bitbake-devel mailing list