ref-manual: Add a tips on how to achieve whitelisting of licenses

It is sometimes more appropriate to define the licenses that are
allowed to be used rather than the ones that are not permitted. This
adds a tips on how this can be achieved by using AVAILABLE_LICENSES
and some Python set arithmetics.

(From yocto-docs rev: dd26d8a9f89402a9828bf02f2e65054d4c0f406f)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Kjellerstedt 2020-02-20 21:27:33 +01:00 committed by Richard Purdie
parent cc26e90a79
commit 0daf901b5b

View File

@ -6774,6 +6774,25 @@
components that are required to produce a functional system
image.
</note>
<note><title>Tips</title>
It is possible to define a list of licenses that are allowed
to be used instead of the licenses that are excluded. To do
this, define a
variable <filename>COMPATIBLE_LICENSES</filename> with the
names of the licences that are allowed. Then
define <filename>INCOMPATIBLE_LICENSE</filename> as:
<literallayout class='monospaced'>
INCOMPATIBLE_LICENSE = "${@' '.join(sorted(set(d.getVar('AVAILABLE_LICENSES').split()) - set(d.getVar('COMPATIBLE_LICENSES').split())))}"
</literallayout>
This will result
in <filename>INCOMPATIBLE_LICENSE</filename> containing the
names of all licences
from <link linkend='var-AVAILABLE_LICENSES'><filename>AVAILABLE_LICENSES</filename></link>
except the ones specified
in <filename>COMPATIBLE_LICENSES</filename>, thus only
allowing the latter licences to be used.
</note>
</glossdef>
</glossentry>