summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/license.py15
-rw-r--r--meta/lib/oe/spdx30_tasks.py35
-rw-r--r--meta/lib/oe/utils.py43
3 files changed, 38 insertions, 55 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 6f882c3812..6e55fa1e7f 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -462,3 +462,18 @@ def skip_incompatible_package_licenses(d, pkgs):
462 skipped_pkgs[pkg] = incompatible_lic 462 skipped_pkgs[pkg] = incompatible_lic
463 463
464 return skipped_pkgs 464 return skipped_pkgs
465
466def tidy_licenses(value):
467 """
468 Flat, split and sort licenses.
469 """
470 from oe.license import flattened_licenses
471
472 def _choose(a, b):
473 str_a, str_b = sorted((" & ".join(a), " & ".join(b)), key=str.casefold)
474 return ["(%s | %s)" % (str_a, str_b)]
475
476 if not isinstance(value, str):
477 value = " & ".join(value)
478
479 return sorted(list(set(flattened_licenses(value, _choose))), key=str.casefold)
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index beeafc2bb7..c352dab152 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -552,7 +552,7 @@ def create_spdx(d):
552 ) 552 )
553 build_objset.new_relationship( 553 build_objset.new_relationship(
554 source_files, 554 source_files,
555 oe.spdx30.RelationshipType.hasConcludedLicense, 555 oe.spdx30.RelationshipType.hasDeclaredLicense,
556 [oe.sbom30.get_element_link_id(recipe_spdx_license)], 556 [oe.sbom30.get_element_link_id(recipe_spdx_license)],
557 ) 557 )
558 558
@@ -724,24 +724,23 @@ def create_spdx(d):
724 impact_statement=description, 724 impact_statement=description,
725 ) 725 )
726 726
727 if detail in ( 727 vex_just_type = d.getVarFlag(
728 "ignored", 728 "CVE_CHECK_VEX_JUSTIFICATION", detail
729 "cpe-incorrect", 729 )
730 "disputed", 730 if vex_just_type:
731 "upstream-wontfix", 731 if (
732 ): 732 vex_just_type
733 # VEX doesn't have justifications for this 733 not in oe.spdx30.security_VexJustificationType.NAMED_INDIVIDUALS
734 pass 734 ):
735 elif detail in ( 735 bb.fatal(
736 "not-applicable-config", 736 f"Unknown vex justification '{vex_just_type}', detail '{detail}', for ignored {cve}"
737 "not-applicable-platform",
738 ):
739 for v in spdx_vex:
740 v.security_justificationType = (
741 oe.spdx30.security_VexJustificationType.vulnerableCodeNotPresent
742 ) 737 )
743 else: 738
744 bb.fatal(f"Unknown detail '{detail}' for ignored {cve}") 739 for v in spdx_vex:
740 v.security_justificationType = oe.spdx30.security_VexJustificationType.NAMED_INDIVIDUALS[
741 vex_just_type
742 ]
743
745 elif status == "Unknown": 744 elif status == "Unknown":
746 bb.note(f"Skipping {cve} with status 'Unknown'") 745 bb.note(f"Skipping {cve} with status 'Unknown'")
747 else: 746 else:
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):