diff options
Diffstat (limited to 'bitbake-dev/lib/bb/cooker.py')
-rw-r--r-- | bitbake-dev/lib/bb/cooker.py | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/bitbake-dev/lib/bb/cooker.py b/bitbake-dev/lib/bb/cooker.py index c9afadbc97..ead76ca6ba 100644 --- a/bitbake-dev/lib/bb/cooker.py +++ b/bitbake-dev/lib/bb/cooker.py | |||
@@ -86,10 +86,31 @@ class BBCooker: | |||
86 | 86 | ||
87 | self.configuration.data = bb.data.init() | 87 | self.configuration.data = bb.data.init() |
88 | 88 | ||
89 | def parseConfiguration(self): | ||
90 | |||
91 | bb.data.inheritFromOS(self.configuration.data) | 89 | bb.data.inheritFromOS(self.configuration.data) |
92 | 90 | ||
91 | # TOSTOP must not be set or our children will hang when they output | ||
92 | fd = sys.stdout.fileno() | ||
93 | if os.isatty(fd): | ||
94 | import termios | ||
95 | tcattr = termios.tcgetattr(fd) | ||
96 | if tcattr[3] & termios.TOSTOP: | ||
97 | bb.msg.note(1, bb.msg.domain.Build, "The terminal had the TOSTOP bit set, clearing...") | ||
98 | tcattr[3] = tcattr[3] & ~termios.TOSTOP | ||
99 | termios.tcsetattr(fd, termios.TCSANOW, tcattr) | ||
100 | |||
101 | self.command = bb.command.Command(self) | ||
102 | self.cookerIdle = True | ||
103 | self.cookerState = cookerClean | ||
104 | self.cookerAction = cookerRun | ||
105 | self.server.register_idle_function(self.runCommands, self) | ||
106 | |||
107 | def parseConfiguration(self): | ||
108 | # | ||
109 | # Special updated configuration we use for firing events | ||
110 | # | ||
111 | self.configuration.event_data = bb.data.createCopy(self.configuration.data) | ||
112 | bb.data.update_data(self.configuration.event_data) | ||
113 | |||
93 | for f in self.configuration.file: | 114 | for f in self.configuration.file: |
94 | self.parseConfigurationFile( f ) | 115 | self.parseConfigurationFile( f ) |
95 | 116 | ||
@@ -102,29 +123,14 @@ class BBCooker: | |||
102 | if bbpkgs: | 123 | if bbpkgs: |
103 | self.configuration.pkgs_to_build.extend(bbpkgs.split()) | 124 | self.configuration.pkgs_to_build.extend(bbpkgs.split()) |
104 | 125 | ||
105 | # | ||
106 | # Special updated configuration we use for firing events | ||
107 | # | ||
108 | self.configuration.event_data = bb.data.createCopy(self.configuration.data) | ||
109 | bb.data.update_data(self.configuration.event_data) | ||
110 | |||
111 | # TOSTOP must not be set or our children will hang when they output | ||
112 | fd = sys.stdout.fileno() | ||
113 | if os.isatty(fd): | ||
114 | import termios | ||
115 | tcattr = termios.tcgetattr(fd) | ||
116 | if tcattr[3] & termios.TOSTOP: | ||
117 | bb.msg.note(1, bb.msg.domain.Build, "The terminal had the TOSTOP bit set, clearing...") | ||
118 | tcattr[3] = tcattr[3] & ~termios.TOSTOP | ||
119 | termios.tcsetattr(fd, termios.TCSANOW, tcattr) | ||
120 | |||
121 | # Change nice level if we're asked to | 126 | # Change nice level if we're asked to |
122 | nice = bb.data.getVar("BB_NICE_LEVEL", self.configuration.data, True) | 127 | nice = bb.data.getVar("BB_NICE_LEVEL", self.configuration.data, True) |
123 | if nice: | 128 | if nice: |
124 | curnice = os.nice(0) | 129 | curnice = os.nice(0) |
125 | nice = int(nice) - curnice | 130 | nice = int(nice) - curnice |
126 | bb.msg.note(2, bb.msg.domain.Build, "Renice to %s " % os.nice(nice)) | 131 | bb.msg.note(2, bb.msg.domain.Build, "Renice to %s " % os.nice(nice)) |
127 | 132 | ||
133 | def parseCommandLine(self): | ||
128 | # Parse any commandline into actions | 134 | # Parse any commandline into actions |
129 | if self.configuration.show_environment: | 135 | if self.configuration.show_environment: |
130 | self.commandlineAction = None | 136 | self.commandlineAction = None |
@@ -156,17 +162,6 @@ class BBCooker: | |||
156 | self.commandlineAction = None | 162 | self.commandlineAction = None |
157 | bb.error("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") | 163 | bb.error("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") |
158 | 164 | ||
159 | # FIXME - implement | ||
160 | #if self.configuration.interactive: | ||
161 | # self.interactiveMode() | ||
162 | |||
163 | self.command = bb.command.Command(self) | ||
164 | self.cookerIdle = True | ||
165 | self.cookerState = cookerClean | ||
166 | self.cookerAction = cookerRun | ||
167 | self.server.register_idle_function(self.runCommands, self) | ||
168 | |||
169 | |||
170 | def runCommands(self, server, data, abort): | 165 | def runCommands(self, server, data, abort): |
171 | """ | 166 | """ |
172 | Run any queued asynchronous command | 167 | Run any queued asynchronous command |
@@ -310,6 +305,10 @@ class BBCooker: | |||
310 | # Need files parsed | 305 | # Need files parsed |
311 | self.updateCache() | 306 | self.updateCache() |
312 | 307 | ||
308 | # If we are told to do the None task then query the default task | ||
309 | if (task == None): | ||
310 | task = self.configuration.cmd | ||
311 | |||
313 | pkgs_to_build = self.checkPackages(pkgs_to_build) | 312 | pkgs_to_build = self.checkPackages(pkgs_to_build) |
314 | 313 | ||
315 | localdata = data.createCopy(self.configuration.data) | 314 | localdata = data.createCopy(self.configuration.data) |
@@ -615,6 +614,14 @@ class BBCooker: | |||
615 | Build the file matching regexp buildfile | 614 | Build the file matching regexp buildfile |
616 | """ | 615 | """ |
617 | 616 | ||
617 | # Parse the configuration here. We need to do it explicitly here since | ||
618 | # buildFile() doesn't use the cache | ||
619 | self.parseConfiguration() | ||
620 | |||
621 | # If we are told to do the None task then query the default task | ||
622 | if (task == None): | ||
623 | task = self.configuration.cmd | ||
624 | |||
618 | fn = self.matchFile(buildfile) | 625 | fn = self.matchFile(buildfile) |
619 | self.buildSetVars() | 626 | self.buildSetVars() |
620 | 627 | ||
@@ -685,6 +692,10 @@ class BBCooker: | |||
685 | # Need files parsed | 692 | # Need files parsed |
686 | self.updateCache() | 693 | self.updateCache() |
687 | 694 | ||
695 | # If we are told to do the NULL task then query the default task | ||
696 | if (task == None): | ||
697 | task = self.configuration.cmd | ||
698 | |||
688 | targets = self.checkPackages(targets) | 699 | targets = self.checkPackages(targets) |
689 | 700 | ||
690 | def buildTargetsIdle(server, rq, abort): | 701 | def buildTargetsIdle(server, rq, abort): |
@@ -731,6 +742,7 @@ class BBCooker: | |||
731 | 742 | ||
732 | def updateCache(self): | 743 | def updateCache(self): |
733 | 744 | ||
745 | self.parseConfiguration () | ||
734 | if self.cookerState == cookerParsed: | 746 | if self.cookerState == cookerParsed: |
735 | return | 747 | return |
736 | 748 | ||