bitbake/bin/bitbake: Make sure we add all handlers from INHERIT
authorHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 25 May 2006 21:38:06 +0000 (21:38 +0000)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 25 May 2006 21:38:06 +0000 (21:38 +0000)
    The code had the assumption that at least one .inc
    file was included (always included). This is not true
    in the NSLu2 case. The code now makes sure we load each
    bbclass we have in the INHERIT line either directly or
    indirectly. And then we can safely add all event handlers.

    Todo: Add HANDLERS += to only load the HANDLERS and not
    all classes.

bin/bitbake

index 67322b0..6546ac4 100755 (executable)
@@ -859,11 +859,19 @@ class BBCooker:
         try:
             self.configuration.data = bb.parse.handle( afile, self.configuration.data )
 
-            # Add the handlers we inherited by INHERITS
+            # 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()
+            for inherit in inherits:
+                data = bb.parse.handle( os.path.join('classes', '%s.bbclass' % inherit ), data, True )
+
             # FIXME: This assumes that we included at least one .inc file
-            for var in bb.data.keys(self.configuration.data):
-                if bb.data.getVarFlag(var, 'handler', self.configuration.data):
-                    bb.event.register(var,bb.data.getVar(var,self.configuration.data))
+            for var in bb.data.keys(data):
+                if bb.data.getVarFlag(var, 'handler', data):
+                    bb.event.register(var,bb.data.getVar(var, data))
 
         except IOError:
             bb.fatal( "Unable to open %s" % afile )