* [PATCH 01/15] data_smart: fix resetting of reference on variablehistory
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 02/15] knotty: make quiet option a level option Paul Eggleton
` (13 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
There is no "datasmart" member, only dataroot. This dates back to the
original implementation of variable history support - it's surprising we
haven't noticed the issue until now, but I guess it's rare to change a
copy of a datastore in a manner which using the old reference would
cause an issue.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/data_smart.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index be43eb9..17768c8 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -844,7 +844,7 @@ class DataSmart(MutableMapping):
data = DataSmart()
data.dict["_data"] = self.dict
data.varhistory = self.varhistory.copy()
- data.varhistory.datasmart = data
+ data.varhistory.dataroot = data
data.inchistory = self.inchistory.copy()
data._tracking = self._tracking
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 02/15] knotty: make quiet option a level option
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
2016-12-13 7:07 ` [PATCH 01/15] data_smart: fix resetting of reference on variablehistory Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 9:21 ` Joshua Lock
2016-12-13 7:07 ` [PATCH 03/15] knotty: fix --observe-only option Paul Eggleton
` (12 subsequent siblings)
14 siblings, 1 reply; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
Allow you to specify -q / --quiet more than once to reduce the messages
even further. It will now operate as follows:
Level Option Result
----- ------ ----------------------------------------
0 Print usual output
1 -q Only show progress and warnings or above
2 -qq Only show warnings or above
3+ -qqq Only show errors
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/main.py | 4 ++--
lib/bb/ui/knotty.py | 35 ++++++++++++++++++++++++++++-------
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/lib/bb/main.py b/lib/bb/main.py
index f2f59f6..a544c0a 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -179,8 +179,8 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters):
parser.add_option("-D", "--debug", action="count", dest="debug", default=0,
help="Increase the debug level. You can specify this more than once.")
- parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False,
- help="Output less log message data to the terminal.")
+ parser.add_option("-q", "--quiet", action="count", dest="quiet", default=0,
+ help="Output less log message data to the terminal. You can specify this more than once.")
parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False,
help="Don't execute, just go through the motions.")
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 48e1223..3390eb7 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -284,7 +284,7 @@ class TerminalFilter(object):
content = self.main_progress.update(progress)
print('')
lines = 1 + int(len(content) / (self.columns + 1))
- if not self.quiet:
+ if self.quiet == 0:
for tasknum, task in enumerate(tasks[:(self.rows - 2)]):
if isinstance(task, tuple):
pbar, progress, rate, start_time = task
@@ -353,10 +353,13 @@ def main(server, eventHandler, params, tf = TerminalFilter):
errconsole = logging.StreamHandler(sys.stderr)
format_str = "%(levelname)s: %(message)s"
format = bb.msg.BBLogFormatter(format_str)
- if params.options.quiet:
- bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut, bb.msg.BBLogFormatter.WARNING)
+ if params.options.quiet == 0:
+ forcelevel = None
+ elif params.options.quiet > 2:
+ forcelevel = bb.msg.BBLogFormatter.ERROR
else:
- bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut)
+ forcelevel = bb.msg.BBLogFormatter.WARNING
+ bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut, forcelevel)
bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr)
console.setFormatter(format)
errconsole.setFormatter(format)
@@ -506,35 +509,47 @@ def main(server, eventHandler, params, tf = TerminalFilter):
logger.info(event._message)
continue
if isinstance(event, bb.event.ParseStarted):
+ if params.options.quiet > 1:
+ continue
if event.total == 0:
continue
parseprogress = new_progress("Parsing recipes", event.total).start()
continue
if isinstance(event, bb.event.ParseProgress):
+ if params.options.quiet > 1:
+ continue
if parseprogress:
parseprogress.update(event.current)
else:
bb.warn("Got ParseProgress event for parsing that never started?")
continue
if isinstance(event, bb.event.ParseCompleted):
+ if params.options.quiet > 1:
+ continue
if not parseprogress:
continue
parseprogress.finish()
pasreprogress = None
- if not params.options.quiet:
+ if params.options.quiet == 0:
print(("Parsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
% ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
continue
if isinstance(event, bb.event.CacheLoadStarted):
+ if params.options.quiet > 1:
+ continue
cacheprogress = new_progress("Loading cache", event.total).start()
continue
if isinstance(event, bb.event.CacheLoadProgress):
+ if params.options.quiet > 1:
+ continue
cacheprogress.update(event.current)
continue
if isinstance(event, bb.event.CacheLoadCompleted):
+ if params.options.quiet > 1:
+ continue
cacheprogress.finish()
- if not params.options.quiet:
+ if params.options.quiet == 0:
print("Loaded %d entries from dependency cache." % event.num_entries)
continue
@@ -620,16 +635,22 @@ def main(server, eventHandler, params, tf = TerminalFilter):
continue
if isinstance(event, bb.event.ProcessStarted):
+ if params.options.quiet > 1:
+ continue
parseprogress = new_progress(event.processname, event.total)
parseprogress.start(False)
continue
if isinstance(event, bb.event.ProcessProgress):
+ if params.options.quiet > 1:
+ continue
if parseprogress:
parseprogress.update(event.progress)
else:
bb.warn("Got ProcessProgress event for someting that never started?")
continue
if isinstance(event, bb.event.ProcessFinished):
+ if params.options.quiet > 1:
+ continue
if parseprogress:
parseprogress.finish()
parseprogress = None
@@ -701,7 +722,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
if return_value and errors:
summary += pluralise("\nSummary: There was %s ERROR message shown, returning a non-zero exit code.",
"\nSummary: There were %s ERROR messages shown, returning a non-zero exit code.", errors)
- if summary and not params.options.quiet:
+ if summary and params.options.quiet == 0:
print(summary)
if interrupted:
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 02/15] knotty: make quiet option a level option
2016-12-13 7:07 ` [PATCH 02/15] knotty: make quiet option a level option Paul Eggleton
@ 2016-12-13 9:21 ` Joshua Lock
0 siblings, 0 replies; 17+ messages in thread
From: Joshua Lock @ 2016-12-13 9:21 UTC (permalink / raw)
To: Paul Eggleton, bitbake-devel
On Tue, 2016-12-13 at 20:07 +1300, Paul Eggleton wrote:
> Allow you to specify -q / --quiet more than once to reduce the
> messages
> even further. It will now operate as follows:
>
> Level Option Result
> ----- ------ ----------------------------------------
> 0 Print usual output
> 1 -q Only show progress and warnings or above
> 2 -qq Only show warnings or above
> 3+ -qqq Only show errors
I like this change, can we document the levels somewhere other than the
commit message?
Thanks,
Joshua
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
> lib/bb/main.py | 4 ++--
> lib/bb/ui/knotty.py | 35 ++++++++++++++++++++++++++++-------
> 2 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/lib/bb/main.py b/lib/bb/main.py
> index f2f59f6..a544c0a 100755
> --- a/lib/bb/main.py
> +++ b/lib/bb/main.py
> @@ -179,8 +179,8 @@ class
> BitBakeConfigParameters(cookerdata.ConfigParameters):
> parser.add_option("-D", "--debug", action="count",
> dest="debug", default=0,
> help="Increase the debug level. You can
> specify this more than once.")
>
> - parser.add_option("-q", "--quiet", action="store_true",
> dest="quiet", default=False,
> - help="Output less log message data to the
> terminal.")
> + parser.add_option("-q", "--quiet", action="count",
> dest="quiet", default=0,
> + help="Output less log message data to the
> terminal. You can specify this more than once.")
>
> parser.add_option("-n", "--dry-run", action="store_true",
> dest="dry_run", default=False,
> help="Don't execute, just go through the
> motions.")
> diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
> index 48e1223..3390eb7 100644
> --- a/lib/bb/ui/knotty.py
> +++ b/lib/bb/ui/knotty.py
> @@ -284,7 +284,7 @@ class TerminalFilter(object):
> content = self.main_progress.update(progress)
> print('')
> lines = 1 + int(len(content) / (self.columns + 1))
> - if not self.quiet:
> + if self.quiet == 0:
> for tasknum, task in enumerate(tasks[:(self.rows - 2)]):
> if isinstance(task, tuple):
> pbar, progress, rate, start_time = task
> @@ -353,10 +353,13 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
> errconsole = logging.StreamHandler(sys.stderr)
> format_str = "%(levelname)s: %(message)s"
> format = bb.msg.BBLogFormatter(format_str)
> - if params.options.quiet:
> - bb.msg.addDefaultlogFilter(console,
> bb.msg.BBLogFilterStdOut, bb.msg.BBLogFormatter.WARNING)
> + if params.options.quiet == 0:
> + forcelevel = None
> + elif params.options.quiet > 2:
> + forcelevel = bb.msg.BBLogFormatter.ERROR
> else:
> - bb.msg.addDefaultlogFilter(console,
> bb.msg.BBLogFilterStdOut)
> + forcelevel = bb.msg.BBLogFormatter.WARNING
> + bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut,
> forcelevel)
> bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr)
> console.setFormatter(format)
> errconsole.setFormatter(format)
> @@ -506,35 +509,47 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
> logger.info(event._message)
> continue
> if isinstance(event, bb.event.ParseStarted):
> + if params.options.quiet > 1:
> + continue
> if event.total == 0:
> continue
> parseprogress = new_progress("Parsing recipes",
> event.total).start()
> continue
> if isinstance(event, bb.event.ParseProgress):
> + if params.options.quiet > 1:
> + continue
> if parseprogress:
> parseprogress.update(event.current)
> else:
> bb.warn("Got ParseProgress event for parsing
> that never started?")
> continue
> if isinstance(event, bb.event.ParseCompleted):
> + if params.options.quiet > 1:
> + continue
> if not parseprogress:
> continue
> parseprogress.finish()
> pasreprogress = None
> - if not params.options.quiet:
> + if params.options.quiet == 0:
> print(("Parsing of %d .bb files complete (%d
> cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
> % ( event.total, event.cached, event.parsed,
> event.virtuals, event.skipped, event.masked, event.errors)))
> continue
>
> if isinstance(event, bb.event.CacheLoadStarted):
> + if params.options.quiet > 1:
> + continue
> cacheprogress = new_progress("Loading cache",
> event.total).start()
> continue
> if isinstance(event, bb.event.CacheLoadProgress):
> + if params.options.quiet > 1:
> + continue
> cacheprogress.update(event.current)
> continue
> if isinstance(event, bb.event.CacheLoadCompleted):
> + if params.options.quiet > 1:
> + continue
> cacheprogress.finish()
> - if not params.options.quiet:
> + if params.options.quiet == 0:
> print("Loaded %d entries from dependency cache."
> % event.num_entries)
> continue
>
> @@ -620,16 +635,22 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
> continue
>
> if isinstance(event, bb.event.ProcessStarted):
> + if params.options.quiet > 1:
> + continue
> parseprogress = new_progress(event.processname,
> event.total)
> parseprogress.start(False)
> continue
> if isinstance(event, bb.event.ProcessProgress):
> + if params.options.quiet > 1:
> + continue
> if parseprogress:
> parseprogress.update(event.progress)
> else:
> bb.warn("Got ProcessProgress event for someting
> that never started?")
> continue
> if isinstance(event, bb.event.ProcessFinished):
> + if params.options.quiet > 1:
> + continue
> if parseprogress:
> parseprogress.finish()
> parseprogress = None
> @@ -701,7 +722,7 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
> if return_value and errors:
> summary += pluralise("\nSummary: There was %s ERROR
> message shown, returning a non-zero exit code.",
> "\nSummary: There were %s ERROR
> messages shown, returning a non-zero exit code.", errors)
> - if summary and not params.options.quiet:
> + if summary and params.options.quiet == 0:
> print(summary)
>
> if interrupted:
> --
> 2.5.5
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 03/15] knotty: fix --observe-only option
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
2016-12-13 7:07 ` [PATCH 01/15] data_smart: fix resetting of reference on variablehistory Paul Eggleton
2016-12-13 7:07 ` [PATCH 02/15] knotty: make quiet option a level option Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 04/15] server/xmlrpc: send back 503 response with correct encoding Paul Eggleton
` (11 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
If we're in observe-only mode then we cannot run commands that would
affect the server's state, including getSetVariable, so prevent that
from being called in observe-only mode.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/ui/knotty.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 3390eb7..521c262 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -312,7 +312,7 @@ class TerminalFilter(object):
fd = sys.stdin.fileno()
self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
-def _log_settings_from_server(server):
+def _log_settings_from_server(server, observe_only):
# Get values of variables which control our output
includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"])
if error:
@@ -322,7 +322,11 @@ def _log_settings_from_server(server):
if error:
logger.error("Unable to get the value of BBINCLUDELOGS_LINES variable: %s" % error)
raise BaseException(error)
- consolelogfile, error = server.runCommand(["getSetVariable", "BB_CONSOLELOG"])
+ if observe_only:
+ cmd = 'getVariable'
+ else:
+ cmd = 'getSetVariable'
+ consolelogfile, error = server.runCommand([cmd, "BB_CONSOLELOG"])
if error:
logger.error("Unable to get the value of BB_CONSOLELOG variable: %s" % error)
raise BaseException(error)
@@ -340,7 +344,7 @@ _evt_list = [ "bb.runqueue.runQueueExitWait", "bb.event.LogExecTTY", "logging.Lo
def main(server, eventHandler, params, tf = TerminalFilter):
- includelogs, loglines, consolelogfile = _log_settings_from_server(server)
+ includelogs, loglines, consolelogfile = _log_settings_from_server(server, params.observe_only)
if sys.stdin.isatty() and sys.stdout.isatty():
log_exec_tty = True
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 04/15] server/xmlrpc: send back 503 response with correct encoding
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (2 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 03/15] knotty: fix --observe-only option Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 05/15] data_smart: implement remote datastore functionality Paul Eggleton
` (10 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
If you send back a string here you get "TypeError: 'str' does not
support the buffer interface" errors in bitbake-cookerdaemon.log and
"IncompleteRead(0 bytes read, 22 more expected)" errors on the client
side.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/server/xmlrpc.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bb/server/xmlrpc.py b/lib/bb/server/xmlrpc.py
index 452f14b..a06007f 100644
--- a/lib/bb/server/xmlrpc.py
+++ b/lib/bb/server/xmlrpc.py
@@ -190,7 +190,7 @@ class BitBakeXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
self.send_header("Content-type", "text/plain")
self.send_header("Content-length", str(len(response)))
self.end_headers()
- self.wfile.write(response)
+ self.wfile.write(bytes(response, 'utf-8'))
class XMLRPCProxyServer(BaseImplServer):
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 05/15] data_smart: implement remote datastore functionality
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (3 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 04/15] server/xmlrpc: send back 503 response with correct encoding Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 06/15] command: provide a means to shut down from the client in memres mode Paul Eggleton
` (9 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
This allows you to maintain a local reference to a remote datastore. The
actual implementation of the remote connection is delegated to a
connector object that the caller must define and supply. There is
support for getting variable values and expanding python references
(i.e. ${@...} remotely, however setting variables remotely is not
supported - any variable setting is done locally as if the datastore
were a copy (which it kind of is).
Loosely based on an earlier prototype implementation by Qing He.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/data_smart.py | 39 +++++++++++++++++++++++++++++++++------
lib/bb/tests/data.py | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 17768c8..5d0ed12 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -116,7 +116,15 @@ class VariableParse:
return match.group()
def python_sub(self, match):
- code = match.group()[3:-1]
+ if isinstance(match, str):
+ code = match
+ else:
+ code = match.group()[3:-1]
+
+ if "_remote_data" in self.d:
+ connector = self.d["_remote_data"]
+ return connector.expandPythonRef(self.varname, code)
+
codeobj = compile(code.strip(), self.varname or "<expansion>", "eval")
parser = bb.codeparser.PythonParser(self.varname, logger)
@@ -247,10 +255,15 @@ class VariableHistory(object):
self.variables[var].append(loginfo.copy())
def variable(self, var):
- if var in self.variables:
- return self.variables[var]
+ remote_connector = self.dataroot.getVar('_remote_data', False)
+ if remote_connector:
+ varhistory = remote_connector.getVarHistory(var)
else:
- return []
+ varhistory = []
+
+ if var in self.variables:
+ varhistory.extend(self.variables[var])
+ return varhistory
def emit(self, var, oval, val, o, d):
history = self.variable(var)
@@ -449,6 +462,10 @@ class DataSmart(MutableMapping):
if var in dest:
return dest[var]
+ if "_remote_data" in dest:
+ connector = dest["_remote_data"]["_content"]
+ return connector.getVar(var)
+
if "_data" not in dest:
break
dest = dest["_data"]
@@ -471,6 +488,12 @@ class DataSmart(MutableMapping):
if 'parsing' in loginfo:
parsing=True
+ if '_remote_data' in self.dict:
+ connector = self.dict["_remote_data"]["_content"]
+ res = connector.setVar(var, value)
+ if not res:
+ return
+
if 'op' not in loginfo:
loginfo['op'] = "set"
self.expand_cache = {}
@@ -875,7 +898,7 @@ class DataSmart(MutableMapping):
def localkeys(self):
for key in self.dict:
- if key != '_data':
+ if key not in ['_data', '_remote_data']:
yield key
def __iter__(self):
@@ -884,7 +907,7 @@ class DataSmart(MutableMapping):
def keylist(d):
klist = set()
for key in d:
- if key == "_data":
+ if key in ["_data", "_remote_data"]:
continue
if key in deleted:
continue
@@ -898,6 +921,10 @@ class DataSmart(MutableMapping):
if "_data" in d:
klist |= keylist(d["_data"])
+ if "_remote_data" in d:
+ connector = d["_remote_data"]["_content"]
+ klist |= connector.getKeys()
+
return klist
self.need_overrides()
diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py
index 1a5a28a..2bd481b 100644
--- a/lib/bb/tests/data.py
+++ b/lib/bb/tests/data.py
@@ -444,3 +444,42 @@ class Contains(unittest.TestCase):
self.assertFalse(bb.utils.contains_any("SOMEFLAG", "x", True, False, self.d))
self.assertFalse(bb.utils.contains_any("SOMEFLAG", "x y z", True, False, self.d))
+
+
+class Remote(unittest.TestCase):
+ def test_remote(self):
+ class TestConnector:
+ d = None
+ def __init__(self, d):
+ self.d = d
+ def getVar(self, name):
+ return self.d._findVar(name)
+ def getKeys(self):
+ return self.d.localkeys()
+ def getVarHistory(self, name):
+ return self.d.varhistory.variable(name)
+ def expandPythonRef(self, varname, expr):
+ varparse = bb.data_smart.VariableParse(varname, self.d)
+ return varparse.python_sub(expr)
+ def setVar(self, name, value):
+ self.d.setVar(name, value)
+
+ d1 = bb.data.init()
+ d1.enableTracking()
+ d2 = bb.data.init()
+ d2.enableTracking()
+ connector = TestConnector(d1)
+
+ d2.setVar('_remote_data', connector)
+
+ d1.setVar('HELLO', 'world')
+ d1.setVarFlag('OTHER', 'flagname', 'flagvalue')
+ self.assertEqual(d2.getVar('HELLO'), 'world')
+ self.assertEqual(d2.expand('${HELLO}'), 'world')
+ self.assertEqual(d2.expand('${@d.getVar("HELLO")}'), 'world')
+ self.assertIn('flagname', d2.getVarFlags('OTHER'))
+ self.assertEqual(d2.getVarFlag('OTHER', 'flagname'), 'flagvalue')
+ self.assertEqual(d1.varhistory.variable('HELLO'), d2.varhistory.variable('HELLO'))
+ # Test setVar on client side affects server
+ d2.setVar('HELLO', 'other-world')
+ self.assertEqual(d1.getVar('HELLO'), 'other-world')
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 06/15] command: provide a means to shut down from the client in memres mode
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (4 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 05/15] data_smart: implement remote datastore functionality Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 07/15] tinfoil: rewrite as a wrapper around the UI Paul Eggleton
` (8 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
In memory resident mode we don't really want to actually shut down since
it's only the client going away.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/command.py | 8 ++++++++
lib/bb/cooker.py | 7 +++++++
lib/bb/cookerdata.py | 1 +
3 files changed, 16 insertions(+)
diff --git a/lib/bb/command.py b/lib/bb/command.py
index caa3e4d..012b35f 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -472,3 +472,11 @@ class CommandsAsync:
command.finishAsyncCommand()
resetCooker.needcache = False
+ def clientComplete(self, command, params):
+ """
+ Do the right thing when the controlling client exits
+ """
+ command.cooker.clientComplete()
+ command.finishAsyncCommand()
+ clientComplete.needcache = False
+
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 5e5708e..2614c44 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1725,6 +1725,13 @@ class BBCooker:
def reset(self):
self.initConfigurationData()
+ def clientComplete(self):
+ """Called when the client is done using the server"""
+ if self.configuration.server_only:
+ self.finishcommand()
+ else:
+ self.shutdown(True)
+
def lockBitbake(self):
if not hasattr(self, 'lock'):
self.lock = None
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 320bb59..c6e958b 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -146,6 +146,7 @@ class CookerConfiguration(object):
self.tracking = False
self.interface = []
self.writeeventlog = False
+ self.server_only = False
self.env = {}
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 07/15] tinfoil: rewrite as a wrapper around the UI
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (5 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 06/15] command: provide a means to shut down from the client in memres mode Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 08/15] remotedata: enable transporting datastore from the client to the server Paul Eggleton
` (7 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
Rewrite tinfoil as a wrapper around the UI, instead of the earlier
approach of starting up just enough of cooker to do what we want. This
has several advantages:
* It now works when bitbake is memory-resident instead of failing with
"ERROR: Only one copy of bitbake should be run against a build
directory".
* We can now connect an actual UI, thus you get things like the recipe
parsing / cache loading progress bar and parse error handling for free
* We can now handle events generated by the server if we wish to do so
* We can potentially extend this to do more stuff, e.g. actually running
build operations - this needs to be made more practical before we can
use it though (since you effectively have to become the UI yourself
for this at the moment.)
The downside is that tinfoil no longer has direct access to cooker, the
global datastore, or the cache. To mitigate this I have extended
data_smart to provide remote access capability for the datastore, and
created "fake" cooker and cooker.recipecache / cooker.collection adapter
objects in order to avoid breaking too many tinfoil-using scripts that
might be out there (we've never officially documented tinfoil or
BitBake's internal code, but we can still make accommodations where
practical). I've at least gone far enough to support all of the
utilities that use tinfoil in OE-Core with some changes, but I know
there are scripts such as Chris Larson's "bb" out there that do make
other calls into BitBake code that I'm not currently providing access to
through the adapters.
Part of the fix for [YOCTO #5470].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/command.py | 195 +++++++++++++++++++++++++
lib/bb/cooker.py | 19 ++-
lib/bb/main.py | 83 ++++++-----
lib/bb/remotedata.py | 74 ++++++++++
lib/bb/tinfoil.py | 385 ++++++++++++++++++++++++++++++++++++++++++--------
lib/bblayers/query.py | 28 +---
6 files changed, 665 insertions(+), 119 deletions(-)
create mode 100644 lib/bb/remotedata.py
diff --git a/lib/bb/command.py b/lib/bb/command.py
index 012b35f..d5be86d 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -28,8 +28,15 @@ and must not trigger events, directly or indirectly.
Commands are queued in a CommandQueue
"""
+from collections import OrderedDict, defaultdict
+
import bb.event
import bb.cooker
+import bb.remotedata
+
+class DataStoreConnectionHandle(object):
+ def __init__(self, dsindex=0):
+ self.dsindex = dsindex
class CommandCompleted(bb.event.Event):
pass
@@ -55,6 +62,7 @@ class Command:
self.cooker = cooker
self.cmds_sync = CommandsSync()
self.cmds_async = CommandsAsync()
+ self.remotedatastores = bb.remotedata.RemoteDatastores(cooker)
# FIXME Add lock for this
self.currentAsyncCommand = None
@@ -298,6 +306,193 @@ class CommandsSync:
command.cooker.updateConfigOpts(options, environment)
updateConfig.needconfig = False
+ def parseConfiguration(self, command, params):
+ """Instruct bitbake to parse its configuration
+ NOTE: it is only necessary to call this if you aren't calling any normal action
+ (otherwise parsing is taken care of automatically)
+ """
+ command.cooker.parseConfiguration()
+ parseConfiguration.needconfig = False
+
+ def getLayerPriorities(self, command, params):
+ ret = []
+ # regex objects cannot be marshalled by xmlrpc
+ for collection, pattern, regex, pri in command.cooker.bbfile_config_priorities:
+ ret.append((collection, pattern, regex.pattern, pri))
+ return ret
+ getLayerPriorities.readonly = True
+
+ def getRecipes(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return list(command.cooker.recipecaches[mc].pkg_pn.items())
+ getRecipes.readonly = True
+
+ def getRecipeDepends(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return list(command.cooker.recipecaches[mc].deps.items())
+ getRecipeDepends.readonly = True
+
+ def getRecipeVersions(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return command.cooker.recipecaches[mc].pkg_pepvpr
+ getRecipeVersions.readonly = True
+
+ def getRuntimeDepends(self, command, params):
+ ret = []
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ rundeps = command.cooker.recipecaches[mc].rundeps
+ for key, value in rundeps.items():
+ if isinstance(value, defaultdict):
+ value = dict(value)
+ ret.append((key, value))
+ return ret
+ getRuntimeDepends.readonly = True
+
+ def getRuntimeRecommends(self, command, params):
+ ret = []
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ runrecs = command.cooker.recipecaches[mc].runrecs
+ for key, value in runrecs.items():
+ if isinstance(value, defaultdict):
+ value = dict(value)
+ ret.append((key, value))
+ return ret
+ getRuntimeRecommends.readonly = True
+
+ def getRecipeInherits(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return command.cooker.recipecaches[mc].inherits
+ getRecipeInherits.readonly = True
+
+ def getBbFilePriority(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return command.cooker.recipecaches[mc].bbfile_priority
+ getBbFilePriority.readonly = True
+
+ def getDefaultPreference(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return command.cooker.recipecaches[mc].pkg_dp
+ getDefaultPreference.readonly = True
+
+ def getSkippedRecipes(self, command, params):
+ # Return list sorted by reverse priority order
+ import bb.cache
+ skipdict = OrderedDict(sorted(command.cooker.skiplist.items(),
+ key=lambda x: (-command.cooker.collection.calc_bbfile_priority(bb.cache.virtualfn2realfn(x[0])[0]), x[0])))
+ return list(skipdict.items())
+ getSkippedRecipes.readonly = True
+
+ def getOverlayedRecipes(self, command, params):
+ return list(command.cooker.collection.overlayed.items())
+ getOverlayedRecipes.readonly = True
+
+ def getFileAppends(self, command, params):
+ fn = params[0]
+ return command.cooker.collection.get_file_appends(fn)
+ getFileAppends.readonly = True
+
+ def getAllAppends(self, command, params):
+ return command.cooker.collection.bbappends
+ getAllAppends.readonly = True
+
+ def findProviders(self, command, params):
+ return command.cooker.findProviders()
+ findProviders.readonly = True
+
+ def findBestProvider(self, command, params):
+ pn = params[0]
+ return command.cooker.findBestProvider(pn)
+ findBestProvider.readonly = True
+
+ def allProviders(self, command, params):
+ try:
+ mc = params[0]
+ except IndexError:
+ mc = ''
+ return list(bb.providers.allProviders(command.cooker.recipecaches[mc]).items())
+ allProviders.readonly = True
+
+ def getRuntimeProviders(self, command, params):
+ rprovide = params[0]
+ try:
+ mc = params[1]
+ except IndexError:
+ mc = ''
+ all_p = bb.providers.getRuntimeProviders(command.cooker.recipecaches[mc], rprovide)
+ if all_p:
+ best = bb.providers.filterProvidersRunTime(all_p, rprovide,
+ command.cooker.data,
+ command.cooker.recipecaches[mc])[0][0]
+ else:
+ best = None
+ return all_p, best
+ getRuntimeProviders.readonly = True
+
+ def dataStoreConnectorFindVar(self, command, params):
+ dsindex = params[0]
+ name = params[1]
+ datastore = command.remotedatastores[dsindex]
+ value = datastore._findVar(name)
+
+ if value:
+ content = value.get('_content', None)
+ if isinstance(content, bb.data_smart.DataSmart):
+ # Value is a datastore (e.g. BB_ORIGENV) - need to handle this carefully
+ idx = command.remotedatastores.check_store(content, True)
+ return {'_content': DataStoreConnectionHandle(idx), '_connector_origtype': 'DataStoreConnectionHandle'}
+ elif isinstance(content, set):
+ return {'_content': list(content), '_connector_origtype': 'set'}
+ return value
+ dataStoreConnectorFindVar.readonly = True
+
+ def dataStoreConnectorGetKeys(self, command, params):
+ dsindex = params[0]
+ datastore = command.remotedatastores[dsindex]
+ return list(datastore.keys())
+ dataStoreConnectorGetKeys.readonly = True
+
+ def dataStoreConnectorGetVarHistory(self, command, params):
+ dsindex = params[0]
+ name = params[1]
+ datastore = command.remotedatastores[dsindex]
+ return datastore.varhistory.variable(name)
+ dataStoreConnectorGetVarHistory.readonly = True
+
+ def dataStoreConnectorExpandPythonRef(self, command, params):
+ dsindex = params[0]
+ varname = params[1]
+ expr = params[2]
+ if dsindex:
+ datastore = self.dataStores[dsindex]
+ else:
+ datastore = command.cooker.data
+ varparse = bb.data_smart.VariableParse(varname, datastore)
+ return varparse.python_sub(expr)
+
class CommandsAsync:
"""
A class of asynchronous commands
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 2614c44..48904a5 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -583,13 +583,12 @@ class BBCooker:
def showVersions(self):
- pkg_pn = self.recipecaches[''].pkg_pn
- (latest_versions, preferred_versions) = bb.providers.findProviders(self.data, self.recipecaches[''], pkg_pn)
+ (latest_versions, preferred_versions) = self.findProviders()
logger.plain("%-35s %25s %25s", "Recipe Name", "Latest Version", "Preferred Version")
logger.plain("%-35s %25s %25s\n", "===========", "==============", "=================")
- for p in sorted(pkg_pn):
+ for p in sorted(self.recipecaches[''].pkg_pn):
pref = preferred_versions[p]
latest = latest_versions[p]
@@ -1084,6 +1083,20 @@ class BBCooker:
if matches:
bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.data)
+ def findProviders(self, mc=''):
+ return bb.providers.findProviders(self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn)
+
+ def findBestProvider(self, pn, mc=''):
+ if pn in self.recipecaches[mc].providers:
+ filenames = self.recipecaches[mc].providers[pn]
+ eligible, foundUnique = bb.providers.filterProviders(filenames, pn, self.expanded_data, self.recipecaches[mc])
+ filename = eligible[0]
+ return None, None, None, filename
+ elif pn in self.recipecaches[mc].pkg_pn:
+ return bb.providers.findBestProvider(pn, self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn)
+ else:
+ return None, None, None, None
+
def findConfigFiles(self, varname):
"""
Find config files which are appropriate values for varname.
diff --git a/lib/bb/main.py b/lib/bb/main.py
index a544c0a..443f5ec 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -389,12 +389,8 @@ def bitbake_main(configParams, configuration):
except:
pass
-
configuration.setConfigParameters(configParams)
- ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
- servermodule = import_extension_module(bb.server, configParams.servertype, 'BitBakeServer')
-
if configParams.server_only:
if configParams.servertype != "xmlrpc":
raise BBMainException("FATAL: If '--server-only' is defined, we must set the "
@@ -442,6 +438,31 @@ def bitbake_main(configParams, configuration):
bb.msg.init_msgconfig(configParams.verbose, configuration.debug,
configuration.debug_domains)
+ server, server_connection, ui_module = setup_bitbake(configParams, configuration)
+ if server_connection is None and configParams.kill_server:
+ return 0
+
+ if not configParams.server_only:
+ if configParams.status_only:
+ server_connection.terminate()
+ return 0
+
+ try:
+ return ui_module.main(server_connection.connection, server_connection.events,
+ configParams)
+ finally:
+ bb.event.ui_queue = []
+ server_connection.terminate()
+ else:
+ print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host,
+ server.serverImpl.port))
+ if configParams.foreground:
+ server.serverImpl.serve_forever()
+ return 0
+
+ return 1
+
+def setup_bitbake(configParams, configuration, extrafeatures=None):
# Ensure logging messages get sent to the UI as events
handler = bb.event.LogHandler()
if not configParams.status_only:
@@ -451,8 +472,11 @@ def bitbake_main(configParams, configuration):
# Clear away any spurious environment variables while we stoke up the cooker
cleanedvars = bb.utils.clean_environment()
- featureset = []
- if not configParams.server_only:
+ if configParams.server_only:
+ featureset = []
+ ui_module = None
+ else:
+ ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
# Collect the feature set for the UI
featureset = getattr(ui_module, "featureSet", [])
@@ -463,11 +487,15 @@ def bitbake_main(configParams, configuration):
setattr(configuration, "%s_server" % param, value)
param = "%s_server" % param
- if not configParams.remote_server:
- # we start a server with a given configuration
- server = start_server(servermodule, configParams, configuration, featureset)
- bb.event.ui_queue = []
- else:
+ if extrafeatures:
+ for feature in extrafeatures:
+ if not feature in featureset:
+ featureset.append(feature)
+
+ servermodule = import_extension_module(bb.server,
+ configParams.servertype,
+ 'BitBakeServer')
+ if configParams.remote_server:
if os.getenv('BBSERVER') == 'autostart':
if configParams.remote_server == 'autostart' or \
not servermodule.check_connection(configParams.remote_server, timeout=2):
@@ -475,14 +503,19 @@ def bitbake_main(configParams, configuration):
srv = start_server(servermodule, configParams, configuration, featureset)
configParams.remote_server = '%s:%d' % tuple(configuration.interface)
bb.event.ui_queue = []
-
# we start a stub server that is actually a XMLRPClient that connects to a real server
+ from bb.server.xmlrpc import BitBakeXMLRPCClient
server = servermodule.BitBakeXMLRPCClient(configParams.observe_only,
configParams.xmlrpctoken)
server.saveConnectionDetails(configParams.remote_server)
+ else:
+ # we start a server with a given configuration
+ server = start_server(servermodule, configParams, configuration, featureset)
+ bb.event.ui_queue = []
-
- if not configParams.server_only:
+ if configParams.server_only:
+ server_connection = None
+ else:
try:
server_connection = server.establishConnection(featureset)
except Exception as e:
@@ -491,7 +524,7 @@ def bitbake_main(configParams, configuration):
if configParams.kill_server:
server_connection.connection.terminateServer()
bb.event.ui_queue = []
- return 0
+ return None, None, None
server_connection.setupEventQueue()
@@ -501,22 +534,4 @@ def bitbake_main(configParams, configuration):
logger.removeHandler(handler)
-
- if configParams.status_only:
- server_connection.terminate()
- return 0
-
- try:
- return ui_module.main(server_connection.connection, server_connection.events,
- configParams)
- finally:
- bb.event.ui_queue = []
- server_connection.terminate()
- else:
- print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host,
- server.serverImpl.port))
- if configParams.foreground:
- server.serverImpl.serve_forever()
- return 0
-
- return 1
+ return server, server_connection, ui_module
diff --git a/lib/bb/remotedata.py b/lib/bb/remotedata.py
new file mode 100644
index 0000000..932ee43
--- /dev/null
+++ b/lib/bb/remotedata.py
@@ -0,0 +1,74 @@
+"""
+BitBake 'remotedata' module
+
+Provides support for using a datastore from the bitbake client
+"""
+
+# Copyright (C) 2016 Intel Corporation
+#
+# 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 bb.data
+
+class RemoteDatastores:
+ """Used on the server side to manage references to server-side datastores"""
+ def __init__(self, cooker):
+ self.cooker = cooker
+ self.datastores = {}
+ self.locked = []
+ self.nextindex = 1
+
+ def __len__(self):
+ return len(self.datastores)
+
+ def __getitem__(self, key):
+ if key is None:
+ return self.cooker.data
+ else:
+ return self.datastores[key]
+
+ def items(self):
+ return self.datastores.items()
+
+ def store(self, d, locked=False):
+ """
+ Put a datastore into the collection. If locked=True then the datastore
+ is understood to be managed externally and cannot be released by calling
+ release().
+ """
+ idx = self.nextindex
+ self.datastores[idx] = d
+ if locked:
+ self.locked.append(idx)
+ self.nextindex += 1
+ return idx
+
+ def check_store(self, d, locked=False):
+ """
+ Put a datastore into the collection if it's not already in there;
+ in either case return the index
+ """
+ for key, val in self.datastores.items():
+ if val is d:
+ idx = key
+ break
+ else:
+ idx = self.store(d, locked)
+ return idx
+
+ def release(self, idx):
+ """Discard a datastore in the collection"""
+ if idx in self.locked:
+ raise Exception('Tried to release locked datastore %d' % idx)
+ del self.datastores[idx]
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 8899e86..459f6c1 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -1,6 +1,6 @@
# tinfoil: a simple wrapper around cooker for bitbake-based command-line utilities
#
-# Copyright (C) 2012 Intel Corporation
+# Copyright (C) 2012-2016 Intel Corporation
# Copyright (C) 2011 Mentor Graphics Corporation
#
# This program is free software; you can redistribute it and/or modify
@@ -17,47 +17,172 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import logging
-import warnings
import os
import sys
+import atexit
+import re
+from collections import OrderedDict, defaultdict
import bb.cache
import bb.cooker
import bb.providers
import bb.utils
-from bb.cooker import state, BBCooker, CookerFeatures
+import bb.command
from bb.cookerdata import CookerConfiguration, ConfigParameters
+from bb.main import setup_bitbake, BitBakeConfigParameters, BBMainException
import bb.fetch2
+
+# We need this in order to shut down the connection to the bitbake server,
+# otherwise the process will never properly exit
+_server_connections = []
+def _terminate_connections():
+ for connection in _server_connections:
+ connection.terminate()
+atexit.register(_terminate_connections)
+
+class TinfoilUIException(Exception):
+ """Exception raised when the UI returns non-zero from its main function"""
+ def __init__(self, returncode):
+ self.returncode = returncode
+ def __repr__(self):
+ return 'UI module main returned %d' % self.returncode
+
+class TinfoilCommandFailed(Exception):
+ """Exception raised when run_command fails"""
+
+class TinfoilDataStoreConnector:
+
+ def __init__(self, tinfoil, dsindex):
+ self.tinfoil = tinfoil
+ self.dsindex = dsindex
+ def getVar(self, name):
+ value = self.tinfoil.run_command('dataStoreConnectorFindVar', self.dsindex, name)
+ if isinstance(value, dict):
+ if '_connector_origtype' in value:
+ value['_content'] = self.tinfoil._reconvert_type(value['_content'], value['_connector_origtype'])
+ del value['_connector_origtype']
+
+ return value
+ def getKeys(self):
+ return set(self.tinfoil.run_command('dataStoreConnectorGetKeys', self.dsindex))
+ def getVarHistory(self, name):
+ return self.tinfoil.run_command('dataStoreConnectorGetVarHistory', self.dsindex, name)
+ def expandPythonRef(self, varname, expr):
+ ret = self.tinfoil.run_command('dataStoreConnectorExpandPythonRef', self.dsindex, varname, expr)
+ return ret
+ def setVar(self, varname, value):
+ if self.dsindex is None:
+ self.tinfoil.run_command('setVariable', varname, value)
+ else:
+ # Not currently implemented - indicate that setting should
+ # be redirected to local side
+ return True
+
+class TinfoilCookerAdapter:
+ """
+ Provide an adapter for existing code that expects to access a cooker object via Tinfoil,
+ since now Tinfoil is on the client side it no longer has direct access.
+ """
+
+ class TinfoilCookerCollectionAdapter:
+ """ cooker.collection adapter """
+ def __init__(self, tinfoil):
+ self.tinfoil = tinfoil
+ def get_file_appends(self, fn):
+ return self.tinfoil.run_command('getFileAppends', fn)
+ def __getattr__(self, name):
+ if name == 'overlayed':
+ return self.tinfoil.get_overlayed_recipes()
+ elif name == 'bbappends':
+ return self.tinfoil.run_command('getAllAppends')
+ else:
+ raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name))
+
+ class TinfoilRecipeCacheAdapter:
+ """ cooker.recipecache adapter """
+ def __init__(self, tinfoil):
+ self.tinfoil = tinfoil
+ self._cache = {}
+
+ def get_pkg_pn_fn(self):
+ pkg_pn = defaultdict(list, self.tinfoil.run_command('getRecipes') or [])
+ pkg_fn = {}
+ for pn, fnlist in pkg_pn.items():
+ for fn in fnlist:
+ pkg_fn[fn] = pn
+ self._cache['pkg_pn'] = pkg_pn
+ self._cache['pkg_fn'] = pkg_fn
+
+ def __getattr__(self, name):
+ # Grab these only when they are requested since they aren't always used
+ if name in self._cache:
+ return self._cache[name]
+ elif name == 'pkg_pn':
+ self.get_pkg_pn_fn()
+ return self._cache[name]
+ elif name == 'pkg_fn':
+ self.get_pkg_pn_fn()
+ return self._cache[name]
+ elif name == 'deps':
+ attrvalue = defaultdict(list, self.tinfoil.run_command('getRecipeDepends') or [])
+ elif name == 'rundeps':
+ attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeDepends') or [])
+ elif name == 'runrecs':
+ attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeRecommends') or [])
+ elif name == 'pkg_pepvpr':
+ attrvalue = self.tinfoil.run_command('getRecipeVersions') or {}
+ elif name == 'inherits':
+ attrvalue = self.tinfoil.run_command('getRecipeInherits') or {}
+ elif name == 'bbfile_priority':
+ attrvalue = self.tinfoil.run_command('getBbFilePriority') or {}
+ elif name == 'pkg_dp':
+ attrvalue = self.tinfoil.run_command('getDefaultPreference') or {}
+ else:
+ raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name))
+
+ self._cache[name] = attrvalue
+ return attrvalue
+
+ def __init__(self, tinfoil):
+ self.tinfoil = tinfoil
+ self.collection = self.TinfoilCookerCollectionAdapter(tinfoil)
+ self.recipecaches = {}
+ # FIXME all machines
+ self.recipecaches[''] = self.TinfoilRecipeCacheAdapter(tinfoil)
+ self._cache = {}
+ def __getattr__(self, name):
+ # Grab these only when they are requested since they aren't always used
+ if name in self._cache:
+ return self._cache[name]
+ elif name == 'skiplist':
+ attrvalue = self.tinfoil.get_skipped_recipes()
+ elif name == 'bbfile_config_priorities':
+ ret = self.tinfoil.run_command('getLayerPriorities')
+ bbfile_config_priorities = []
+ for collection, pattern, regex, pri in ret:
+ bbfile_config_priorities.append((collection, pattern, re.compile(regex), pri))
+
+ attrvalue = bbfile_config_priorities
+ else:
+ raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name))
+
+ self._cache[name] = attrvalue
+ return attrvalue
+
+ def findBestProvider(self, pn):
+ return self.tinfoil.find_best_provider(pn)
+
+
class Tinfoil:
- def __init__(self, output=sys.stdout, tracking=False):
- # Needed to avoid deprecation warnings with python 2.6
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- # Set up logging
+ def __init__(self, output=sys.stdout, tracking=False):
self.logger = logging.getLogger('BitBake')
- self._log_hdlr = logging.StreamHandler(output)
- bb.msg.addDefaultlogFilter(self._log_hdlr)
- format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
- if output.isatty():
- format.enable_color()
- self._log_hdlr.setFormatter(format)
- self.logger.addHandler(self._log_hdlr)
-
- self.config = CookerConfiguration()
- configparams = TinfoilConfigParameters(parse_only=True)
- self.config.setConfigParameters(configparams)
- self.config.setServerRegIdleCallback(self.register_idle_function)
- features = []
- if tracking:
- features.append(CookerFeatures.BASEDATASTORE_TRACKING)
- self.cooker = BBCooker(self.config, features)
- self.config_data = self.cooker.data
- bb.providers.logger.setLevel(logging.ERROR)
- self.cooker_data = None
-
- def register_idle_function(self, function, data):
- pass
+ self.config_data = None
+ self.cooker = None
+ self.tracking = tracking
+ self.ui_module = None
+ self.server_connection = None
def __enter__(self):
return self
@@ -65,30 +190,120 @@ class Tinfoil:
def __exit__(self, type, value, traceback):
self.shutdown()
- def parseRecipes(self):
- sys.stderr.write("Parsing recipes..")
- self.logger.setLevel(logging.WARNING)
+ def prepare(self, config_only=False, config_params=None, quiet=0):
+ if self.tracking:
+ extrafeatures = [bb.cooker.CookerFeatures.BASEDATASTORE_TRACKING]
+ else:
+ extrafeatures = []
- try:
- while self.cooker.state in (state.initial, state.parsing):
- self.cooker.updateCache()
- except KeyboardInterrupt:
- self.cooker.shutdown()
- self.cooker.updateCache()
- sys.exit(2)
+ if not config_params:
+ config_params = TinfoilConfigParameters(config_only=config_only, quiet=quiet)
- self.logger.setLevel(logging.INFO)
- sys.stderr.write("done.\n")
+ cookerconfig = CookerConfiguration()
+ cookerconfig.setConfigParameters(config_params)
- self.cooker_data = self.cooker.recipecaches['']
+ server, self.server_connection, ui_module = setup_bitbake(config_params,
+ cookerconfig,
+ extrafeatures)
- def prepare(self, config_only = False):
- if not self.cooker_data:
+ self.ui_module = ui_module
+
+ if self.server_connection:
+ _server_connections.append(self.server_connection)
if config_only:
- self.cooker.parseConfiguration()
- self.cooker_data = self.cooker.recipecaches['']
+ config_params.updateToServer(self.server_connection.connection, os.environ.copy())
+ self.run_command('parseConfiguration')
else:
- self.parseRecipes()
+ self.run_actions(config_params)
+
+ self.config_data = bb.data.init()
+ connector = TinfoilDataStoreConnector(self, None)
+ self.config_data.setVar('_remote_data', connector)
+ self.cooker = TinfoilCookerAdapter(self)
+ self.cooker_data = self.cooker.recipecaches['']
+ else:
+ raise Exception('Failed to start bitbake server')
+
+ def run_actions(self, config_params):
+ """
+ Run the actions specified in config_params through the UI.
+ """
+ ret = self.ui_module.main(self.server_connection.connection, self.server_connection.events, config_params)
+ if ret:
+ raise TinfoilUIException(ret)
+
+ def parseRecipes(self):
+ """
+ Force a parse of all recipes. Normally you should specify
+ config_only=False when calling prepare() instead of using this
+ function; this function is designed for situations where you need
+ to initialise Tinfoil and use it with config_only=True first and
+ then conditionally call this function to parse recipes later.
+ """
+ config_params = TinfoilConfigParameters(config_only=False)
+ self.run_actions(config_params)
+
+ def run_command(self, command, *params):
+ """
+ Run a command on the server (as implemented in bb.command).
+ Note that there are two types of command - synchronous and
+ asynchronous; in order to receive the results of asynchronous
+ commands you will need to set an appropriate event mask
+ using set_event_mask() and listen for the result using
+ wait_event() - with the correct event mask you'll at least get
+ bb.command.CommandCompleted and possibly other events before
+ that depending on the command.
+ """
+ if not self.server_connection:
+ raise Exception('Not connected to server (did you call .prepare()?)')
+
+ commandline = [command]
+ if params:
+ commandline.extend(params)
+ result = self.server_connection.connection.runCommand(commandline)
+ if result[1]:
+ raise TinfoilCommandFailed(result[1])
+ return result[0]
+
+ def set_event_mask(self, eventlist):
+ """Set the event mask which will be applied within wait_event()"""
+ if not self.server_connection:
+ raise Exception('Not connected to server (did you call .prepare()?)')
+ llevel, debug_domains = bb.msg.constructLogOptions()
+ ret = self.run_command('setEventMask', self.server_connection.connection.getEventHandle(), llevel, debug_domains, eventlist)
+ if not ret:
+ raise Exception('setEventMask failed')
+
+ def wait_event(self, timeout=0):
+ """
+ Wait for an event from the server for the specified time.
+ A timeout of 0 means don't wait if there are no events in the queue.
+ Returns the next event in the queue or None if the timeout was
+ reached. Note that in order to recieve any events you will
+ first need to set the internal event mask using set_event_mask()
+ (otherwise whatever event mask the UI set up will be in effect).
+ """
+ if not self.server_connection:
+ raise Exception('Not connected to server (did you call .prepare()?)')
+ return self.server_connection.events.waitEvent(timeout)
+
+ def get_overlayed_recipes(self):
+ return defaultdict(list, self.run_command('getOverlayedRecipes'))
+
+ def get_skipped_recipes(self):
+ return OrderedDict(self.run_command('getSkippedRecipes'))
+
+ def get_all_providers(self):
+ return defaultdict(list, self.run_command('allProviders'))
+
+ def find_providers(self):
+ return self.run_command('findProviders')
+
+ def find_best_provider(self, pn):
+ return self.run_command('findBestProvider', pn)
+
+ def get_runtime_providers(self, rdep):
+ return self.run_command('getRuntimeProviders', rdep)
def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None):
"""
@@ -126,22 +341,72 @@ class Tinfoil:
envdata = parser.loadDataFull(fn, appendfiles)
return envdata
+ def build_file(self, buildfile, task):
+ """
+ Runs the specified task for just a single recipe (i.e. no dependencies).
+ This is equivalent to bitbake -b.
+ """
+ return self.run_command('buildFile', buildfile, task)
+
def shutdown(self):
- self.cooker.shutdown(force=True)
- self.cooker.post_serve()
- self.cooker.unlockBitbake()
- self.logger.removeHandler(self._log_hdlr)
+ if self.server_connection:
+ self.run_command('clientComplete')
+ _server_connections.remove(self.server_connection)
+ bb.event.ui_queue = []
+ self.server_connection.terminate()
+ self.server_connection = None
-class TinfoilConfigParameters(ConfigParameters):
+ def _reconvert_type(self, obj, origtypename):
+ """
+ Convert an object back to the right type, in the case
+ that marshalling has changed it (especially with xmlrpc)
+ """
+ supported_types = {
+ 'set': set,
+ 'DataStoreConnectionHandle': bb.command.DataStoreConnectionHandle,
+ }
- def __init__(self, **options):
+ origtype = supported_types.get(origtypename, None)
+ if origtype is None:
+ raise Exception('Unsupported type "%s"' % origtypename)
+ if type(obj) == origtype:
+ newobj = obj
+ elif isinstance(obj, dict):
+ # New style class
+ newobj = origtype()
+ for k,v in obj.items():
+ setattr(newobj, k, v)
+ else:
+ # Assume we can coerce the type
+ newobj = origtype(obj)
+
+ if isinstance(newobj, bb.command.DataStoreConnectionHandle):
+ connector = TinfoilDataStoreConnector(self, newobj.dsindex)
+ newobj = bb.data.init()
+ newobj.setVar('_remote_data', connector)
+
+ return newobj
+
+
+class TinfoilConfigParameters(BitBakeConfigParameters):
+
+ def __init__(self, config_only, **options):
self.initial_options = options
- super(TinfoilConfigParameters, self).__init__()
+ # Apply some sane defaults
+ if not 'parse_only' in options:
+ self.initial_options['parse_only'] = not config_only
+ #if not 'status_only' in options:
+ # self.initial_options['status_only'] = config_only
+ if not 'ui' in options:
+ self.initial_options['ui'] = 'knotty'
+ if not 'argv' in options:
+ self.initial_options['argv'] = []
- def parseCommandLine(self, argv=sys.argv):
- class DummyOptions:
- def __init__(self, initial_options):
- for key, val in initial_options.items():
- setattr(self, key, val)
+ super(TinfoilConfigParameters, self).__init__()
- return DummyOptions(self.initial_options), None
+ def parseCommandLine(self, argv=None):
+ # We don't want any parameters parsed from the command line
+ opts = super(TinfoilConfigParameters, self).parseCommandLine([])
+ for key, val in self.initial_options.items():
+ setattr(opts[0], key, val)
+ return opts
diff --git a/lib/bblayers/query.py b/lib/bblayers/query.py
index 2949116..5def717 100644
--- a/lib/bblayers/query.py
+++ b/lib/bblayers/query.py
@@ -5,8 +5,6 @@ import sys
import os
import re
-import bb.cache
-import bb.providers
import bb.utils
from bblayers.common import LayerPlugin
@@ -122,15 +120,13 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
sys.exit(1)
pkg_pn = self.tinfoil.cooker.recipecaches[''].pkg_pn
- (latest_versions, preferred_versions) = bb.providers.findProviders(self.tinfoil.config_data, self.tinfoil.cooker.recipecaches[''], pkg_pn)
- allproviders = bb.providers.allProviders(self.tinfoil.cooker.recipecaches[''])
+ (latest_versions, preferred_versions) = self.tinfoil.find_providers()
+ allproviders = self.tinfoil.get_all_providers()
# Ensure we list skipped recipes
# We are largely guessing about PN, PV and the preferred version here,
# but we have no choice since skipped recipes are not fully parsed
skiplist = list(self.tinfoil.cooker.skiplist.keys())
- skiplist.sort( key=lambda fileitem: self.tinfoil.cooker.collection.calc_bbfile_priority(fileitem) )
- skiplist.reverse()
for fn in skiplist:
recipe_parts = os.path.splitext(os.path.basename(fn))[0].split('_')
p = recipe_parts[0]
@@ -265,10 +261,7 @@ Lists recipes with the bbappends that apply to them as subitems.
def show_appends_for_pn(self, pn):
filenames = self.tinfoil.cooker_data.pkg_pn[pn]
- best = bb.providers.findBestProvider(pn,
- self.tinfoil.config_data,
- self.tinfoil.cooker_data,
- self.tinfoil.cooker_data.pkg_pn)
+ best = self.tinfoil.find_best_provider(pn)
best_filename = os.path.basename(best[3])
return self.show_appends_output(filenames, best_filename)
@@ -336,10 +329,7 @@ NOTE: .bbappend files can impact the dependencies.
deps = self.tinfoil.cooker_data.deps[f]
for pn in deps:
if pn in self.tinfoil.cooker_data.pkg_pn:
- best = bb.providers.findBestProvider(pn,
- self.tinfoil.config_data,
- self.tinfoil.cooker_data,
- self.tinfoil.cooker_data.pkg_pn)
+ best = self.tinfoil.find_best_provider(pn)
self.check_cross_depends("DEPENDS", layername, f, best[3], args.filenames, ignore_layers)
# The RDPENDS
@@ -352,14 +342,11 @@ NOTE: .bbappend files can impact the dependencies.
sorted_rdeps[k2] = 1
all_rdeps = sorted_rdeps.keys()
for rdep in all_rdeps:
- all_p = bb.providers.getRuntimeProviders(self.tinfoil.cooker_data, rdep)
+ all_p, best = self.tinfoil.get_runtime_providers(rdep)
if all_p:
if f in all_p:
# The recipe provides this one itself, ignore
continue
- best = bb.providers.filterProvidersRunTime(all_p, rdep,
- self.tinfoil.config_data,
- self.tinfoil.cooker_data)[0][0]
self.check_cross_depends("RDEPENDS", layername, f, best, args.filenames, ignore_layers)
# The RRECOMMENDS
@@ -372,14 +359,11 @@ NOTE: .bbappend files can impact the dependencies.
sorted_rrecs[k2] = 1
all_rrecs = sorted_rrecs.keys()
for rrec in all_rrecs:
- all_p = bb.providers.getRuntimeProviders(self.tinfoil.cooker_data, rrec)
+ all_p, best = self.tinfoil.get_runtime_providers(rrec)
if all_p:
if f in all_p:
# The recipe provides this one itself, ignore
continue
- best = bb.providers.filterProvidersRunTime(all_p, rrec,
- self.tinfoil.config_data,
- self.tinfoil.cooker_data)[0][0]
self.check_cross_depends("RRECOMMENDS", layername, f, best, args.filenames, ignore_layers)
# The inherit class
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 08/15] remotedata: enable transporting datastore from the client to the server
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (6 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 07/15] tinfoil: rewrite as a wrapper around the UI Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 09/15] tinfoil: implement server-side recipe parsing Paul Eggleton
` (6 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
For the purposes of server-side parsing and expansion allowing for
client-side use of the datastore, we need a means of sending a datastore
from the client back to the server, where the datastore probably
consists of a remote (server-side) original plus some client-side
modifications. To do this we need to take care of a couple of things:
1) xmlrpc can't handle nested dicts, so if you enable memres and simply
try passing a serialised datastore then things break. Instead of
serialising the entire datastore, just take the naive option of
transferring the internal dict alone (as a list of tuples) for now.
2) Change the TinfoilDataStoreConnector object into simply the handle
(number) when transmitting; it gets substituted with the real
datastore when the server receives it.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/remotedata.py | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/lib/bb/remotedata.py b/lib/bb/remotedata.py
index 932ee43..68ecffc 100644
--- a/lib/bb/remotedata.py
+++ b/lib/bb/remotedata.py
@@ -72,3 +72,45 @@ class RemoteDatastores:
if idx in self.locked:
raise Exception('Tried to release locked datastore %d' % idx)
del self.datastores[idx]
+
+ def receive_datastore(self, remote_data):
+ """Receive a datastore object sent from the client (as prepared by transmit_datastore())"""
+ dct = dict(remote_data)
+ d = bb.data_smart.DataSmart()
+ d.dict = dct
+ while True:
+ if '_remote_data' in dct:
+ dsindex = dct['_remote_data']['_content']
+ del dct['_remote_data']
+ if dsindex is None:
+ dct['_data'] = self.cooker.data.dict
+ else:
+ dct['_data'] = self.datastores[dsindex].dict
+ break
+ elif '_data' in dct:
+ idct = dict(dct['_data'])
+ dct['_data'] = idct
+ dct = idct
+ else:
+ break
+ return d
+
+ @staticmethod
+ def transmit_datastore(d):
+ """Prepare a datastore object for sending over IPC from the client end"""
+ # FIXME content might be a dict, need to turn that into a list as well
+ def copy_dicts(dct):
+ if '_remote_data' in dct:
+ dsindex = dct['_remote_data']['_content'].dsindex
+ newdct = dct.copy()
+ newdct['_remote_data'] = {'_content': dsindex}
+ return list(newdct.items())
+ elif '_data' in dct:
+ newdct = dct.copy()
+ newdata = copy_dicts(dct['_data'])
+ if newdata:
+ newdct['_data'] = newdata
+ return list(newdct.items())
+ return None
+ main_dict = copy_dicts(d.dict)
+ return main_dict
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 09/15] tinfoil: implement server-side recipe parsing
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (7 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 08/15] remotedata: enable transporting datastore from the client to the server Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 10/15] tinfoil: pass datastore to server when expanding python references Paul Eggleton
` (5 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
It's not really practical for us to parse recipes on the client side, we
need to do it on the server because that's where we have the full python
environment (including any "pure" python functions defined in classes).
Thus, add some functions to tinfoil do this including a few shortcut
functions.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/command.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
lib/bb/tinfoil.py | 54 +++++++++++++++++++++++++++++++++++++-----------------
2 files changed, 81 insertions(+), 17 deletions(-)
diff --git a/lib/bb/command.py b/lib/bb/command.py
index d5be86d..b296b8c 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -493,6 +493,50 @@ class CommandsSync:
varparse = bb.data_smart.VariableParse(varname, datastore)
return varparse.python_sub(expr)
+ def dataStoreConnectorRelease(self, command, params):
+ dsindex = params[0]
+ if dsindex <= 0:
+ raise CommandError('dataStoreConnectorRelease: invalid index %d' % dsindex)
+ command.remotedatastores.release(dsindex)
+
+ def parseRecipeFile(self, command, params):
+ """
+ Parse the specified recipe file (with or without bbappends)
+ and return a datastore object representing the environment
+ for the recipe.
+ """
+ fn = params[0]
+ appends = params[1]
+ appendlist = params[2]
+ if len(params) > 3:
+ config_data_dict = params[3]
+ config_data = command.remotedatastores.receive_datastore(config_data_dict)
+ else:
+ config_data = None
+
+ if appends:
+ if appendlist is not None:
+ appendfiles = appendlist
+ else:
+ appendfiles = command.cooker.collection.get_file_appends(fn)
+ else:
+ appendfiles = []
+ # We are calling bb.cache locally here rather than on the server,
+ # but that's OK because it doesn't actually need anything from
+ # the server barring the global datastore (which we have a remote
+ # version of)
+ if config_data:
+ # We have to use a different function here if we're passing in a datastore
+ # NOTE: we took a copy above, so we don't do it here again
+ envdata = bb.cache.parse_recipe(config_data, fn, appendfiles)['']
+ else:
+ # Use the standard path
+ parser = bb.cache.NoCache(command.cooker.databuilder)
+ envdata = parser.loadDataFull(fn, appendfiles)
+ idx = command.remotedatastores.store(envdata)
+ return DataStoreConnectionHandle(idx)
+ parseRecipeFile.readonly = True
+
class CommandsAsync:
"""
A class of asynchronous commands
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 459f6c1..c551a9f 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -26,6 +26,7 @@ from collections import OrderedDict, defaultdict
import bb.cache
import bb.cooker
import bb.providers
+import bb.taskdata
import bb.utils
import bb.command
from bb.cookerdata import CookerConfiguration, ConfigParameters
@@ -90,7 +91,7 @@ class TinfoilCookerAdapter:
def __init__(self, tinfoil):
self.tinfoil = tinfoil
def get_file_appends(self, fn):
- return self.tinfoil.run_command('getFileAppends', fn)
+ return self.tinfoil.get_file_appends(fn)
def __getattr__(self, name):
if name == 'overlayed':
return self.tinfoil.get_overlayed_recipes()
@@ -305,6 +306,34 @@ class Tinfoil:
def get_runtime_providers(self, rdep):
return self.run_command('getRuntimeProviders', rdep)
+ def get_recipe_file(self, pn):
+ """
+ Get the file name for the specified recipe/target. Raises
+ bb.providers.NoProvider if there is no match or the recipe was
+ skipped.
+ """
+ best = self.find_best_provider(pn)
+ if not best:
+ skiplist = self.get_skipped_recipes()
+ taskdata = bb.taskdata.TaskData(None, skiplist=skiplist)
+ skipreasons = taskdata.get_reasons(pn)
+ if skipreasons:
+ raise bb.providers.NoProvider(skipreasons)
+ else:
+ raise bb.providers.NoProvider('Unable to find any recipe file matching %s' % pn)
+ return best[3]
+
+ def get_file_appends(self, fn):
+ return self.run_command('getFileAppends', fn)
+
+ def parse_recipe(self, pn):
+ """
+ Parse the specified recipe and return a datastore object
+ representing the environment for the recipe.
+ """
+ fn = self.get_recipe_file(pn)
+ return self.parse_recipe_file(fn)
+
def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None):
"""
Parse the specified recipe file (with or without bbappends)
@@ -322,24 +351,15 @@ class Tinfoil:
"""
if appends and appendlist == []:
appends = False
- if appends:
- if appendlist:
- appendfiles = appendlist
- else:
- if not hasattr(self.cooker, 'collection'):
- raise Exception('You must call tinfoil.prepare() with config_only=False in order to get bbappends')
- appendfiles = self.cooker.collection.get_file_appends(fn)
- else:
- appendfiles = None
if config_data:
- # We have to use a different function here if we're passing in a datastore
- localdata = bb.data.createCopy(config_data)
- envdata = bb.cache.parse_recipe(localdata, fn, appendfiles)['']
+ dctr = bb.remotedata.RemoteDatastores.transmit_datastore(config_data)
+ dscon = self.run_command('parseRecipeFile', fn, appends, appendlist, dctr)
+ else:
+ dscon = self.run_command('parseRecipeFile', fn, appends, appendlist)
+ if dscon:
+ return self._reconvert_type(dscon, 'DataStoreConnectionHandle')
else:
- # Use the standard path
- parser = bb.cache.NoCache(self.cooker.databuilder)
- envdata = parser.loadDataFull(fn, appendfiles)
- return envdata
+ return None
def build_file(self, buildfile, task):
"""
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 10/15] tinfoil: pass datastore to server when expanding python references
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (8 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 09/15] tinfoil: implement server-side recipe parsing Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 11/15] cooker: allow buildFile warning to be hidden programmatically Paul Eggleton
` (4 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
If you're expanding a value that refers to the value of a variable in
python code, we need to ensure that the datastore that gets used to get
the value of that variable is the client-side datastore and not just the
part of it that's on the server side. For example, suppose you are in
client code doing the following:
d.setVar('HELLO', 'there')
result = d.expand('${@d.getVar("HELLO", True)}')
result should be "there" but if the client part wasn't taken into
account, it would be whatever value HELLO had in the server portion of
the datastore (if any).
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/command.py | 11 +++++------
lib/bb/data_smart.py | 2 +-
lib/bb/tests/data.py | 10 ++++++++--
lib/bb/tinfoil.py | 6 ++++--
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/lib/bb/command.py b/lib/bb/command.py
index b296b8c..352838b 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -483,14 +483,13 @@ class CommandsSync:
dataStoreConnectorGetVarHistory.readonly = True
def dataStoreConnectorExpandPythonRef(self, command, params):
- dsindex = params[0]
+ config_data_dict = params[0]
varname = params[1]
expr = params[2]
- if dsindex:
- datastore = self.dataStores[dsindex]
- else:
- datastore = command.cooker.data
- varparse = bb.data_smart.VariableParse(varname, datastore)
+
+ config_data = command.remotedatastores.receive_datastore(config_data_dict)
+
+ varparse = bb.data_smart.VariableParse(varname, config_data)
return varparse.python_sub(expr)
def dataStoreConnectorRelease(self, command, params):
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 5d0ed12..4d0a771 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -123,7 +123,7 @@ class VariableParse:
if "_remote_data" in self.d:
connector = self.d["_remote_data"]
- return connector.expandPythonRef(self.varname, code)
+ return connector.expandPythonRef(self.varname, code, self.d)
codeobj = compile(code.strip(), self.varname or "<expansion>", "eval")
diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py
index 2bd481b..a17245f 100644
--- a/lib/bb/tests/data.py
+++ b/lib/bb/tests/data.py
@@ -458,8 +458,11 @@ class Remote(unittest.TestCase):
return self.d.localkeys()
def getVarHistory(self, name):
return self.d.varhistory.variable(name)
- def expandPythonRef(self, varname, expr):
- varparse = bb.data_smart.VariableParse(varname, self.d)
+ def expandPythonRef(self, varname, expr, d):
+ localdata = self.d.createCopy()
+ for key in d.localkeys():
+ localdata.setVar(d.getVar(key))
+ varparse = bb.data_smart.VariableParse(varname, localdata)
return varparse.python_sub(expr)
def setVar(self, name, value):
self.d.setVar(name, value)
@@ -483,3 +486,6 @@ class Remote(unittest.TestCase):
# Test setVar on client side affects server
d2.setVar('HELLO', 'other-world')
self.assertEqual(d1.getVar('HELLO'), 'other-world')
+ # Test client side data is incorporated in python expansion (which is done on server)
+ d2.setVar('FOO', 'bar')
+ self.assertEqual(d2.expand('${@d.getVar("FOO")}'), 'bar')
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index c551a9f..720bf4b 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -29,6 +29,7 @@ import bb.providers
import bb.taskdata
import bb.utils
import bb.command
+import bb.remotedata
from bb.cookerdata import CookerConfiguration, ConfigParameters
from bb.main import setup_bitbake, BitBakeConfigParameters, BBMainException
import bb.fetch2
@@ -69,8 +70,9 @@ class TinfoilDataStoreConnector:
return set(self.tinfoil.run_command('dataStoreConnectorGetKeys', self.dsindex))
def getVarHistory(self, name):
return self.tinfoil.run_command('dataStoreConnectorGetVarHistory', self.dsindex, name)
- def expandPythonRef(self, varname, expr):
- ret = self.tinfoil.run_command('dataStoreConnectorExpandPythonRef', self.dsindex, varname, expr)
+ def expandPythonRef(self, varname, expr, d):
+ ds = bb.remotedata.RemoteDatastores.transmit_datastore(d)
+ ret = self.tinfoil.run_command('dataStoreConnectorExpandPythonRef', ds, varname, expr)
return ret
def setVar(self, varname, value):
if self.dsindex is None:
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 11/15] cooker: allow buildFile warning to be hidden programmatically
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (9 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 10/15] tinfoil: pass datastore to server when expanding python references Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 12/15] data_smart: support serialisation Paul Eggleton
` (3 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
If we want to use this function/command internally, we don't want this
warning shown.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/command.py | 6 +++++-
lib/bb/cooker.py | 9 +++++----
lib/bb/tinfoil.py | 4 ++--
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/lib/bb/command.py b/lib/bb/command.py
index 352838b..3b68c1a 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -549,8 +549,12 @@ class CommandsAsync:
"""
bfile = params[0]
task = params[1]
+ if len(params) > 2:
+ hidewarning = params[2]
+ else:
+ hidewarning = False
- command.cooker.buildFile(bfile, task)
+ command.cooker.buildFile(bfile, task, hidewarning)
buildFile.needcache = False
def buildTargets(self, command, params):
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 48904a5..a4aaac5 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1334,15 +1334,16 @@ class BBCooker:
raise NoSpecificMatch
return matches[0]
- def buildFile(self, buildfile, task):
+ def buildFile(self, buildfile, task, hidewarning=False):
"""
Build the file matching regexp buildfile
"""
bb.event.fire(bb.event.BuildInit(), self.expanded_data)
- # Too many people use -b because they think it's how you normally
- # specify a target to be built, so show a warning
- bb.warn("Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.")
+ if not hidewarning:
+ # Too many people use -b because they think it's how you normally
+ # specify a target to be built, so show a warning
+ bb.warn("Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.")
# Parse the configuration here. We need to do it explicitly here since
# buildFile() doesn't use the cache
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 720bf4b..96275fd 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -366,9 +366,9 @@ class Tinfoil:
def build_file(self, buildfile, task):
"""
Runs the specified task for just a single recipe (i.e. no dependencies).
- This is equivalent to bitbake -b.
+ This is equivalent to bitbake -b, except no warning will be printed.
"""
- return self.run_command('buildFile', buildfile, task)
+ return self.run_command('buildFile', buildfile, task, True)
def shutdown(self):
if self.server_connection:
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 12/15] data_smart: support serialisation
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (10 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 11/15] cooker: allow buildFile warning to be hidden programmatically Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 13/15] runqueue: enable setVariable command to affect task execution Paul Eggleton
` (2 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
The COW object used within VariableHistory can't be serialised itself,
but we can convert it to a dict when serializing and then back when
deserialising. This finally allows DataSmart objects to be serialized.
NOTE: "serialisation" here means pickling, not over XMLRPC or any other
transport.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/data_smart.py | 13 +++++++++++++
lib/bb/tests/data.py | 23 +++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 4d0a771..79d591a 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -230,6 +230,19 @@ class VariableHistory(object):
new.variables = self.variables.copy()
return new
+ def __getstate__(self):
+ vardict = {}
+ for k, v in self.variables.iteritems():
+ vardict[k] = v
+ return {'dataroot': self.dataroot,
+ 'variables': vardict}
+
+ def __setstate__(self, state):
+ self.dataroot = state['dataroot']
+ self.variables = COWDictBase.copy()
+ for k, v in state['variables'].items():
+ self.variables[k] = v
+
def record(self, *kwonly, **loginfo):
if not self.dataroot._tracking:
return
diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py
index a17245f..ba30d12 100644
--- a/lib/bb/tests/data.py
+++ b/lib/bb/tests/data.py
@@ -446,6 +446,29 @@ class Contains(unittest.TestCase):
self.assertFalse(bb.utils.contains_any("SOMEFLAG", "x y z", True, False, self.d))
+class Serialize(unittest.TestCase):
+
+ def test_serialize(self):
+ import tempfile
+ import pickle
+ d = bb.data.init()
+ d.enableTracking()
+ d.setVar('HELLO', 'world')
+ d.setVarFlag('HELLO', 'other', 'planet')
+ with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
+ tmpfilename = tmpfile.name
+ pickle.dump(d, tmpfile)
+
+ with open(tmpfilename, 'rb') as f:
+ newd = pickle.load(f)
+
+ os.remove(tmpfilename)
+
+ self.assertEqual(d, newd)
+ self.assertEqual(newd.getVar('HELLO', True), 'world')
+ self.assertEqual(newd.getVarFlag('HELLO', 'other'), 'planet')
+
+
class Remote(unittest.TestCase):
def test_remote(self):
class TestConnector:
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 13/15] runqueue: enable setVariable command to affect task execution
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (11 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 12/15] data_smart: support serialisation Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 14/15] siggen: add means of ignoring basehash mismatch Paul Eggleton
2016-12-13 7:07 ` [PATCH 15/15] server/process: don't change UI process signal handler on terminate Paul Eggleton
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
Allow the client to set variables with the setVariable command and have
those changes take effect when running tasks. This is accomplished by
collecting changes made by setVariable separately and pass these to the
worker so it can be applied on top of the datastore it creates.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
bin/bitbake-worker | 12 ++++++++++--
lib/bb/command.py | 1 +
lib/bb/cooker.py | 1 +
lib/bb/runqueue.py | 1 +
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 97b32c3..4dbd681 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -136,7 +136,7 @@ def sigterm_handler(signum, frame):
os.killpg(0, signal.SIGTERM)
sys.exit()
-def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, appends, taskdepdata, quieterrors=False):
+def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, appends, taskdepdata, extraconfigdata, quieterrors=False):
# We need to setup the environment BEFORE the fork, since
# a fork() or exec*() activates PSEUDO...
@@ -223,6 +223,9 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, append
the_data.setVar("BUILDNAME", workerdata["buildname"])
the_data.setVar("DATE", workerdata["date"])
the_data.setVar("TIME", workerdata["time"])
+ for varname, value in extraconfigdata.items():
+ the_data.setVar(varname, value)
+
bb.parse.siggen.set_taskdata(workerdata["sigdata"])
ret = 0
@@ -329,6 +332,7 @@ class BitbakeWorker(object):
self.cookercfg = None
self.databuilder = None
self.data = None
+ self.extraconfigdata = None
self.build_pids = {}
self.build_pipes = {}
@@ -363,6 +367,7 @@ class BitbakeWorker(object):
pass
if len(self.queue):
self.handle_item(b"cookerconfig", self.handle_cookercfg)
+ self.handle_item(b"extraconfigdata", self.handle_extraconfigdata)
self.handle_item(b"workerdata", self.handle_workerdata)
self.handle_item(b"runtask", self.handle_runtask)
self.handle_item(b"finishnow", self.handle_finishnow)
@@ -391,6 +396,9 @@ class BitbakeWorker(object):
self.databuilder.parseBaseConfiguration()
self.data = self.databuilder.data
+ def handle_extraconfigdata(self, data):
+ self.extraconfigdata = pickle.loads(data)
+
def handle_workerdata(self, data):
self.workerdata = pickle.loads(data)
bb.msg.loggerDefaultDebugLevel = self.workerdata["logdefaultdebug"]
@@ -416,7 +424,7 @@ class BitbakeWorker(object):
fn, task, taskname, quieterrors, appends, taskdepdata = pickle.loads(data)
workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname))
- pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, quieterrors)
+ pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, self.extraconfigdata, quieterrors)
self.build_pids[pid] = task
self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout)
diff --git a/lib/bb/command.py b/lib/bb/command.py
index 3b68c1a..5bce796 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -187,6 +187,7 @@ class CommandsSync:
"""
varname = params[0]
value = str(params[1])
+ command.cooker.extraconfigdata[varname] = value
command.cooker.data.setVar(varname, value)
def getSetVariable(self, command, params):
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index a4aaac5..620ff9f 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -358,6 +358,7 @@ class BBCooker:
self.databuilder.parseBaseConfiguration()
self.data = self.databuilder.data
self.data_hash = self.databuilder.data_hash
+ self.extraconfigdata = {}
if consolelog:
self.data.setVar("BB_CONSOLELOG", consolelog)
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 389df4f..2ad8aad 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -1036,6 +1036,7 @@ class RunQueue:
}
worker.stdin.write(b"<cookerconfig>" + pickle.dumps(self.cooker.configuration) + b"</cookerconfig>")
+ worker.stdin.write(b"<extraconfigdata>" + pickle.dumps(self.cooker.extraconfigdata) + b"</extraconfigdata>")
worker.stdin.write(b"<workerdata>" + pickle.dumps(workerdata) + b"</workerdata>")
worker.stdin.flush()
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 14/15] siggen: add means of ignoring basehash mismatch
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (12 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 13/15] runqueue: enable setVariable command to affect task execution Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
2016-12-13 7:07 ` [PATCH 15/15] server/process: don't change UI process signal handler on terminate Paul Eggleton
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
If you run the setVariable command to set variables then you end up
causing the basehash to not match the previously computed values, which
triggers error messages. These mismatches are expected, so add a means
of disabling them.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/siggen.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index fa8a6b1..b20b9cf 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -101,6 +101,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
def _build_data(self, fn, d):
+ ignore_mismatch = ((d.getVar("BB_HASH_IGNORE_MISMATCH", True) or '') == '1')
tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d)
taskdeps = {}
@@ -135,7 +136,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
data = data + str(var)
datahash = hashlib.md5(data.encode("utf-8")).hexdigest()
k = fn + "." + task
- if k in self.basehash and self.basehash[k] != datahash:
+ if not ignore_mismatch and k in self.basehash and self.basehash[k] != datahash:
bb.error("When reparsing %s, the basehash value changed from %s to %s. The metadata is not deterministic and this needs to be fixed." % (k, self.basehash[k], datahash))
self.basehash[k] = datahash
taskdeps[task] = alldeps
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 15/15] server/process: don't change UI process signal handler on terminate
2016-12-13 7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
` (13 preceding siblings ...)
2016-12-13 7:07 ` [PATCH 14/15] siggen: add means of ignoring basehash mismatch Paul Eggleton
@ 2016-12-13 7:07 ` Paul Eggleton
14 siblings, 0 replies; 17+ messages in thread
From: Paul Eggleton @ 2016-12-13 7:07 UTC (permalink / raw)
To: bitbake-devel
On terminating the connection to the server, we were disabling SIGINT -
and this is executed on the UI side. I'm not sure whether the intention
here was to undo the SIGINT disabling we did in the server, and it was
just a mistake that it disabled rather than restored and it's run on the
wrong side, or whether we wanted to stop the user from breaking out of
the shutdown code - the commit message provides no clues either way.
Regardless, we do not want to permanently disable Ctrl+C here - it's
legitimate to terminate the connection to the server and then
re-establish it within the same process; at least currently, devtool
modify by virtue of using tinfoil in two separate parts of the code does
this, and the result of this disabling is that during the second tinfoil
usage we can potentially be parsing all recipes without the ability to
easily interrupt the process.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/server/process.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 1654faf..1036366 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -224,7 +224,6 @@ class BitBakeProcessServerConnection(BitBakeBaseServerConnection):
if isinstance(event, logging.LogRecord):
logger.handle(event)
- signal.signal(signal.SIGINT, signal.SIG_IGN)
self.procserver.stop()
while self.procserver.is_alive():
--
2.5.5
^ permalink raw reply related [flat|nested] 17+ messages in thread