]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cooker.py: Rearrange the code to allow init of new UIs
authorRichard Purdie <rpurdie@linux.intel.com>
Sat, 6 Dec 2008 13:09:42 +0000 (13:09 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Sat, 6 Dec 2008 13:09:42 +0000 (13:09 +0000)
lib/bb/cooker.py

index 2197a0e412ddee8236b3a992dcf76a779618eccf..06f3395d7aa445f13de2bbeba92d6f2610e9d725 100644 (file)
@@ -86,8 +86,6 @@ class BBCooker:
 
         self.configuration.data = bb.data.init()
 
-    def parseConfiguration(self):
-
         bb.data.inheritFromOS(self.configuration.data)
 
         for f in self.configuration.file:
@@ -118,13 +116,23 @@ class BBCooker:
                 tcattr[3] = tcattr[3] & ~termios.TOSTOP
                 termios.tcsetattr(fd, termios.TCSANOW, tcattr)
 
+        self.command = bb.command.Command(self)
+        self.cookerIdle = True
+        self.cookerState = cookerClean
+        self.cookerAction = cookerRun
+        self.server.register_idle_function(self.runCommands, self)
+
+    def parseConfiguration(self):
+
+
         # Change nice level if we're asked to
         nice = bb.data.getVar("BB_NICE_LEVEL", self.configuration.data, True)
         if nice:
             curnice = os.nice(0)
             nice = int(nice) - curnice
             bb.msg.note(2, bb.msg.domain.Build, "Renice to %s " % os.nice(nice))
+
+    def parseCommandLine(self):
         # Parse any commandline into actions
         if self.configuration.show_environment:
             self.commandlineAction = None
@@ -143,6 +151,9 @@ class BBCooker:
             self.commandlineAction = ["showVersions"]
         elif self.configuration.parse_only:
             self.commandlineAction = ["parseFiles"]
+        # FIXME - implement
+        #elif self.configuration.interactive:
+        #    self.interactiveMode()
         elif self.configuration.dot_graph:
             if self.configuration.pkgs_to_build:
                 self.commandlineAction = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd]
@@ -156,17 +167,6 @@ class BBCooker:
                 self.commandlineAction = None
                 bb.error("Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
 
-        # FIXME - implement
-        #if self.configuration.interactive:
-        #    self.interactiveMode()
-
-        self.command = bb.command.Command(self)
-        self.cookerIdle = True
-        self.cookerState = cookerClean
-        self.cookerAction = cookerRun
-        self.server.register_idle_function(self.runCommands, self)
-
-
     def runCommands(self, server, data, abort):
         """
         Run any queued asynchronous command
@@ -545,8 +545,6 @@ class BBCooker:
 
         except IOError, e:
             bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (afile, str(e)))
-        except IOError:
-            bb.msg.fatal(bb.msg.domain.Parsing, "Unable to open %s" % afile )
         except bb.parse.ParseError, details:
             bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (afile, details) )
 
@@ -619,6 +617,10 @@ class BBCooker:
         Build the file matching regexp buildfile
         """
 
+        # Parse the configuration here. We need to do it explicitly here since
+        # buildFile() doesn't use the cache
+        self.parseConfiguration()
+
         # If we are told to do the None task then query the default task
         if (task == None):
             task = self.configuration.cmd
@@ -743,6 +745,7 @@ class BBCooker:
 
     def updateCache(self):
 
+        self.parseConfiguration ()
         if self.cookerState == cookerParsed:
             return