[oe-commits] [openembedded-core] 28/28: utils: Always use datastore's PATH for host_gcc_version

git at git.openembedded.org git at git.openembedded.org
Fri Dec 16 08:41:20 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit f3e753372baac43d0921186340cf260df056de20
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Thu Dec 15 19:09:16 2016 +0000

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/utils.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index bb3f0e5..bf440ec 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):
     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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list