cooker, BBHandler: Change parseConfigurationFile so it works on real data, not a...
authorRichard Purdie <rpurdie@linux.intel.com>
Sat, 23 Feb 2008 17:54:00 +0000 (17:54 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Sat, 23 Feb 2008 17:54:00 +0000 (17:54 +0000)
ChangeLog
lib/bb/cooker.py
lib/bb/parse/parse_py/BBHandler.py

index 7e6b7b2..8089bc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 Changes in BitBake 1.8.x:
        - Fix exit code for build failures in --continue mode
        - Fix git branch tags fetching
+       - Change parseConfigurationFile so it works on real data, not a copy
+       - Handle 'base' inherit and all other INHERITs from parseConfigurationFile 
+         instead of BBHandler
 
 Changes in BitBake 1.8.10:
        - Psyco is available only for x86 - do not use it on other architectures.
index 2c091b6..4edc5a2 100644 (file)
@@ -387,19 +387,15 @@ class BBCooker:
         try:
             self.configuration.data = bb.parse.handle( afile, self.configuration.data )
 
-            # Add the handlers we inherited by INHERIT
-            # we need to do this manually as it is not guranteed
-            # we will pick up these classes... as we only INHERIT
-            # on .inc and .bb files but not on .conf
-            data = bb.data.createCopy( self.configuration.data )
-            inherits  = ["base"] + (bb.data.getVar('INHERIT', data, True ) or "").split()
+            # Handle any INHERITs and inherit the base class
+            inherits  = ["base"] + (bb.data.getVar('INHERIT', self.configuration.data, True ) or "").split()
             for inherit in inherits:
-                data = bb.parse.handle( os.path.join('classes', '%s.bbclass' % inherit ), data, True )
+                self.configuration.data = bb.parse.handle(os.path.join('classes', '%s.bbclass' % inherit), self.configuration.data, True )
 
-            # FIXME: This assumes that we included at least one .inc file
-            for var in bb.data.keys(data):
-                if bb.data.getVarFlag(var, 'handler', data):
-                    bb.event.register(var,bb.data.getVar(var, data))
+            # Nomally we only register event handlers at the end of parsing .bb files
+            # We register any handlers we've found so far here...
+            for var in data.getVar('__BBHANDLERS', self.configuration.data) or []:
+                bb.event.register(var,bb.data.getVar(var, self.configuration.data))
 
             bb.fetch.fetcher_init(self.configuration.data)
 
index 2a30e58..c4f555f 100644 (file)
@@ -95,6 +95,10 @@ def handle(fn, d, include = 0):
     if ext == ".bbclass":
         __classname__ = root
         classes.append(__classname__)
+        __inherit_cache = data.getVar('__inherit_cache', d) or []
+        if not fn in __inherit_cache:
+            __inherit_cache.append(fn)
+            data.setVar('__inherit_cache', __inherit_cache, d)
 
     if include != 0:
         oldfile = data.getVar('FILE', d)
@@ -126,10 +130,6 @@ def handle(fn, d, include = 0):
 
     if ext != ".bbclass":
         data.setVar('FILE', fn, d)
-        i = (data.getVar("INHERIT", d, 1) or "").split()
-        if not "base" in i and __classname__ != "base":
-            i[0:0] = ["base"]
-        inherit(i, d)
 
     lineno = 0
     while 1:
@@ -171,10 +171,8 @@ def handle(fn, d, include = 0):
             all_handlers = {} 
             for var in data.getVar('__BBHANDLERS', d) or []:
                 # try to add the handler
-                # if we added it remember the choiche
                 handler = data.getVar(var,d)
-                if bb.event.register(var,handler) == bb.event.Registered:
-                    all_handlers[var] = handler
+                bb.event.register(var, handler)
 
             tasklist = {}
             for var in data.getVar('__BBTASKS', d) or []:
@@ -194,10 +192,6 @@ def handle(fn, d, include = 0):
 
             bb.build.add_tasks(tasklist, d)
 
-            # now add the handlers
-            if not len(all_handlers) == 0:
-                data.setVar('__all_handlers__', all_handlers, d)
-
         bbpath.pop(0)
     if oldfile:
         bb.data.setVar("FILE", oldfile, d)