From: "Denys Dmytriyenko" <denis@denix.org>
To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>,
akuster808@gmail.com, richard.purdie@linuxfoundation.org
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCHv3 1/8] license.bbclass: Introduce AVAILABLE_LICENSES that lists all licenses
Date: Thu, 20 Aug 2020 18:35:03 -0400 [thread overview]
Message-ID: <20200820223503.GM17660@denix.org> (raw)
In-Reply-To: <20191211164820.26588-1-pkj@axis.com>
This actually fails yocto-check-layer script for Yocto compliance
checking, when a layer provides own licenses via LICENSE_PATH
(in layer.conf - LICENSE_PATH += "${LAYERDIR}/licenses"):
Variable AVAILABLE_LICENSES value changed:
...
Is there a new way to provide additional licenses from a layer or
should the yocto-check-layer script be modified to accomodate
(i.e. ignore) this change?
--
Denys
On Wed, Dec 11, 2019 at 05:48:13PM +0100, Peter Kjellerstedt wrote:
> Previously, there was SRC_DISTRIBUTE_LICENSES, an undocumented
> variable that contained a static list of licenses. It was used by
> expand_wildcard_licenses() to expand any wildcards used in, e.g.,
> INCOMPATIBLE_LICENSE. However, since this static list of licenses has
> not been kept up-to-date, many licenses were missing, with the result
> that if one tried to use any of those licenses with a wildcard, no
> licenses would be found, effectively ignoring that they should be
> marked as incompatible.
>
> This introduces a new (documented) variable, AVAILABLE_LICENSES, that
> is automatically updated to contain all licenses found in any
> directories specified by ${COMMON_LICENSE_DIR} and ${LICENSE_PATH},
> and uses it instead of SRC_DISTRIBUTE_LICENSES when expanding
> wildcards.
>
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>
> PATCHv2: Correct spelling of 'available'.
>
> meta/classes/license.bbclass | 27 ++++++++++++++++---
> meta/conf/documentation.conf | 1 +
> .../oeqa/selftest/cases/incompatible_lic.py | 6 ++---
> 3 files changed, 27 insertions(+), 7 deletions(-)
>
> diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
> index 648a4d7892..c388740003 100644
> --- a/meta/classes/license.bbclass
> +++ b/meta/classes/license.bbclass
> @@ -252,7 +252,7 @@ def canonical_license(d, license):
> """
> Return the canonical (SPDX) form of the license if available (so GPLv3
> becomes GPL-3.0), for the license named 'X+', return canonical form of
> - 'X' if availabel and the tailing '+' (so GPLv3+ becomes GPL-3.0+),
> + 'X' if available and the tailing '+' (so GPLv3+ becomes GPL-3.0+),
> or the passed license if there is no canonical form.
> """
> lic = d.getVarFlag('SPDXLICENSEMAP', license) or ""
> @@ -262,10 +262,29 @@ def canonical_license(d, license):
> lic += '+'
> return lic or license
>
> +def available_licenses(d):
> + """
> + Return the available licenses by searching the directories specified by
> + COMMON_LICENSE_DIR and LICENSE_PATH.
> + """
> + lic_dirs = ((d.getVar('COMMON_LICENSE_DIR') or '') + ' ' +
> + (d.getVar('LICENSE_PATH') or '')).split()
> +
> + licenses = []
> + for lic_dir in lic_dirs:
> + licenses += os.listdir(lic_dir)
> +
> + licenses = sorted(licenses)
> + return licenses
> +
> +# Only determine the list of all available licenses once. This assumes that any
> +# additions to LICENSE_PATH have been done before this file is parsed.
> +AVAILABLE_LICENSES := "${@' '.join(available_licenses(d))}"
> +
> def expand_wildcard_licenses(d, wildcard_licenses):
> """
> - Return actual spdx format license names if wildcard used. We expand
> - wildcards from SPDXLICENSEMAP flags and SRC_DISTRIBUTE_LICENSES values.
> + Return actual spdx format license names if wildcards are used. We expand
> + wildcards from SPDXLICENSEMAP flags and AVAILABLE_LICENSES.
> """
> import fnmatch
> licenses = wildcard_licenses[:]
> @@ -274,7 +293,7 @@ def expand_wildcard_licenses(d, wildcard_licenses):
> spdxflags = fnmatch.filter(spdxmapkeys, wld_lic)
> licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags]
>
> - spdx_lics = (d.getVar('SRC_DISTRIBUTE_LICENSES', False) or '').split()
> + spdx_lics = d.getVar('AVAILABLE_LICENSES').split()
> for wld_lic in wildcard_licenses:
> licenses += fnmatch.filter(spdx_lics, wld_lic)
>
> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> index fca36f3cf6..0b21d1f63e 100644
> --- a/meta/conf/documentation.conf
> +++ b/meta/conf/documentation.conf
> @@ -69,6 +69,7 @@ ASSUME_SHLIBS[doc] = "List of shlib:package[_version] mappings. Useful for lib p
> AUTHOR[doc] = "Email address used to contact the original author(s) in order to send patches and forward bugs."
> AUTO_SYSLINUXMENU[doc] = "Enables creating an automatic menu for the syslinux bootloader."
> AUTOREV[doc] = "When SRCREV is set to the value of this variable, it specifies to use the latest source revision in the repository."
> +AVAILABLE_LICENSES[doc] = "List of licenses found in the directories specified by COMMON_LICENSE_DIR and LICENSE_PATH."
>
> #B
>
> diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
> index 904b5b4094..ad878571b5 100644
> --- a/meta/lib/oeqa/selftest/cases/incompatible_lic.py
> +++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
> @@ -12,12 +12,12 @@ class IncompatibleLicenseTests(OESelftestTestCase):
> if error_msg not in result.output:
> raise AssertionError(result.output)
>
> - # Verify that a package with an SPDX license (from SRC_DISTRIBUTE_LICENSES)
> + # Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
> # cannot be built when INCOMPATIBLE_LICENSE contains this SPDX license
> def test_incompatible_spdx_license(self):
> self.lic_test('incompatible-license', 'GPL-3.0', 'GPL-3.0')
>
> - # Verify that a package with an SPDX license (from SRC_DISTRIBUTE_LICENSES)
> + # Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
> # cannot be built when INCOMPATIBLE_LICENSE contains an alias (in
> # SPDXLICENSEMAP) of this SPDX license
> def test_incompatible_alias_spdx_license(self):
> @@ -35,7 +35,7 @@ class IncompatibleLicenseTests(OESelftestTestCase):
> self.lic_test('incompatible-license-alias', 'GPLv3', 'GPLv3')
>
> # Verify that a package with a non-SPDX license (neither in
> - # SRC_DISTRIBUTE_LICENSES nor in SPDXLICENSEMAP) cannot be built when
> + # AVAILABLE_LICENSES nor in SPDXLICENSEMAP) cannot be built when
> # INCOMPATIBLE_LICENSE contains this license
> def test_incompatible_nonspdx_license(self):
> self.lic_test('incompatible-nonspdx-license', 'FooLicense', 'FooLicense')
> --
> 2.21.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
next prev parent reply other threads:[~2020-08-20 22:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 16:48 [PATCHv3 1/8] license.bbclass: Introduce AVAILABLE_LICENSES that lists all licenses Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 2/8] licenses.conf: Remove the SRC_DISTRIBUTE_LICENSES variable Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 3/8] license.bbclass: Make incompatible_pkg_license return incompatible lics Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 4/8] base.bbclass: Simplify the check for whitelisted licenses Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 5/8] base.bbclass: Report only the licenses that are incompatible for a package Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 6/8] package.bbclass: Report only the licenses that are incompatible Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 7/8] license_image.bbclass: " Peter Kjellerstedt
2019-12-11 16:48 ` [PATCHv3 8/8] incompatible_lic.py: Add tests for incompatible licenses with wildcards Peter Kjellerstedt
2020-08-20 22:35 ` Denys Dmytriyenko [this message]
2020-08-22 4:13 ` [OE-core] [PATCHv3 1/8] license.bbclass: Introduce AVAILABLE_LICENSES that lists all licenses Christopher Larson
2020-08-22 14:29 ` Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200820223503.GM17660@denix.org \
--to=denis@denix.org \
--cc=akuster808@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=peter.kjellerstedt@axis.com \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox