diff options
author | Rob Bradford <rob@linux.intel.com> | 2008-10-28 11:27:58 +0000 |
---|---|---|
committer | Rob Bradford <rob@linux.intel.com> | 2008-10-28 11:40:03 +0000 |
commit | 0b6fdfb14d7de5d087055574beb3abfd7d9e6931 (patch) | |
tree | 8de03f9c2944de43908602ad59d5c5fb27c9b44e /bitbake-dev/lib | |
parent | 0b9da42bb5c2355fe6b2a71f3a4970ac46118caa (diff) | |
download | poky-0b6fdfb14d7de5d087055574beb3abfd7d9e6931.tar.gz |
bitbake-dev: Refactor configuration file parsing
Separate the parsing of the configuration files / recipes into a separate
function to the parsing of the command line. This parsing of the configuration
files now happens when updateCache() is called.
Some functionality has been moved from parseConfiguration() to __init__.
Diffstat (limited to 'bitbake-dev/lib')
-rw-r--r-- | bitbake-dev/lib/bb/cooker.py | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/bitbake-dev/lib/bb/cooker.py b/bitbake-dev/lib/bb/cooker.py index c9afadbc97..6dde5de0f8 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 |
@@ -731,6 +726,7 @@ class BBCooker: | |||
731 | 726 | ||
732 | def updateCache(self): | 727 | def updateCache(self): |
733 | 728 | ||
729 | self.parseConfiguration () | ||
734 | if self.cookerState == cookerParsed: | 730 | if self.cookerState == cookerParsed: |
735 | return | 731 | return |
736 | 732 | ||