]> code.ossystems Code Review - openembedded-core.git/commitdiff
utils: Always use datastore's PATH for host_gcc_version
authorRoss Burton <ross.burton@intel.com>
Thu, 15 Dec 2016 19:09:16 +0000 (19:09 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 16 Dec 2016 08:40:11 +0000 (08:40 +0000)
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/utils.py

index bb3f0e5d753e10a14dfc2907566f3458071a9177..bf440ec960cdab18136e2fba378bb9c0f8da8296 100644 (file)
@@ -231,12 +231,16 @@ def format_pkg_list(pkg_dict, ret_format=None):
     return '\n'.join(output)
 
 def host_gcc_version(d):
+    import re, subprocess
+
     compiler = d.getVar("BUILD_CC")
-    retval, output = getstatusoutput("%s --version" % compiler)
-    if retval:
-        bb.fatal("Error running %s --version: %s" % (compiler, output))
+    try:
+        env = os.environ.copy()
+        env["PATH"] = d.getVar("PATH")
+        output = subprocess.check_output("%s --version" % compiler, shell=True, env=env).decode("utf-8")
+    except subprocess.CalledProcessError as e:
+        bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8")))
 
-    import re
     match = re.match(".* (\d\.\d)\.\d.*", output.split('\n')[0])
     if not match:
         bb.fatal("Can't get compiler version from %s --version output" % compiler)