summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-07-07 14:48:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-21 07:47:52 +0100
commite1aa836bb9f2e3d3616f7303501e4bab48d2d429 (patch)
treecc909ffd3b0fc1c25652535349eca3f6607a49fe /meta
parent90436919f802908152e40e2d3ea6fd6b54da910c (diff)
downloadpoky-e1aa836bb9f2e3d3616f7303501e4bab48d2d429.tar.gz
lib/oeqa/utils/commands.py: Move updateEnv() from runexported.py
updateEnv() can be used in other places so move the function to utils/commands.py (From OE-Core rev: 380e5d80898cac4ffc9715b3f597d0b62a0643ff) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/lib/oeqa/runexported.py16
-rw-r--r--meta/lib/oeqa/utils/commands.py12
2 files changed, 14 insertions, 14 deletions
diff --git a/meta/lib/oeqa/runexported.py b/meta/lib/oeqa/runexported.py
index 58867393bb..125e86d0e6 100755
--- a/meta/lib/oeqa/runexported.py
+++ b/meta/lib/oeqa/runexported.py
@@ -31,7 +31,7 @@ except ImportError:
31sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa"))) 31sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa")))
32 32
33from oeqa.oetest import ExportTestContext 33from oeqa.oetest import ExportTestContext
34from oeqa.utils.commands import runCmd 34from oeqa.utils.commands import runCmd, updateEnv
35from oeqa.utils.sshcontrol import SSHControl 35from oeqa.utils.sshcontrol import SSHControl
36 36
37# this isn't pretty but we need a fake target object 37# this isn't pretty but we need a fake target object
@@ -137,19 +137,7 @@ def extract_sdk(d):
137 if f.startswith("environment-setup"): 137 if f.startswith("environment-setup"):
138 print("Setting up SDK environment...") 138 print("Setting up SDK environment...")
139 env_file = os.path.join(extract_path, f) 139 env_file = os.path.join(extract_path, f)
140 update_env(env_file) 140 updateEnv(env_file)
141
142def update_env(env_file):
143 """
144 Source a file and update environment
145 """
146
147 cmd = ". %s; env -0" % env_file
148 result = runCmd(cmd)
149
150 for line in result.output.split("\0"):
151 (key, _, value) = line.partition("=")
152 os.environ[key] = value
153 141
154if __name__ == "__main__": 142if __name__ == "__main__":
155 try: 143 try:
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 418643a1a6..4f79d15bb8 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -261,3 +261,15 @@ def runqemu(pn, ssh=True):
261 qemu.stop() 261 qemu.stop()
262 except: 262 except:
263 pass 263 pass
264
265def updateEnv(env_file):
266 """
267 Source a file and update environment.
268 """
269
270 cmd = ". %s; env -0" % env_file
271 result = runCmd(cmd)
272
273 for line in result.output.split("\0"):
274 (key, _, value) = line.partition("=")
275 os.environ[key] = value