summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r--meta/lib/oe/utils.py43
1 files changed, 6 insertions, 37 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index a11db5f3cd..779c5e593f 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -415,60 +415,29 @@ def format_pkg_list(pkg_dict, ret_format=None, pkgdata_dir=None):
415 return output_str 415 return output_str
416 416
417 417
418# Helper function to get the host compiler version 418# Helper function to get the host gcc version
419# Do not assume the compiler is gcc 419def get_host_gcc_version(d, taskcontextonly=False):
420def get_host_compiler_version(d, taskcontextonly=False):
421 import re, subprocess 420 import re, subprocess
422 421
423 if taskcontextonly and d.getVar('BB_WORKERCONTEXT') != '1': 422 if taskcontextonly and d.getVar('BB_WORKERCONTEXT') != '1':
424 return 423 return
425 424
426 compiler = d.getVar("BUILD_CC")
427 # Get rid of ccache since it is not present when parsing.
428 if compiler.startswith('ccache '):
429 compiler = compiler[7:]
430 try: 425 try:
431 env = os.environ.copy() 426 env = os.environ.copy()
432 # datastore PATH does not contain session PATH as set by environment-setup-... 427 # datastore PATH does not contain session PATH as set by environment-setup-...
433 # this breaks the install-buildtools use-case 428 # this breaks the install-buildtools use-case
434 # env["PATH"] = d.getVar("PATH") 429 # env["PATH"] = d.getVar("PATH")
435 output = subprocess.check_output("%s --version" % compiler, \ 430 output = subprocess.check_output("gcc --version", \
436 shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8") 431 shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8")
437 except subprocess.CalledProcessError as e: 432 except subprocess.CalledProcessError as e:
438 bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8"))) 433 bb.fatal("Error running gcc --version: %s" % (e.output.decode("utf-8")))
439 434
440 match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0]) 435 match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0])
441 if not match: 436 if not match:
442 bb.fatal("Can't get compiler version from %s --version output" % compiler) 437 bb.fatal("Can't get compiler version from gcc --version output")
443 438
444 version = match.group(1) 439 version = match.group(1)
445 return compiler, version 440 return version
446
447
448def host_gcc_version(d, taskcontextonly=False):
449 import re, subprocess
450
451 if taskcontextonly and d.getVar('BB_WORKERCONTEXT') != '1':
452 return
453
454 compiler = d.getVar("BUILD_CC")
455 # Get rid of ccache since it is not present when parsing.
456 if compiler.startswith('ccache '):
457 compiler = compiler[7:]
458 try:
459 env = os.environ.copy()
460 env["PATH"] = d.getVar("PATH")
461 output = subprocess.check_output("%s --version" % compiler, \
462 shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8")
463 except subprocess.CalledProcessError as e:
464 bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8")))
465
466 match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0])
467 if not match:
468 bb.fatal("Can't get compiler version from %s --version output" % compiler)
469
470 version = match.group(1)
471 return "-%s" % version if version in ("4.8", "4.9") else ""
472 441
473@bb.parse.vardepsexclude("DEFAULTTUNE_MULTILIB_ORIGINAL", "OVERRIDES") 442@bb.parse.vardepsexclude("DEFAULTTUNE_MULTILIB_ORIGINAL", "OVERRIDES")
474def get_multilib_datastore(variant, d): 443def get_multilib_datastore(variant, d):