summaryrefslogtreecommitdiffstats
path: root/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-21 00:05:44 +0100
commit35bd5997e8d8e74bc36019030cc10c560a8134f9 (patch)
treed4920bbda13ea03d0f6b6596116454e4a587bab0 /lib/bb/cookerdata.py
parent7d548568a55adfe84a976f2a549995e42da1afef (diff)
downloadbitbake-35bd5997e8d8e74bc36019030cc10c560a8134f9.tar.gz
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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/cookerdata.py')
-rw-r--r--lib/bb/cookerdata.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
new file mode 100644
index 000000000..2c3275ac6
--- /dev/null
+++ b/lib/bb/cookerdata.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright (C) 2003, 2004 Chris Larson
+# Copyright (C) 2003, 2004 Phil Blundell
+# Copyright (C) 2003 - 2005 Michael 'Mickey' Lauer
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# Copyright (C) 2005 ROAD GmbH
+# Copyright (C) 2006 Richard Purdie
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import os, sys
+from functools import wraps
+import logging
+from bb import data
+
+logger = logging.getLogger("BitBake")
+parselog = logging.getLogger("BitBake.Parsing")
+
+class ConfigParameters(object):
+ def __init__(self):
+ self.options, targets = self.parseCommandLine()
+ self.environment = self.parseEnvironment()
+
+ self.options.pkgs_to_build = targets or []
+
+ self.options.tracking = False
+ if self.options.show_environment:
+ self.options.tracking = True
+
+ for key, val in self.options.__dict__.items():
+ setattr(self, key, val)
+
+ def parseCommandLine(self):
+ raise Exception("Caller must implement commandline option parsing")
+
+ def parseEnvironment(self):
+ return os.environ.copy()
+
+class CookerConfiguration(object):
+ """
+ Manages build options and configurations for one run
+ """
+
+ def __init__(self):
+ self.debug_domains = []
+ self.extra_assume_provided = []
+ self.prefile = []
+ self.postfile = []
+ self.debug = 0
+ self.pkgs_to_build = []
+
+ def setConfigParameters(self, parameters):
+ self.params = parameters
+ for key, val in parameters.options.__dict__.items():
+ setattr(self, key, val)
+
+ def setServerRegIdleCallback(self, srcb):
+ self.server_register_idlecallback = srcb
+