diff options
author | Ross Burton <ross.burton@intel.com> | 2016-12-15 19:09:16 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-16 10:23:23 +0000 |
commit | 1969854ec30188940a185ca19fb7c3df81cf8692 (patch) | |
tree | 764c6a32d2f15da81fe9aff38cc3abe8599c9900 | |
parent | 1e8c6434c94383b234ca94a4b042bc56fa30b4b5 (diff) | |
download | poky-1969854ec30188940a185ca19fb7c3df81cf8692.tar.gz |
utils: Always use datastore's PATH for host_gcc_version
BUILD_CC may reference something like ccache and expect this to come from
ccache-native, we at least have some selftests which assume this. Modify the
code to use PATH when runnig BUILD_CC to ensure the tests continue to work
as expected.
(From OE-Core rev: f3e753372baac43d0921186340cf260df056de20)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/utils.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index bb3f0e5d75..bf440ec960 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -231,12 +231,16 @@ def format_pkg_list(pkg_dict, ret_format=None): | |||
231 | return '\n'.join(output) | 231 | return '\n'.join(output) |
232 | 232 | ||
233 | def host_gcc_version(d): | 233 | def host_gcc_version(d): |
234 | import re, subprocess | ||
235 | |||
234 | compiler = d.getVar("BUILD_CC") | 236 | compiler = d.getVar("BUILD_CC") |
235 | retval, output = getstatusoutput("%s --version" % compiler) | 237 | try: |
236 | if retval: | 238 | env = os.environ.copy() |
237 | bb.fatal("Error running %s --version: %s" % (compiler, output)) | 239 | env["PATH"] = d.getVar("PATH") |
240 | output = subprocess.check_output("%s --version" % compiler, shell=True, env=env).decode("utf-8") | ||
241 | except subprocess.CalledProcessError as e: | ||
242 | bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8"))) | ||
238 | 243 | ||
239 | import re | ||
240 | match = re.match(".* (\d\.\d)\.\d.*", output.split('\n')[0]) | 244 | match = re.match(".* (\d\.\d)\.\d.*", output.split('\n')[0]) |
241 | if not match: | 245 | if not match: |
242 | bb.fatal("Can't get compiler version from %s --version output" % compiler) | 246 | bb.fatal("Can't get compiler version from %s --version output" % compiler) |