[OE-core] [PATCH] base.bbclass: support for or operand in LICENSE and for SPDX license names
Flanagan, Elizabeth
elizabeth.flanagan at intel.com
Mon Jan 9 21:12:04 UTC 2012
On Mon, Jan 9, 2012 at 7:43 AM, Andrei Gherzan <andrei at gherzan.ro> wrote:
> From: Andrei Gherzan <andrei.gherzan at windriver.com>
>
> base.bblass modfied in order to correctly exlude packages where OE-Style licence naming
> is used. In this way licenses as GPL-3, GPLv3, GPLv3.0 will be exluded from a non-GPLv3
> build.
> The second modification was to include in a non-GPLv3 build packages where LICENSE is
> GPLv3 or "something else". For example, qt4-embedded has LICENSE = "LGPLv2.1 | GPLv3".
> This package should be included in a non-GPLv3 build as it is LGPLv2.1 or GPLv3.
>
> [YOCTO #1884]
> [YOCTO #1844]
>
> Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
> ---
> meta/classes/base.bbclass | 22 ++++++++++++++++++----
> 1 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index e65a722..568c5dd 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -392,6 +392,8 @@ python () {
>
>
> dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', 1)
> + spdx_dont_want_license = d.getVarFlag('SPDXLICENSEMAP', dont_want_license)
> +
> if dont_want_license and not pn.endswith("-native") and not pn.endswith("-cross") and not pn.endswith("-cross-initial") and not pn.endswith("-cross-intermediate") and not pn.endswith("-crosssdk-intermediate") and not pn.endswith("-crosssdk") and not pn.endswith("-crosssdk-initial"):
> hosttools_whitelist = (d.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, 1) or "").split()
> lgplv2_whitelist = (d.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, 1) or "").split()
> @@ -400,10 +402,22 @@ python () {
>
> import re
> this_license = d.getVar('LICENSE', 1)
> - if this_license and re.search(dont_want_license, this_license):
> - bb.note("SKIPPING %s because it's %s" % (pn, this_license))
> - raise bb.parse.SkipPackage("incompatible with license %s" % this_license)
> -
> + this_license_clean=re.sub(r'[+&()*]', '', this_license)
> + or_licenses = re.split('[|]', this_license_clean)
> +
> + for one_or_license in or_licenses:
> + licenses = re.split('[ ]', one_or_license)
> + good_license=one_or_license
> + for onelicense in licenses:
A few notes:
I would use the oe.license here
Have a look at meta/classes/copyleft_compliance.bbclass and
license.bbclass to see how we're doing this.
> + spdx_onelicense = d.getVarFlag('SPDXLICENSEMAP', onelicense)
> + if ( onelicense and re.search(dont_want_license, onelicense) ) or ( onelicense and re.search(spdx_dont_want_license, onelicense) ) or ( spdx_onelicense and re.search(dont_want_license, spdx_onelicense) ) or ( spdx_onelicense and re.search(spdx_dont_want_license, spdx_onelicense) ):
> + good_license = ""
> + break
> + if good_license != "":
> + break
> + if good_license == "":
> + bb.note("SKIPPING %s because it's %s" % (pn, this_license))
> + raise bb.parse.SkipPackage("incompatible with license %s" % this_license)
> srcuri = d.getVar('SRC_URI', 1)
> # Svn packages should DEPEND on subversion-native
> if "svn://" in srcuri:
> --
> 1.7.5.4
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
I would also look at pulling this into license.bbclass as a generic
function as I can see a few anticipated uses for it.
--
Elizabeth Flanagan
Yocto Project
Build and Release
More information about the Openembedded-core
mailing list