diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-29 11:42:42 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-30 13:05:03 +0100 |
| commit | c0ff6c75eedea6e0f472b45456aed238073ac157 (patch) | |
| tree | fddaf6aa995681dc9e3e8d7a00db5949f48b409b | |
| parent | 849e26181d41f2c36898c5d81092c22f8adc1581 (diff) | |
| download | poky-c0ff6c75eedea6e0f472b45456aed238073ac157.tar.gz | |
bitbake: cooker: Simplify parser init function handling
Not sure why this is so convoluted but we should simplify it!
(Bitbake rev: 6195343c46ba9d2685fc2d42366922f88ff3f369)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 2264b18c54..d6fcd9e05c 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -2009,11 +2009,10 @@ class ParsingFailure(Exception): | |||
| 2009 | Exception.__init__(self, realexception, recipe) | 2009 | Exception.__init__(self, realexception, recipe) |
| 2010 | 2010 | ||
| 2011 | class Parser(multiprocessing.Process): | 2011 | class Parser(multiprocessing.Process): |
| 2012 | def __init__(self, jobs, results, quit, init, profile): | 2012 | def __init__(self, jobs, results, quit, profile): |
| 2013 | self.jobs = jobs | 2013 | self.jobs = jobs |
| 2014 | self.results = results | 2014 | self.results = results |
| 2015 | self.quit = quit | 2015 | self.quit = quit |
| 2016 | self.init = init | ||
| 2017 | multiprocessing.Process.__init__(self) | 2016 | multiprocessing.Process.__init__(self) |
| 2018 | self.context = bb.utils.get_context().copy() | 2017 | self.context = bb.utils.get_context().copy() |
| 2019 | self.handlers = bb.event.get_class_handlers().copy() | 2018 | self.handlers = bb.event.get_class_handlers().copy() |
| @@ -2037,8 +2036,12 @@ class Parser(multiprocessing.Process): | |||
| 2037 | prof.dump_stats(logfile) | 2036 | prof.dump_stats(logfile) |
| 2038 | 2037 | ||
| 2039 | def realrun(self): | 2038 | def realrun(self): |
| 2040 | if self.init: | 2039 | signal.signal(signal.SIGTERM, signal.SIG_DFL) |
| 2041 | self.init() | 2040 | signal.signal(signal.SIGHUP, signal.SIG_DFL) |
| 2041 | signal.signal(signal.SIGINT, signal.SIG_IGN) | ||
| 2042 | bb.utils.set_process_name(multiprocessing.current_process().name) | ||
| 2043 | multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, exitpriority=1) | ||
| 2044 | multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1) | ||
| 2042 | 2045 | ||
| 2043 | pending = [] | 2046 | pending = [] |
| 2044 | try: | 2047 | try: |
| @@ -2143,13 +2146,6 @@ class CookerParser(object): | |||
| 2143 | self.processes = [] | 2146 | self.processes = [] |
| 2144 | if self.toparse: | 2147 | if self.toparse: |
| 2145 | bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata) | 2148 | bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata) |
| 2146 | def init(): | ||
| 2147 | signal.signal(signal.SIGTERM, signal.SIG_DFL) | ||
| 2148 | signal.signal(signal.SIGHUP, signal.SIG_DFL) | ||
| 2149 | signal.signal(signal.SIGINT, signal.SIG_IGN) | ||
| 2150 | bb.utils.set_process_name(multiprocessing.current_process().name) | ||
| 2151 | multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, exitpriority=1) | ||
| 2152 | multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1) | ||
| 2153 | 2149 | ||
| 2154 | self.parser_quit = multiprocessing.Queue(maxsize=self.num_processes) | 2150 | self.parser_quit = multiprocessing.Queue(maxsize=self.num_processes) |
| 2155 | self.result_queue = multiprocessing.Queue() | 2151 | self.result_queue = multiprocessing.Queue() |
| @@ -2159,7 +2155,7 @@ class CookerParser(object): | |||
| 2159 | self.jobs = chunkify(list(self.willparse), self.num_processes) | 2155 | self.jobs = chunkify(list(self.willparse), self.num_processes) |
| 2160 | 2156 | ||
| 2161 | for i in range(0, self.num_processes): | 2157 | for i in range(0, self.num_processes): |
| 2162 | parser = Parser(self.jobs[i], self.result_queue, self.parser_quit, init, self.cooker.configuration.profile) | 2158 | parser = Parser(self.jobs[i], self.result_queue, self.parser_quit, self.cooker.configuration.profile) |
| 2163 | parser.start() | 2159 | parser.start() |
| 2164 | self.process_names.append(parser.name) | 2160 | self.process_names.append(parser.name) |
| 2165 | self.processes.append(parser) | 2161 | self.processes.append(parser) |
