diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/data.py | 15 | ||||
-rw-r--r-- | lib/bb/runqueue.py | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py index e472cd24d..7b4590417 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -232,6 +232,21 @@ def emit_env(o=sys.__stdout__, d = init(), all=False): for key in keys: emit_var(key, o, d, all and not isfunc) and o.write('\n') +def exported_keys(d): + return (key for key in d.keys() if not key.startswith('__') and + d.getVarFlag(key, 'export') and + not d.getVarFlag(key, 'unexport')) + +def exported_vars(d): + for key in exported_keys(d): + try: + value = d.getVar(key, True) + except Exception: + pass + + if value is not None: + yield key, str(value) + def emit_func(func, o=sys.__stdout__, d = init()): """Emits all items in the data store in a format such that it can be sourced by a shell.""" diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py index f5fc7bfff..5953d1dc3 100644 --- a/lib/bb/runqueue.py +++ b/lib/bb/runqueue.py @@ -1063,6 +1063,7 @@ class RunQueueExecute: bb.msg.fatal(bb.msg.domain.RunQueue, "fork failed: %d (%s)" % (e.errno, e.strerror)) if pid == 0: pipein.close() + # Save out the PID so that the event can include it the # events bb.event.worker_pid = os.getpid() @@ -1081,6 +1082,7 @@ class RunQueueExecute: try: the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.get_file_appends(fn), self.cooker.configuration.data) the_data.setVar('BB_TASKHASH', self.rqdata.runq_hash[task]) + os.environ.update(bb.data.exported_vars(the_data)) bb.build.exec_task(fn, taskname, the_data) except Exception as exc: if not quieterrors: |