diff options
Diffstat (limited to 'bitbake/lib/bb/cookerdata.py')
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py new file mode 100644 index 0000000000..2c3275ac65 --- /dev/null +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -0,0 +1,73 @@ | |||
1 | #!/usr/bin/env python | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | # Copyright (C) 2003, 2004 Chris Larson | ||
6 | # Copyright (C) 2003, 2004 Phil Blundell | ||
7 | # Copyright (C) 2003 - 2005 Michael 'Mickey' Lauer | ||
8 | # Copyright (C) 2005 Holger Hans Peter Freyther | ||
9 | # Copyright (C) 2005 ROAD GmbH | ||
10 | # Copyright (C) 2006 Richard Purdie | ||
11 | # | ||
12 | # This program is free software; you can redistribute it and/or modify | ||
13 | # it under the terms of the GNU General Public License version 2 as | ||
14 | # published by the Free Software Foundation. | ||
15 | # | ||
16 | # This program is distributed in the hope that it will be useful, | ||
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | # GNU General Public License for more details. | ||
20 | # | ||
21 | # You should have received a copy of the GNU General Public License along | ||
22 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
24 | |||
25 | import os, sys | ||
26 | from functools import wraps | ||
27 | import logging | ||
28 | from bb import data | ||
29 | |||
30 | logger = logging.getLogger("BitBake") | ||
31 | parselog = logging.getLogger("BitBake.Parsing") | ||
32 | |||
33 | class ConfigParameters(object): | ||
34 | def __init__(self): | ||
35 | self.options, targets = self.parseCommandLine() | ||
36 | self.environment = self.parseEnvironment() | ||
37 | |||
38 | self.options.pkgs_to_build = targets or [] | ||
39 | |||
40 | self.options.tracking = False | ||
41 | if self.options.show_environment: | ||
42 | self.options.tracking = True | ||
43 | |||
44 | for key, val in self.options.__dict__.items(): | ||
45 | setattr(self, key, val) | ||
46 | |||
47 | def parseCommandLine(self): | ||
48 | raise Exception("Caller must implement commandline option parsing") | ||
49 | |||
50 | def parseEnvironment(self): | ||
51 | return os.environ.copy() | ||
52 | |||
53 | class CookerConfiguration(object): | ||
54 | """ | ||
55 | Manages build options and configurations for one run | ||
56 | """ | ||
57 | |||
58 | def __init__(self): | ||
59 | self.debug_domains = [] | ||
60 | self.extra_assume_provided = [] | ||
61 | self.prefile = [] | ||
62 | self.postfile = [] | ||
63 | self.debug = 0 | ||
64 | self.pkgs_to_build = [] | ||
65 | |||
66 | def setConfigParameters(self, parameters): | ||
67 | self.params = parameters | ||
68 | for key, val in parameters.options.__dict__.items(): | ||
69 | setattr(self, key, val) | ||
70 | |||
71 | def setServerRegIdleCallback(self, srcb): | ||
72 | self.server_register_idlecallback = srcb | ||
73 | |||