Re: [oe] INCOMPATIBLE_LICENSES and WHITELIST_<license> usage
Warning: wall of text ahead. Sorry about that, but I believe it istoggle quoted messageShow quoted text
important that we get this right if we are redesigning it.
TL;DR: see the end for the new suggested licensing variables.
-----Original Message-----You do not really need the license here (more than possibly as
information to anyone reading the code). Specifying that a package is
allowed in an image regardless of its licenses can just as well be
done by allowing the variable to take a list of packages:
INCOMPATIBLE_LICENSE_EXCEPTIONS:pn-core-image-minimal = "bash readline"
An alternative (and in my opinion better) variable name would be:
IMAGE_ALLOW_PACKAGES:pn-core-image-minimal = "bash readline"
focusing on that this is a list of _packages_ allowed for a given
_image_. This does not explicitly mention licenses, but I do not
believe that is needed. After all there could be multiple reasons a
package is not allowed in an image and this variable would allow to
ignore them all because that is typically what you want to do:
specify that you really want that package in that image. I guess
this is in some sense the opposite of PACKAGE_EXCLUDE. And I guess
like :append vs :remove, if someone for some reason specifies a
package in both IMAGE_ALLOW_PACKAGES and PACKAGE_EXCLUDE, then the
later should win (to err on the side of caution).
For the case where you want to allow a recipe to be built despite
it using licenses that are otherwise not allowed you can simply use
INCOMPATIBLE_LICENSE:pn-foo = ""
and don't really need a separate variable for it.
which matches the current functionality, removes the issue that the nameSince I was the one to introduce it, I will answer to that. It was
introduced so that it is possible to specify compatible licenses
instead of incompatible licenses by basically calculating the
incompatible licenses by taking the set of available licenses minus
the set of compatible licenses. If a mechanism to do that is
introduced, e.g., by adding support for a COMPATIBLE_LICENSES in
addition to INCOMPATIBLE_LICENSE, then I am of the opinion that we
can remove AVAILABLE_LICENSES again.
We also need this mechanism in the code for handling allowed vs
disallowed licenses because the current code really cannot handled a
list of many hundreds of incompatible licenses, which is what we got
after all SPDX licenses were added to OE-Core. The code is extremely
inefficient and evaluates the list of incompatible licenses over and
over again. In our case that meant the recipe parsing time tripled.
Cheers,That said, we really need two sets of variables. One for blocking
the building of recipes because of its license(s), and one for
preventing packages with disallowed licenses to be included in a
given image. These are very different use cases and they take
totally different lists of items (recipes vs packages). The current
mess where the same variables are used for both cases needs to be
So why do we need both cases? The first case where recipes are
prevented from being built makes it possible to, e.g., prevent a
newer versioned recipe that uses GPL-3.0-or-later to be built and
instead build an older version that uses GPL-2.0-or-later (i.e.,
what meta-gplv2 can be used for today).
The second case allows to build code that uses disallowed licenses,
as long as the packages are not added to the image. Why is this
useful? Because many recipes are built for some packages that are
never used in the given image, and it is then much easier to allow
them to be built as long as their output is not used. E.g., very
many recipes depend on bash which is GPL-3.0-or-later, making it
near impossible to avoid having to build it. However, it is
perfectly possible to build production images that do not need bash
to be installed.
I believe for this second case we should have two variables,
IMAGE_COMPATIBLE_LICENSES and IMAGE_INCOMPATIBLE_LICENSES. And to
make the naming clear for the first case, I would suggest calling
those variables RECIPE_COMPATIBLE_LICENSES and
Also note that the use of RECIPE_COMPATIBLE_LICENSES and
RECIPE_INCOMPATIBLE_LICENSES is mutually exclusive, as is the use
of IMAGE_COMPATIBLE_LICENSES and IMAGE_INCOMPATIBLE_LICENSES. I.e.,
you will have to choose whether to specify what licenses to allow
or what licenses to disallow. You cannot do both. This is because
specifying a list of compatible licenses means that all other
licenses are by definition incompatible, and vice versa. However,
this also means that it makes perfect sense to be able to, e.g.,
specify a few RECIPE_INCOMPATIBLE_LICENSES together with a list of
Oh, and another thing I would like to take the opportunity to raise
is whether we should continue to support patterns in these list, or
if we should change it so that the lists of licenses need to
explicitly specify all licenses. The latter would greatly simplify
the code, especially when combined with only allowing SPDX names.
If we decide to remove support for patterns, and based on the
assumption that the pattern is typically used to specify "*GPL-3.0*",
we could make available a variable or two that contain the typical
sets of GPL licenses. This would also allow us to remove the code
that handles how an or-later licenses specified as '<license>+'
should be treated in combination with patterns.
So, to reiterate, these are the variables that I suggest we adopt
to be able to handle the various use cases regarding licenses:
RECIPE_COMPATIBLE_LICENSES - list of compatible licenses for
RECIPE_INCOMPATIBLE_LICENSES - list of incompatible licenses for
IMAGE_COMPATIBLE_LICENSES - list of compatible licenses for
packages in images
IMAGE_INCOMPATIBLE_LICENSES - list of incompatible licenses for
packages in images
IMAGE_ALLOW_PACKAGES - list of packages allowed in the
image regardless of licenses and
This also means that the old WHITELIST_*, INCOMPATIBLE_LICENSE
and AVAILABLE_LICENSES variables are removed. I also suggest we
remove the support for patterns in the new variables.