diff options
author | Quentin Schulz <quentin.schulz@streamunlimited.com> | 2019-06-11 10:11:46 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-11 13:26:55 +0100 |
commit | 4b6ce4604cc15e289a48f8586d58a101b7a70b52 (patch) | |
tree | 8c1c40ada88ff44056a25758a41a74c0dd2e8605 /meta/classes/license_image.bbclass | |
parent | 97feebdf99024489113634d1cada36eb9b84e9c6 (diff) | |
download | poky-4b6ce4604cc15e289a48f8586d58a101b7a70b52.tar.gz |
meta: license: fix non-SPDX license being removed from INCOMPATIBLE_LICENSE
A non-SPDX license (which is not an alias to an SPDX license) cannot
currently be marked as incompatible in INCOMPATIBLE_LICENSE.
In the current state, we take all INCOMPATIBLE_LICENSE and pass them
through expand_wildcard_licenses which is only adding SPDX licenses that
match the glob regexp of what is in INCOMPATIBLE_LICENSE (be it a direct
match to an SPDX license or via an alias).
This does not work well with custom licenses.
E.g.:
foo.bb:
LICENSE = "FooLicense"
conf/local.conf:
INCOMPATIBLE_LICENSE = "FooLicense"
`bitbake foo`
Gives no warning, no error, builds and packages successfully, because
INCOMPATIBLE_LICENSE is basically empty since FooLicense is neither in
SPDXLICENSEMAP nor in SRC_DISTRIBUTE_LICENSES.
Let's add the original licenses to the list returned by
expand_wildcard_licenses to be able to handle the aforementioned case.
INCOMPATIBLE_LICENSE = "FooLicense GPLv2 GPLv3+" used to "resolve" to
"GPLv2 GPLv3". It now resolves to "FooLicense GPLv2 GPLv3 GPLv3+" which
fixes the issue with custom licenses not being in SPDXLICENSEMAP or
SRC_DISTRIBUTE_LICENSES and thus being left out of the blacklisted
licenses.
I needed to pass a list to expand_wildcard_licenses from the
license_image class instead of the current output of map() because the
operator [:] does not work on this kind of type, and list(map()) or
anything that iterates over map() actually moves the iterator and breaks
the forloop right after in expand_wildcard_licenses.
(From OE-Core rev: 2d976587d703462db2b7b78661b05ac22fb93787)
Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license_image.bbclass')
-rw-r--r-- | meta/classes/license_image.bbclass | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass index 6fb76be48e..2cfda81c99 100644 --- a/meta/classes/license_image.bbclass +++ b/meta/classes/license_image.bbclass | |||
@@ -40,7 +40,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
40 | import stat | 40 | import stat |
41 | 41 | ||
42 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() | 42 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() |
43 | bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) | 43 | bad_licenses = [canonical_license(d, l) for l in bad_licenses] |
44 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | 44 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) |
45 | 45 | ||
46 | with open(license_manifest, "w") as license_file: | 46 | with open(license_manifest, "w") as license_file: |