diff options
| author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-07-07 14:48:55 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-21 07:47:52 +0100 |
| commit | e1aa836bb9f2e3d3616f7303501e4bab48d2d429 (patch) | |
| tree | cc909ffd3b0fc1c25652535349eca3f6607a49fe /meta/lib/oeqa | |
| parent | 90436919f802908152e40e2d3ea6fd6b54da910c (diff) | |
| download | poky-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/lib/oeqa')
| -rwxr-xr-x | meta/lib/oeqa/runexported.py | 16 | ||||
| -rw-r--r-- | meta/lib/oeqa/utils/commands.py | 12 |
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: | |||
| 31 | sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa"))) | 31 | sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa"))) |
| 32 | 32 | ||
| 33 | from oeqa.oetest import ExportTestContext | 33 | from oeqa.oetest import ExportTestContext |
| 34 | from oeqa.utils.commands import runCmd | 34 | from oeqa.utils.commands import runCmd, updateEnv |
| 35 | from oeqa.utils.sshcontrol import SSHControl | 35 | from 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 | |||
| 142 | def 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 | ||
| 154 | if __name__ == "__main__": | 142 | if __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 | |||
| 265 | def 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 | ||
