From patchwork Thu Oct 24 19:03:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 51214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 617F5D2E03D for ; Thu, 24 Oct 2024 19:04:53 +0000 (UTC) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) by mx.groups.io with SMTP id smtpd.web10.4514.1729796686316251826 for ; Thu, 24 Oct 2024 12:04:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CNzN7sy4; spf=pass (domain: gmail.com, ip: 209.85.210.44, mailfrom: jpewhacker@gmail.com) Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-718123ec383so774214a34.3 for ; Thu, 24 Oct 2024 12:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729796685; x=1730401485; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hBM8DwEyE+LTH168dXu7BjzcactKkjlJ5/1EwcrqbFM=; b=CNzN7sy4g4D9AzVETNNYm/VgqI5sHwdKCpBej2Q9ZwOSHHdv5UAz0e6BhZqZVQ+AQ9 0b4W3fwSQlo1pqb1YkC1c3LrV5ZZpmvJpS4NkfFIfPNg5PrYMPqe3XIT0IzQrcHID8vy FLxiWblCY5SiHs0HkMxuqQWViii8XThLNDV1DLaybdZU3QouQi7LsNV1w/GtolDXMm6w JCj05DW/GxM4j0qXheDb+w37/ExJvyUqVVTQhMDR6sx9NCkFpXvRqX4RbTN9zlEPxniP /eOlTopeKtvaIVtqC+glYNGqFiRahOT1NwwOiwvUD/A/mSGZNVmiAYgpWzAIlyxCEOhB j0kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729796685; x=1730401485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hBM8DwEyE+LTH168dXu7BjzcactKkjlJ5/1EwcrqbFM=; b=oC7ByXWPX2Whul9REdgUvrLb/WIOvqnTV7S90BXSegDkimYnx9RsbVWNRaeCIrj9zU RWNQAn22PFgI5DGIqEs09U8bpeFfAbeBibb8KX2tTl8ruZOKpvk9aQ17mZw5TgHfa38c RigmTXZmy6GC2xVuutQdQsxGzCug66rJS4eZqNFp0N0OOLQedkGW2sPwwShHUVDE1FAT JFGxeoRT0zULJUDF1EfzaexFiJGRaB62JhxyZUExR0SnyXAg9fyPUtO5wR0BNAwnUKD/ M+XvGX9QAqNGPCioTBOwXLDDzXzSQjdY6tY4CcJjzYQsqlbF/qRhE0lHTxruNh/4XDEA iN4A== X-Gm-Message-State: AOJu0Yxx/G0S8eXMkGp8iClhuXgkU43vtAsGR0E6xC86w7X3iXfYpahs gQdeYZ94693EeaC4lmSMv1K9LjS8TYi+NXBMSt+MytfBOB+uWiEbeTOV/g== X-Google-Smtp-Source: AGHT+IG5jwGqDz4acRbBO+m7tdKdi8ff4rYNVixO4Jd6j00cS8LyazKi6l+WrQvljVcMZfp5qo/2xw== X-Received: by 2002:a05:6830:620f:b0:718:fd8:1f7 with SMTP id 46e09a7af769-7184b311225mr8234381a34.23.1729796684887; Thu, 24 Oct 2024 12:04:44 -0700 (PDT) Received: from localhost.localdomain ([2601:282:4300:19e0::4437]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7182ebd5af8sm2233242a34.55.2024.10.24.12.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 12:04:43 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt To: openembedded-core@lists.openembedded.org Cc: Joshua Watt Subject: [OE-core][PATCH v3 1/4] classes-global/license: Move functions to library code Date: Thu, 24 Oct 2024 13:03:07 -0600 Message-ID: <20241024190438.3630946-2-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241024190438.3630946-1-JPEWhacker@gmail.com> References: <20241023212013.995247-1-JPEWhacker@gmail.com> <20241024190438.3630946-1-JPEWhacker@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Oct 2024 19:04:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206304 Moves several of the functions in license.bbclass to be library code New function dependencies were manually verified using bitbake-dumpsigs to ensure that bitbake identified the same dependencies even though they are now in library code (although the new function names mean that the task hashes still change) Signed-off-by: Joshua Watt --- meta/classes-global/base.bbclass | 10 +- meta/classes-global/license.bbclass | 165 ---------------------- meta/classes-recipe/license_image.bbclass | 14 +- meta/lib/oe/license.py | 163 +++++++++++++++++++++ 4 files changed, 175 insertions(+), 177 deletions(-) diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index b6940bbb6ff..88b932fc3f0 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass @@ -528,8 +528,8 @@ python () { bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn) if bb.data.inherits_class('license', d): - check_license_format(d) - unmatched_license_flags = check_license_flags(d) + oe.license.check_license_format(d) + unmatched_license_flags = oe.license.check_license_flags(d) if unmatched_license_flags: for unmatched in unmatched_license_flags: message = "Has a restricted license '%s' which is not listed in your LICENSE_FLAGS_ACCEPTED." % unmatched @@ -583,7 +583,7 @@ python () { check_license = False if check_license and bad_licenses: - bad_licenses = expand_wildcard_licenses(d, bad_licenses) + bad_licenses = oe.license.expand_wildcard_licenses(d, bad_licenses) exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() @@ -599,7 +599,7 @@ python () { for pkg in pkgs: remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) - incompatible_lic = incompatible_license(d, remaining_bad_licenses, pkg) + incompatible_lic = oe.license.incompatible_license(d, remaining_bad_licenses, pkg) if incompatible_lic: skipped_pkgs[pkg] = incompatible_lic else: @@ -612,7 +612,7 @@ python () { for pkg in unskipped_pkgs: bb.debug(1, "Including the package %s" % pkg) else: - incompatible_lic = incompatible_license(d, bad_licenses) + incompatible_lic = oe.license.incompatible_license(d, bad_licenses) for pkg in skipped_pkgs: incompatible_lic += skipped_pkgs[pkg] incompatible_lic = sorted(list(set(incompatible_lic))) diff --git a/meta/classes-global/license.bbclass b/meta/classes-global/license.bbclass index 043715fcc36..94dcc7f331c 100644 --- a/meta/classes-global/license.bbclass +++ b/meta/classes-global/license.bbclass @@ -255,171 +255,6 @@ def find_license_files(d): return lic_files_paths -def return_spdx(d, license): - """ - This function returns the spdx mapping of a license if it exists. - """ - return d.getVarFlag('SPDXLICENSEMAP', license) - -def canonical_license(d, license): - """ - Return the canonical (SPDX) form of the license if available (so GPLv3 - becomes GPL-3.0-only) or the passed license if there is no canonical form. - """ - return d.getVarFlag('SPDXLICENSEMAP', license) or license - -def expand_wildcard_licenses(d, wildcard_licenses): - """ - There are some common wildcard values users may want to use. Support them - here. - """ - licenses = set(wildcard_licenses) - mapping = { - "AGPL-3.0*" : ["AGPL-3.0-only", "AGPL-3.0-or-later"], - "GPL-3.0*" : ["GPL-3.0-only", "GPL-3.0-or-later"], - "LGPL-3.0*" : ["LGPL-3.0-only", "LGPL-3.0-or-later"], - } - for k in mapping: - if k in wildcard_licenses: - licenses.remove(k) - for item in mapping[k]: - licenses.add(item) - - for l in licenses: - if l in oe.license.obsolete_license_list(): - bb.fatal("Error, %s is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE" % l) - if "*" in l: - bb.fatal("Error, %s is an invalid license wildcard entry" % l) - - return list(licenses) - -def incompatible_license_contains(license, truevalue, falsevalue, d): - license = canonical_license(d, license) - bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() - bad_licenses = expand_wildcard_licenses(d, bad_licenses) - return truevalue if license in bad_licenses else falsevalue - -def incompatible_pkg_license(d, dont_want_licenses, license): - # Handles an "or" or two license sets provided by - # flattened_licenses(), pick one that works if possible. - def choose_lic_set(a, b): - return a if all(oe.license.license_ok(canonical_license(d, lic), - dont_want_licenses) for lic in a) else b - - try: - licenses = oe.license.flattened_licenses(license, choose_lic_set) - except oe.license.LicenseError as exc: - bb.fatal('%s: %s' % (d.getVar('P'), exc)) - - incompatible_lic = [] - for l in licenses: - license = canonical_license(d, l) - if not oe.license.license_ok(license, dont_want_licenses): - incompatible_lic.append(license) - - return sorted(incompatible_lic) - -def incompatible_license(d, dont_want_licenses, package=None): - """ - This function checks if a recipe has only incompatible licenses. It also - take into consideration 'or' operand. dont_want_licenses should be passed - as canonical (SPDX) names. - """ - import oe.license - license = d.getVar("LICENSE:%s" % package) if package else None - if not license: - license = d.getVar('LICENSE') - - return incompatible_pkg_license(d, dont_want_licenses, license) - -def check_license_flags(d): - """ - This function checks if a recipe has any LICENSE_FLAGS that - aren't acceptable. - - If it does, it returns the all LICENSE_FLAGS missing from the list - of acceptable license flags, or all of the LICENSE_FLAGS if there - is no list of acceptable flags. - - If everything is is acceptable, it returns None. - """ - - def license_flag_matches(flag, acceptlist, pn): - """ - Return True if flag matches something in acceptlist, None if not. - - Before we test a flag against the acceptlist, we append _${PN} - to it. We then try to match that string against the - acceptlist. This covers the normal case, where we expect - LICENSE_FLAGS to be a simple string like 'commercial', which - the user typically matches exactly in the acceptlist by - explicitly appending the package name e.g 'commercial_foo'. - If we fail the match however, we then split the flag across - '_' and append each fragment and test until we either match or - run out of fragments. - """ - flag_pn = ("%s_%s" % (flag, pn)) - for candidate in acceptlist: - if flag_pn == candidate: - return True - - flag_cur = "" - flagments = flag_pn.split("_") - flagments.pop() # we've already tested the full string - for flagment in flagments: - if flag_cur: - flag_cur += "_" - flag_cur += flagment - for candidate in acceptlist: - if flag_cur == candidate: - return True - return False - - def all_license_flags_match(license_flags, acceptlist): - """ Return all unmatched flags, None if all flags match """ - pn = d.getVar('PN') - split_acceptlist = acceptlist.split() - flags = [] - for flag in license_flags.split(): - if not license_flag_matches(flag, split_acceptlist, pn): - flags.append(flag) - return flags if flags else None - - license_flags = d.getVar('LICENSE_FLAGS') - if license_flags: - acceptlist = d.getVar('LICENSE_FLAGS_ACCEPTED') - if not acceptlist: - return license_flags.split() - unmatched_flags = all_license_flags_match(license_flags, acceptlist) - if unmatched_flags: - return unmatched_flags - return None - -def check_license_format(d): - """ - This function checks if LICENSE is well defined, - Validate operators in LICENSES. - No spaces are allowed between LICENSES. - """ - pn = d.getVar('PN') - licenses = d.getVar('LICENSE') - from oe.license import license_operator, license_operator_chars, license_pattern - - elements = list(filter(lambda x: x.strip(), license_operator.split(licenses))) - for pos, element in enumerate(elements): - if license_pattern.match(element): - if pos > 0 and license_pattern.match(elements[pos - 1]): - oe.qa.handle_error('license-format', - '%s: LICENSE value "%s" has an invalid format - license names ' \ - 'must be separated by the following characters to indicate ' \ - 'the license selection: %s' % - (pn, licenses, license_operator_chars), d) - elif not license_operator.match(element): - oe.qa.handle_error('license-format', - '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \ - 'in the valid list of separators (%s)' % - (pn, licenses, element, license_operator_chars), d) - SSTATETASKS += "do_populate_lic" do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/" diff --git a/meta/classes-recipe/license_image.bbclass b/meta/classes-recipe/license_image.bbclass index 0e953856a63..d2c5ab902ce 100644 --- a/meta/classes-recipe/license_image.bbclass +++ b/meta/classes-recipe/license_image.bbclass @@ -58,7 +58,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): import stat bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() - bad_licenses = expand_wildcard_licenses(d, bad_licenses) + bad_licenses = oe.license.expand_wildcard_licenses(d, bad_licenses) pkgarchs = d.getVar("SSTATE_ARCHS").split() pkgarchs.reverse() @@ -66,17 +66,17 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): with open(license_manifest, "w") as license_file: for pkg in sorted(pkg_dic): remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) - incompatible_licenses = incompatible_pkg_license(d, remaining_bad_licenses, pkg_dic[pkg]["LICENSE"]) + incompatible_licenses = oe.license.incompatible_pkg_license(d, remaining_bad_licenses, pkg_dic[pkg]["LICENSE"]) if incompatible_licenses: bb.fatal("Package %s cannot be installed into the image because it has incompatible license(s): %s" %(pkg, ' '.join(incompatible_licenses))) else: - incompatible_licenses = incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"]) + incompatible_licenses = oe.license.incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"]) if incompatible_licenses: oe.qa.handle_error('license-exception', "Including %s with incompatible license(s) %s into the image, because it has been allowed by exception list." %(pkg, ' '.join(incompatible_licenses)), d) try: (pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \ oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"], - remaining_bad_licenses, canonical_license, d) + remaining_bad_licenses, oe.license.canonical_license, d) except oe.license.LicenseError as exc: bb.fatal('%s: %s' % (d.getVar('P'), exc)) @@ -144,7 +144,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): if not os.path.exists(pkg_license_dir ): bb.fatal("Couldn't find license information for dependency %s" % pkg) - pkg_manifest_licenses = [canonical_license(d, lic) \ + pkg_manifest_licenses = [oe.license.canonical_license(d, lic) \ for lic in pkg_dic[pkg]["LICENSES"]] licenses = os.listdir(pkg_license_dir) @@ -153,7 +153,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic) if re.match(r"^generic_.*$", lic): - generic_lic = canonical_license(d, + generic_lic = oe.license.canonical_license(d, re.search(r"^generic_(.*)$", lic).group(1)) # Do not copy generic license into package if isn't @@ -176,7 +176,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): if not os.path.exists(pkg_rootfs_license): os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license) else: - if (oe.license.license_ok(canonical_license(d, + if (oe.license.license_ok(oe.license.canonical_license(d, lic), bad_licenses) == False or os.path.exists(pkg_rootfs_license)): continue diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index d9c8d94da47..7739697c401 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py @@ -259,3 +259,166 @@ def apply_pkg_license_exception(pkg, bad_licenses, exceptions): """Return remaining bad licenses after removing any package exceptions""" return [lic for lic in bad_licenses if pkg + ':' + lic not in exceptions] + +def return_spdx(d, license): + """ + This function returns the spdx mapping of a license if it exists. + """ + return d.getVarFlag('SPDXLICENSEMAP', license) + +def canonical_license(d, license): + """ + Return the canonical (SPDX) form of the license if available (so GPLv3 + becomes GPL-3.0-only) or the passed license if there is no canonical form. + """ + return d.getVarFlag('SPDXLICENSEMAP', license) or license + +def expand_wildcard_licenses(d, wildcard_licenses): + """ + There are some common wildcard values users may want to use. Support them + here. + """ + licenses = set(wildcard_licenses) + mapping = { + "AGPL-3.0*" : ["AGPL-3.0-only", "AGPL-3.0-or-later"], + "GPL-3.0*" : ["GPL-3.0-only", "GPL-3.0-or-later"], + "LGPL-3.0*" : ["LGPL-3.0-only", "LGPL-3.0-or-later"], + } + for k in mapping: + if k in wildcard_licenses: + licenses.remove(k) + for item in mapping[k]: + licenses.add(item) + + for l in licenses: + if l in obsolete_license_list(): + bb.fatal("Error, %s is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE" % l) + if "*" in l: + bb.fatal("Error, %s is an invalid license wildcard entry" % l) + + return list(licenses) + +def incompatible_license_contains(license, truevalue, falsevalue, d): + license = canonical_license(d, license) + bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() + bad_licenses = expand_wildcard_licenses(d, bad_licenses) + return truevalue if license in bad_licenses else falsevalue + +def incompatible_pkg_license(d, dont_want_licenses, license): + # Handles an "or" or two license sets provided by + # flattened_licenses(), pick one that works if possible. + def choose_lic_set(a, b): + return a if all(license_ok(canonical_license(d, lic), + dont_want_licenses) for lic in a) else b + + try: + licenses = flattened_licenses(license, choose_lic_set) + except LicenseError as exc: + bb.fatal('%s: %s' % (d.getVar('P'), exc)) + + incompatible_lic = [] + for l in licenses: + license = canonical_license(d, l) + if not license_ok(license, dont_want_licenses): + incompatible_lic.append(license) + + return sorted(incompatible_lic) + +def incompatible_license(d, dont_want_licenses, package=None): + """ + This function checks if a recipe has only incompatible licenses. It also + take into consideration 'or' operand. dont_want_licenses should be passed + as canonical (SPDX) names. + """ + license = d.getVar("LICENSE:%s" % package) if package else None + if not license: + license = d.getVar('LICENSE') + + return incompatible_pkg_license(d, dont_want_licenses, license) + +def check_license_flags(d): + """ + This function checks if a recipe has any LICENSE_FLAGS that + aren't acceptable. + + If it does, it returns the all LICENSE_FLAGS missing from the list + of acceptable license flags, or all of the LICENSE_FLAGS if there + is no list of acceptable flags. + + If everything is is acceptable, it returns None. + """ + + def license_flag_matches(flag, acceptlist, pn): + """ + Return True if flag matches something in acceptlist, None if not. + + Before we test a flag against the acceptlist, we append _${PN} + to it. We then try to match that string against the + acceptlist. This covers the normal case, where we expect + LICENSE_FLAGS to be a simple string like 'commercial', which + the user typically matches exactly in the acceptlist by + explicitly appending the package name e.g 'commercial_foo'. + If we fail the match however, we then split the flag across + '_' and append each fragment and test until we either match or + run out of fragments. + """ + flag_pn = ("%s_%s" % (flag, pn)) + for candidate in acceptlist: + if flag_pn == candidate: + return True + + flag_cur = "" + flagments = flag_pn.split("_") + flagments.pop() # we've already tested the full string + for flagment in flagments: + if flag_cur: + flag_cur += "_" + flag_cur += flagment + for candidate in acceptlist: + if flag_cur == candidate: + return True + return False + + def all_license_flags_match(license_flags, acceptlist): + """ Return all unmatched flags, None if all flags match """ + pn = d.getVar('PN') + split_acceptlist = acceptlist.split() + flags = [] + for flag in license_flags.split(): + if not license_flag_matches(flag, split_acceptlist, pn): + flags.append(flag) + return flags if flags else None + + license_flags = d.getVar('LICENSE_FLAGS') + if license_flags: + acceptlist = d.getVar('LICENSE_FLAGS_ACCEPTED') + if not acceptlist: + return license_flags.split() + unmatched_flags = all_license_flags_match(license_flags, acceptlist) + if unmatched_flags: + return unmatched_flags + return None + +def check_license_format(d): + """ + This function checks if LICENSE is well defined, + Validate operators in LICENSES. + No spaces are allowed between LICENSES. + """ + pn = d.getVar('PN') + licenses = d.getVar('LICENSE') + + elements = list(filter(lambda x: x.strip(), license_operator.split(licenses))) + for pos, element in enumerate(elements): + if license_pattern.match(element): + if pos > 0 and license_pattern.match(elements[pos - 1]): + oe.qa.handle_error('license-format', + '%s: LICENSE value "%s" has an invalid format - license names ' \ + 'must be separated by the following characters to indicate ' \ + 'the license selection: %s' % + (pn, licenses, license_operator_chars), d) + elif not license_operator.match(element): + oe.qa.handle_error('license-format', + '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \ + 'in the valid list of separators (%s)' % + (pn, licenses, element, license_operator_chars), d) From patchwork Thu Oct 24 19:03:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 51213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 617B7D0E3E0 for ; Thu, 24 Oct 2024 19:04:53 +0000 (UTC) Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by mx.groups.io with SMTP id smtpd.web10.4516.1729796688447712801 for ; Thu, 24 Oct 2024 12:04:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cF+wa3yG; spf=pass (domain: gmail.com, ip: 209.85.160.47, mailfrom: jpewhacker@gmail.com) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-27ce4f37afeso920989fac.0 for ; Thu, 24 Oct 2024 12:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729796687; x=1730401487; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0KI/gANFO2v4nqDVOnl/wP8ydaEQos+O/roVjql14wA=; b=cF+wa3yGXYU/+m7HO1dyteCU0sbNduDnz8tRNiRRd7MnCy+EcaKL1wNe1n/F4/Caf0 viTqj+S9QpTVXXLDgykS782C6ps8ckS8IXEbSm36sPz+13FW4sh5ZdyDn3mJdXBHnlAb UdJOOc//PrLwK12AfTwgi7kxZU+kfhJwHy3YY3C6fLdAUTcLz5G3LeELdWkF1cpteaDb eVIo4j/H9jpNXYr8ibauDNd5W14gxLEZRTIpr34k9d6vJkKPlNdz2r+MgB6SLmuwKGeu unzF3u0f58+1NnJioN3A7zOISjsfBpceOfO6UkCdoadEpusDl+lXDwrgpEZlulrI3MMq ft+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729796687; x=1730401487; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0KI/gANFO2v4nqDVOnl/wP8ydaEQos+O/roVjql14wA=; b=oZ6xUKJnWmohnxxWWQbJ5eJRRqYP64D09eIHYlacs9PdHmLWEMigIN7VTioVAtODMd 2WLBg4iXizGX21mRaZV/CfAtgl7WnxsvUWcosZGOedZiaclMzA8tlYJdLi38Nq3iAlWd bSLLK8EQUR0DxnCvTMVRUfrT/jFqaURxeHJaPQK+5n5tAsTD2X5rjtPZL3bFP8U0I9Er NCdi8RY1cJoqXU4eavTT2t9ha/VZt3PccX+Dhug0mMAzsYWBaDNLTJpLYIKcNNsywMQX QVaMw4laPBcvqbc52kRwmh91tRTL9F3GyiUHodRpGDVI6c+gEi7kDGNpt6fNtrZrGXGb ytsw== X-Gm-Message-State: AOJu0YxWjMo1g5cE4Bgo8Mnetbe/fkTzLNsrUfw64DSHfgarfBdTaNXY qmwEAZRn3A02zIwsqSzBjp5/KYOa7VZ7qoR09ryVlrmFOY6421kB80plRw== X-Google-Smtp-Source: AGHT+IEq4J1NZdfMQZtrgJRaX36rIpjE5rF6lAmVdVW4a0E1xzYQ0A8jTbfgccMbLHV5s6M1lwAfTQ== X-Received: by 2002:a05:6870:d106:b0:261:1aad:2c03 with SMTP id 586e51a60fabf-28ccb9fb991mr7638812fac.43.1729796686953; Thu, 24 Oct 2024 12:04:46 -0700 (PDT) Received: from localhost.localdomain ([2601:282:4300:19e0::4437]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7182ebd5af8sm2233242a34.55.2024.10.24.12.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 12:04:45 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt To: openembedded-core@lists.openembedded.org Cc: Joshua Watt Subject: [OE-core][PATCH v3 2/4] lib: license: Move package license skip to library Date: Thu, 24 Oct 2024 13:03:08 -0600 Message-ID: <20241024190438.3630946-3-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241024190438.3630946-1-JPEWhacker@gmail.com> References: <20241023212013.995247-1-JPEWhacker@gmail.com> <20241024190438.3630946-1-JPEWhacker@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Oct 2024 19:04:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206305 Moves the code that skips packages with incompatible licenses to the library code so that it can be called in other locations Signed-off-by: Joshua Watt --- meta/classes-global/base.bbclass | 35 ++++------------------------ meta/lib/oe/license.py | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 88b932fc3f0..5b8663f454d 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass @@ -573,37 +573,10 @@ python () { bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() - check_license = False if pn.startswith("nativesdk-") else True - for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}", - "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}", - "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]: - if pn.endswith(d.expand(t)): - check_license = False - if pn.startswith("gcc-source-"): - check_license = False - - if check_license and bad_licenses: - bad_licenses = oe.license.expand_wildcard_licenses(d, bad_licenses) - - exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() - - for lic_exception in exceptions: - if ":" in lic_exception: - lic_exception = lic_exception.split(":")[1] - if lic_exception in oe.license.obsolete_license_list(): - bb.fatal("Obsolete license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception) - - pkgs = d.getVar('PACKAGES').split() - skipped_pkgs = {} - unskipped_pkgs = [] - for pkg in pkgs: - remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) - - incompatible_lic = oe.license.incompatible_license(d, remaining_bad_licenses, pkg) - if incompatible_lic: - skipped_pkgs[pkg] = incompatible_lic - else: - unskipped_pkgs.append(pkg) + pkgs = d.getVar('PACKAGES').split() + if pkgs: + skipped_pkgs = oe.license.skip_incompatible_package_licenses(d, pkgs) + unskipped_pkgs = [p for p in pkgs if p not in skipped_pkgs] if unskipped_pkgs: for pkg in skipped_pkgs: diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index 7739697c401..32c77fa204d 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py @@ -422,3 +422,42 @@ def check_license_format(d): '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \ 'in the valid list of separators (%s)' % (pn, licenses, element, license_operator_chars), d) + +def skip_incompatible_package_licenses(d, pkgs): + if not pkgs: + return {} + + pn = d.getVar("PN") + + check_license = False if pn.startswith("nativesdk-") else True + for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}", + "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}", + "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]: + if pn.endswith(d.expand(t)): + check_license = False + if pn.startswith("gcc-source-"): + check_license = False + + bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() + if not check_license or not bad_licenses: + return {} + + bad_licenses = expand_wildcard_licenses(d, bad_licenses) + + exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() + + for lic_exception in exceptions: + if ":" in lic_exception: + lic_exception = lic_exception.split(":")[1] + if lic_exception in obsolete_license_list(): + bb.fatal("Obsolete license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception) + + skipped_pkgs = {} + for pkg in pkgs: + remaining_bad_licenses = apply_pkg_license_exception(pkg, bad_licenses, exceptions) + + incompatible_lic = incompatible_license(d, remaining_bad_licenses, pkg) + if incompatible_lic: + skipped_pkgs[pkg] = incompatible_lic + + return skipped_pkgs From patchwork Thu Oct 24 19:03:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 51211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F595D0BB62 for ; Thu, 24 Oct 2024 19:04:53 +0000 (UTC) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by mx.groups.io with SMTP id smtpd.web11.4450.1729796690504090780 for ; Thu, 24 Oct 2024 12:04:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G96TuwJ4; spf=pass (domain: gmail.com, ip: 209.85.210.53, mailfrom: jpewhacker@gmail.com) Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-71850708dc9so863258a34.0 for ; Thu, 24 Oct 2024 12:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729796689; x=1730401489; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hCUj0MaZWXTXMLYHMf7NbE3LSTYxwmYLulfzZkFKiDY=; b=G96TuwJ4LSSrEDtEub33lvJGyrgoxoJibiEpBibDwv13al0ggtFIMGS2rhMM6bXesz 1mzUeZZaKIyV5PDT5vByh8GJev6qn13HlEjxq600sTCCKdh6IT5DVgCl5yvGlnfFmKxN 0UZVlyxfx4GjwmRp0oSPO2exY1VcVO1dFPy9hLeWVp6u8Uxo4gij0Do6k/lzGBPLNq0z eAuJJcgLTxVb0HNbvo8PjRb6fnYCiwXiUoLjO5yMPDDi187Kv7vJLSFIUj/4Fee6W6G9 u8a0giOzs6V38/h6sNSUGpIejdjQrwytvWAJoF/z85662oRnVvMTKDpphAyDs3rWMGYq xE7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729796689; x=1730401489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hCUj0MaZWXTXMLYHMf7NbE3LSTYxwmYLulfzZkFKiDY=; b=wtYPd4whDR8u37EqBEA4O+cVrcDJNK+ive7xQ2e3ZjR6/xRrrmF+VIF2bKtyI9ppdP QYZafuuDRBDvsguMhV07t1syfLAfLFDOaqwgYrYMVNsIka2w6zKN3bmqK95t9vlsL8ee 2ti3Vo7ooKDxtJybei7+AyhYH1yjlM7y/VeXVJqe4YqdUGRKA6fEW9ZtrF5qAyg0SCDp aKoRPJBrur+/01BLF60cDlhmDmmzJ9LeAsNhN36a3wzqr6Yp4dTA3dNjugTJkd8lwp+M KdszUjoQ4KORgvNvy+ByUeF2JnNrQJc6wn7E+8OhImmlt7w+Md9WVkZO+t5I1UiQ6f9S kE8A== X-Gm-Message-State: AOJu0Yw9qtU1RsjM6A7303h/b9gAdIk6oTRPSrsoyCs3tlD1jMeI0wbq 6tJhLYn6A4rL3/chEw9i+ktJTYyVI6upsL5NLbigyGjoPgZqrTpOWXzIuw== X-Google-Smtp-Source: AGHT+IFrNu8X/iPK56/uiU8u9DtvL9vm2ap1gKoroyutTYhUKekO4bklchooVAc+0dTyRrJ8fosmSw== X-Received: by 2002:a05:6830:43a6:b0:716:a62d:a79a with SMTP id 46e09a7af769-718598d9d5dmr2493903a34.29.1729796689074; Thu, 24 Oct 2024 12:04:49 -0700 (PDT) Received: from localhost.localdomain ([2601:282:4300:19e0::4437]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7182ebd5af8sm2233242a34.55.2024.10.24.12.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 12:04:48 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt To: openembedded-core@lists.openembedded.org Cc: Joshua Watt Subject: [OE-core][PATCH v3 3/4] lib: package: Check incompatible licenses at packaging time Date: Thu, 24 Oct 2024 13:03:09 -0600 Message-ID: <20241024190438.3630946-4-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241024190438.3630946-1-JPEWhacker@gmail.com> References: <20241023212013.995247-1-JPEWhacker@gmail.com> <20241024190438.3630946-1-JPEWhacker@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Oct 2024 19:04:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206306 Instead of checking for incompatible licenses in the anonymous python and setting '_exclude_incompatible-', (re)check all the packages in populate_packages(). This ensures that all packages are processed, even dynamically generated ones. The use of the '_exclude-incompatible-' variable set in base.bbclass has been the mechanism used for per-packages licenses since it was added as a feature (although with different names for the variable throughout history). However, since this misses dynamic packages, calling oe.license.skip_incompatible_package_licenses() a second time on the actual final package set is a better solution. Signed-off-by: Joshua Watt --- meta/classes-global/base.bbclass | 1 - meta/classes-global/package.bbclass | 4 ---- meta/lib/oe/package.py | 6 +++--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 5b8663f454d..b81e61fdb72 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass @@ -581,7 +581,6 @@ python () { if unskipped_pkgs: for pkg in skipped_pkgs: bb.debug(1, "Skipping the package %s at do_rootfs because of incompatible license(s): %s" % (pkg, ' '.join(skipped_pkgs[pkg]))) - d.setVar('_exclude_incompatible-' + pkg, ' '.join(skipped_pkgs[pkg])) for pkg in unskipped_pkgs: bb.debug(1, "Including the package %s" % pkg) else: diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass index 6cd8c0140f2..9be1d6a5b17 100644 --- a/meta/classes-global/package.bbclass +++ b/meta/classes-global/package.bbclass @@ -447,10 +447,6 @@ def gen_packagevar(d, pkgvars="PACKAGEVARS"): for p in pkgs: for v in vars: ret.append(v + ":" + p) - - # Ensure that changes to INCOMPATIBLE_LICENSE re-run do_package for - # affected recipes. - ret.append('_exclude_incompatible-%s' % p) return " ".join(ret) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index c213a9a3ca6..104b880b9e1 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -1447,10 +1447,10 @@ def populate_packages(d): # Handle excluding packages with incompatible licenses package_list = [] + skipped_pkgs = oe.license.skip_incompatible_package_licenses(d, packages) for pkg in packages: - licenses = d.getVar('_exclude_incompatible-' + pkg) - if licenses: - msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses) + if pkg in skipped_pkgs: + msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, skipped_pkgs[pkg]) oe.qa.handle_error("incompatible-license", msg, d) else: package_list.append(pkg) From patchwork Thu Oct 24 19:03:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 51212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D63BD0BB60 for ; Thu, 24 Oct 2024 19:04:53 +0000 (UTC) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by mx.groups.io with SMTP id smtpd.web10.4519.1729796692563971199 for ; Thu, 24 Oct 2024 12:04:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hUA4cEwb; spf=pass (domain: gmail.com, ip: 209.85.210.53, mailfrom: jpewhacker@gmail.com) Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-718123ec383so774270a34.3 for ; Thu, 24 Oct 2024 12:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729796691; x=1730401491; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ETxevPVTLduaxM7LLWbBc/qT/NppgDV48+k3Q2d/w9g=; b=hUA4cEwbDEuKDvMQVYbWFzh9BOR+vsdTFs8+T7gi0rhNfsGkuUahNpBsNvUXHBA4yg j2RYo2hGf7aL/wcjYQKbuqfRREJcosIFTw/49CgQRSnG4VD7bvMg9mF5X0cAd1ycAn3c aUeiKscRz6lfk+Kqrt9kNXmqFL8M38ESBqvulEbaF/SDWHlxMh0wQvlKFdfDXkPOhVpb 8VVRELD224XMkUERELt3UsQliBpX4MeNVG9ivIeuc7QZpA3okd8CILS/KBGOL5OB7dHm k2H5havU3pIrsTFRiBqCSgOq6q5k4MUjgNLxnqE3MwonTantACJB2JA2jODHn54/JPNW v3PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729796691; x=1730401491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ETxevPVTLduaxM7LLWbBc/qT/NppgDV48+k3Q2d/w9g=; b=xOKTwZA5yLOuIYg1wjhThO1NX3tyxyJSwWKzdQQQcEBzjpVortFIIxvg7oGImAGtga Bzk8MFkzhFqcpzfmU7szL11HpAfqoRLH0P+eyILKvJGZsYXjhoZL+cEVaB5I8z1eKxSR Zc1fXMYN7lmsIFY32gGLL9RcZQ/iLg1sZ1HM7qLO5DFwYVVu716cNdaobXxA6FkpZQfW M6tqQAGQXQBj7eEnBZswki85xF5CEToQ2IC+oRzX6ljm27NyKpXV8E9pWHy8sgjonXFe +xfypUeTLybYXgK4mh2lo8EMe5rOvd2W6SS8Uko12YyXJZo7BuBo6/P+Cen/8DA6lngb eutA== X-Gm-Message-State: AOJu0Yy5JR1X2qNiNOcCElHxsMt9VfWuBdOgryeVlfF46XCp3W1wYyUh 6Rs+3Kn2W/migNsraTvQr83IuSjeJysdBA82eHjFUeME1XKCOWnJHE3+jQ== X-Google-Smtp-Source: AGHT+IGTsmEUgnwJ8NMQbiXx2GGFbIFBklB8L3EqadUCSo0k6EQyfC3LSPSkZOEDkXdfEcLj688etQ== X-Received: by 2002:a05:6830:6f01:b0:710:f74c:1b2d with SMTP id 46e09a7af769-7184b28856cmr8216836a34.2.1729796691212; Thu, 24 Oct 2024 12:04:51 -0700 (PDT) Received: from localhost.localdomain ([2601:282:4300:19e0::4437]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7182ebd5af8sm2233242a34.55.2024.10.24.12.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 12:04:50 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt To: openembedded-core@lists.openembedded.org Cc: Joshua Watt Subject: [OE-core][PATCH v3 4/4] lib: package: Copy locale license Date: Thu, 24 Oct 2024 13:03:10 -0600 Message-ID: <20241024190438.3630946-5-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241024190438.3630946-1-JPEWhacker@gmail.com> References: <20241023212013.995247-1-JPEWhacker@gmail.com> <20241024190438.3630946-1-JPEWhacker@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 24 Oct 2024 19:04:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206307 When creating split locales, copy the license from LICENSE:${PN}-locale if set, otherwise leave it unspecified (which will result in falling back to LICENSE) Signed-off-by: Joshua Watt --- meta/lib/oe/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 104b880b9e1..16359232ecd 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -663,6 +663,8 @@ def split_locales(d): except ValueError: locale_index = len(packages) + lic = d.getVar("LICENSE:" + pn + "-locale") + localepaths = [] locales = set() for localepath in (d.getVar('LOCALE_PATHS') or "").split(): @@ -698,6 +700,8 @@ def split_locales(d): d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln)) d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l)) d.setVar('DESCRIPTION:' + pkg, '%s This package contains language translation files for the %s locale.' % (description, l)) + if lic: + d.setVar('LICENSE:' + pkg, lic) if locale_section: d.setVar('SECTION:' + pkg, locale_section)