]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake/fetch2/git: Fix a bug where AUTOREV and the git fetcher interact badly
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 19 Apr 2011 22:31:09 +0000 (23:31 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 May 2011 17:13:01 +0000 (18:13 +0100)
Fix a bug where ud.branches were being referenced before it was set by
the git fetcher when using AUTOREV. To do this some ordering needed
to be changed. This fixes errors like:

ERROR: Error parsing /recipes-kernel/linux/rt-tests_git.bb: Failure expanding variable
SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception
AttributeError: 'FetchData' object has no attribute 'branches'

(From Poky rev: 2d2d07275c8a2d652a221c1cd74d28c2f6f226d5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/fetch2/__init__.py
lib/bb/fetch2/git.py

index 9cfa3de9830a89c24e1b8099f205a4159efc5576..c515a6d4a834cead4bcf1b97a9d710c0a69e7fa4 100644 (file)
@@ -551,6 +551,9 @@ class FetchData(object):
         if not self.method:
             raise NoMethodError(url)
 
+        if hasattr(self.method, "urldata_init"):
+            self.method.urldata_init(self, d)
+
         if self.method.supports_srcrev():
             self.revisions = {}
             for name in self.names:
@@ -560,8 +563,8 @@ class FetchData(object):
             if len(self.names) == 1:
                 self.revision = self.revisions[self.names[0]]
 
-        if hasattr(self.method, "urldata_init"):
-            self.method.urldata_init(self, d)
+        if hasattr(self.method, "fixuprevisions"):
+            self.method.fixuprevisions(self, d)
 
         if "localpath" in self.parm:
             # if user sets localpath for file, use it instead.
index b5bcfcf0a50711e3099cc04a14edebce08de6c43..2114f2daad819bd1c4bc0846f530a706688b0de2 100644 (file)
@@ -72,16 +72,17 @@ class Git(FetchMethod):
 
         ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
 
+        ud.write_tarballs = (data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0"
+
+        ud.localfile = ud.clonedir
+
+def fixuprevisions(self, ud, d):
         for name in ud.names:
             # Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
             if not ud.revisions[name] or len(ud.revisions[name]) != 40  or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
                 ud.branches[name] = ud.revisions[name]
                 ud.revisions[name] = self.latest_revision(ud.url, ud, d, name)
 
-        ud.write_tarballs = (data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0"
-
-        ud.localfile = ud.clonedir
-
     def localpath(self, url, ud, d):
         return ud.clonedir