diff options
-rw-r--r-- | meta/lib/oe/license.py | 15 | ||||
-rw-r--r-- | scripts/lib/recipetool/create.py | 11 |
2 files changed, 16 insertions, 10 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 | |||
466 | def 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/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 5d7fcbbb98..ef0ba974a9 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -18,6 +18,7 @@ from urllib.parse import urlparse, urldefrag, urlsplit | |||
18 | import hashlib | 18 | import hashlib |
19 | import bb.fetch2 | 19 | import bb.fetch2 |
20 | logger = logging.getLogger('recipetool') | 20 | logger = logging.getLogger('recipetool') |
21 | from oe.license import tidy_licenses | ||
21 | from oe.license_finder import find_licenses | 22 | from oe.license_finder import find_licenses |
22 | 23 | ||
23 | tinfoil = None | 24 | tinfoil = None |
@@ -950,16 +951,6 @@ def fixup_license(value): | |||
950 | return '(' + value + ')' | 951 | return '(' + value + ')' |
951 | return value | 952 | return value |
952 | 953 | ||
953 | def tidy_licenses(value): | ||
954 | """Flat, split and sort licenses""" | ||
955 | from oe.license import flattened_licenses | ||
956 | def _choose(a, b): | ||
957 | str_a, str_b = sorted((" & ".join(a), " & ".join(b)), key=str.casefold) | ||
958 | return ["(%s | %s)" % (str_a, str_b)] | ||
959 | if not isinstance(value, str): | ||
960 | value = " & ".join(value) | ||
961 | return sorted(list(set(flattened_licenses(value, _choose))), key=str.casefold) | ||
962 | |||
963 | def handle_license_vars(srctree, lines_before, handled, extravalues, d): | 954 | def handle_license_vars(srctree, lines_before, handled, extravalues, d): |
964 | lichandled = [x for x in handled if x[0] == 'license'] | 955 | lichandled = [x for x in handled if x[0] == 'license'] |
965 | if lichandled: | 956 | if lichandled: |