summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cookerdata.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-20 22:54:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-22 12:10:13 +0100
commitf242f5060bbc62815b6d5a245c1a9bf18f23675f (patch)
tree61aa4d66293ea4a4ea703e10499b13209affbbb1 /bitbake/lib/bb/cookerdata.py
parent308ae9210067da0348f2cf2b6d56a7dce5b45936 (diff)
downloadpoky-f242f5060bbc62815b6d5a245c1a9bf18f23675f.tar.gz
bitbake: bitbake: Create cookerdata splitting config from cooker and bin/bitbake
Currently the UI and server configuration is one big incestuous mess. To start to untangle this we creater cookerdata, a new module which contains various confiuration modules and the code for building the base datastore. To start with we add a ConfigParameters() class which contains information about both the commandline configuration and the original environment. The CookerConfiguration class is created to contain the cooker.configuration options. This means we can transfer new paramters to the server over something like XMLRPC and then build a new configuration from these on the server. Based on a patch from Alexandru Damian <alexandru.damian@intel.com> (Bitbake rev: 35bd5997e8d8e74bc36019030cc10c560a8134f9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cookerdata.py')
-rw-r--r--bitbake/lib/bb/cookerdata.py73
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
25import os, sys
26from functools import wraps
27import logging
28from bb import data
29
30logger = logging.getLogger("BitBake")
31parselog = logging.getLogger("BitBake.Parsing")
32
33class 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
53class 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