Commit Graph

65 Commits

Author SHA1 Message Date
Richard Purdie 8ebe7be3d9 bitbake.conf/package: Collapse PKGDATA_DIR into a single machine specific directory
Currently we have a hierarchy of pkgdata directories and the code has to put together
a search path and look through each in turn until it finds the data it needs.

This has lead to a number of hardcoded paths and file globing which
is unpredictable and undesirable. Worse, certain tricks that should be
easy like a GL specific package architecture become problematic with the
curretn search paths.

With the modern sstate code, we can do better and construct a single pkgdata
directory for each machine in just the same way as we do for the sysroot. This
is already tried and well tested. With such a single directory, all the code that
iterated through multiple pkgdata directories and simply be removed and give
a significant simplification of the code. Even existing build directories adapt
to the change well since the package contents doesn't change, just the location
they're installed to and the stamp for them.

The only complication is the we need a different shlibs directory for each
multilib. These are only used by package.bbclass and the simple fix is to
add MLPREFIX to the shlib directory name. This means the multilib packages will
repackage and the sstate checksum will change but an existing build directory
will adapt to the changes safely.

It is close to release however I believe the benefits this patch give us
are worth consideration for inclusion and give us more options for dealing
with problems like the GL one. It also sets the ground work well for
shlibs improvements in 1.6.

(From OE-Core rev: 1b8e4abd2d9c0901d38d89d0f944fe1ffd019379)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-14 08:21:00 +01:00
Richard Purdie 554c892ccf meta: Don't use deprecated bitbake API
These have been deprecated for a long time, convert the remaining
references to the correct modules and prepare for removal of the
compatibility support from bitbake.

(From OE-Core rev: 6a39835af2b2b3c7797fe05479341d71a3f3aaf6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-01 15:51:42 +01:00
Christopher Larson 8331d0ad41 license.bbclass: include all licenses in the manifest
When we don't have a generic license file for the license in question, we can
warn, but we should still include it in the manifest, otherwise the manifest
doesn't reflect reality. Failing to include a license listed in the recipe in
the manifest can't be allowed.

(From OE-Core rev: e87232828b761d56f1ce6a27e4009d350d68209c)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-11 15:56:00 +01:00
Paul Eggleton f32d58076e classes/license: remove outdated comment
Package listing was implemented in the deb backend some time ago.

(From OE-Core rev: e2915b6e1d2088d3a791bf629dabc58f38940961)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-10 09:23:18 +01:00
Martin Jansa da57e6bff8 license: fix LICENSE_CREATE_PACKAGE to stay disabled by default
* as reported by Enrico on #oe
  11:06:50 < ensc|w> JaMa: might this be caused by dc78ef91a2bf01efb8028c9afbe69e506e016265
  which checks for 'd.getVar('LICENSE_CREATE_PACKAGE', True)' evaluating to 'True' for every
  string (including the default 0)

(From OE-Core rev: bc42585ad9ca3a9891459ec3234893dff420b95b)

(From OE-Core rev: 0ab56ad52937823dc66b541dd4eda09fb6a34407)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-01 15:54:30 +00:00
Martin Jansa 15aa713482 license.bbclass: package license texts to PN-lic when LICENSE_CREATE_PACKAGE is enabled
[YOCTO #3743]

(From OE-Core rev: dc78ef91a2bf01efb8028c9afbe69e506e016265)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-28 12:29:29 +00:00
Martin Jansa 2daab0b3a2 license.bbclass: extract functionality to find license files to separate function
* move it from do_populate_lic to find_license_files so we can reuse it
  to populate license in package itself

[YOCTO #3743]

(From OE-Core rev: 833f8c239aa475b3e0cacbd448a90079ac287468)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-28 12:29:29 +00:00
Christopher Larson cea9f48ea8 license.bbclass: cleanly handle invalid licenses in incompatible_license
This gives us an error message (bb.fatal) rather than a traceback due to the
uncaught LicenseError.

(From OE-Core rev: 7fab4cd27a2ad896218123ca82252e2b59526726)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-18 13:28:05 +00:00
Christopher Larson 8491c2a522 license: correct re.search/fnmatch indentation
This was causing it to only obey the last of the elements in
INCOMPATIBLE_LICENSE.

(From OE-Core rev: df4a4b9792e3bd13b396b94e232c69054fdf19b5)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-18 13:28:05 +00:00
Christopher Larson feca9f7849 license.bbclass: check LICENSE_pkg, not LICENSE_pn-pkg
Recipes define the latter, as that's what goes into the binary packages, not
the former.

(From OE-Core rev: 6a59b294b99b05e8973b5f2d60678988e90e2de3)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-18 13:28:05 +00:00
Andy Ross ec17940f72 base/license.bbclass: handle multiple INCOMPATIBLE_LICENSEs
Allow INCOMPATIBLE_LICENSE to be a whitespace-separated list of
incompatible license strings and/or glob patterns.

Also fix wildcarding: the string in INCOMPATIBLE_LICENSE was clearly
intended to match with wildcards (e.g. "*GPLv3" to match both GPLv3
and LGPLv3), but this was broken because of a bug in return_spdx()
which would die with a runtime error when there was no SPDXLICENSEMAP
entry for the string.

(From OE-Core rev: 8a8d00f4c9f7fe5f9f173b43b86cd18a6c75435c)

Signed-off-by: Andy Ross <andy.ross@windriver.com>
Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-11 15:54:36 +00:00
Elizabeth Flanagan f42e0ae8d7 license.bbclass: Including locale packages
As locale packages are installed on the image, we should
be including them in the package/license manifest.

This ensures that the manifests are accurate and complete.

[ YOCTO #2461 ]

(From OE-Core rev: 4578b708ada1ffb99ab542da793977ffb90a9b50)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-07 16:13:46 +00:00
Mark Hatle dde5e6402a license.bbclass: Avoid grep error message
Touch a file that is later greped to make sure it exists.

(From OE-Core rev: a17bf5d840b5777918f324d26e085498dec86b76)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-06 12:31:08 +00:00
Flanagan, Elizabeth 6944a3bd58 license.bbclass: Collect LICENSE level packages
Some bad logic in license.bbclass misses certain package level
LICENSEs.

(From OE-Core rev: c5a171d5817233c0371e6f5b19f57f3c4b84f5ac)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-25 21:36:42 +00:00
Richard Purdie c6c0809aa6 license: We need to run this task before do_build, there is no dependency on do_package
This change means we have more flexibility about when to schedule the license
task and if it changes, we don't repackage everything (which is pointless).

(From OE-Core rev: ee1293446936c5444ece42b60e3ab94189b2fbc3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-20 15:31:50 +00:00
Elizabeth Flanagan ad1aa810ac license.conf/bbclass: Move globals to license.conf
This requires the changes to bitbake.conf that allow parsing of
license.conf.

As we should now be parsing license.conf, we can move some globals
out of license.bblcass and into the conf file.

(From OE-Core rev: 03e6a7cd27ed109a011fac09cf04412f87f31c3a)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-28 11:07:42 +01:00
Elizabeth Flanagan 4f82c4eaf7 license.bbclass: Variable standardization
The variable mentioned in license.conf is LICENSE_PATH. The variable
used in license.bbclass is LICENSE_DIR. Conforming to what is in
license.conf

(From OE-Core rev: c6e13d9cd26d016ab06e7447b307d413e1331aa0)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-28 11:07:41 +01:00
Andrei Gherzan 42d91a7db4 Replace "echo -e" with "printf" to have the same behavior in dash or bash
oe-core removed the prerequisite to have sh as bash. POSIX doesn't define
any options and furthermore allows 'echo -e' to be the default behavior.
This means that in dash 'echo -e' will actually print '-e' and interpret
backslashes by default. We use instead 'printf' builtin command with or
without '\n' to simulate 'echo -e' or 'echo -n'.
'printf' needs format while 'echo' can be used without any arguments. So
'echo >' was replaced by 'printf "" >'.
'echo' without '-n' flag adds a new line by default so to keep the same
behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is
used.

[YOCTO #3138]

(From OE-Core rev: a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-20 13:33:50 +01:00
Vladimir Zapolskiy a3c257a136 classes/license: place all found licenses on one line
Cosmetic change, settle all found licenses into one line and report warning
about missing licenses loudly.

(From OE-Core rev: f015a9eb8265c485da0b20009ba72119035599b1)

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:43 +01:00
Vladimir Zapolskiy 2ebe4d4cfb classes/license: correct license info in lisense.manifest
Trivial change, do not cut off plus symbol from license name, otherwise
information about package license is corrupted.

(From OE-Core rev: ba53de38e96833ea82ddd0f1e336cd7ddfa0c2d1)

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:43 +01:00
Vladimir Zapolskiy 043df837a5 classes/license: account LICENSE_${pkg} values in manifest
Trivial change, process LICENSE_${pkg} and LICENSE values. This fixes multiple
cases, when license is not specified at all in license.manifest

(From OE-Core rev: 8fd734e6f9159921d0d148c4d5c0fa37c882b21a)

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:43 +01:00
Vladimir Zapolskiy ed4836d319 classes/license: remove redundant nested if statements
Cosmetic change, which improves code perception. Also check for locale
packages firstly, this shall improve performance a little.

(From OE-Core rev: 100e457de4b223defb1a844d3b85af812caf2f79)

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:42 +01:00
Vladimir Zapolskiy 5dce00ff49 classes/license: check license manifest for double records
Trivial typo bugfix, avoid multiple records in license.manifest.

(From OE-Core rev: 0d3ca97d3a349ca572fce798ebf9de59a438c0c8)

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:42 +01:00
Vladimir Zapolskiy dd1ee2ab1e classes/license: define LICENSE_MANIFEST variable
Cosmetic change, saves space and reduces code line length.

(From OE-Core rev: 0ac50f848cf0f897333cff9340976519fc95fdc4)

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:42 +01:00
Florin Sarbu 1356f8fefd Add MPL version 2.0 license in common-licenses dir as well as adding a non-SPDX license name in license.bbclass
(From OE-Core rev: 89efdb7c561e5af87da446c7767d3ad5809a7d13)

Signed-off-by: Florin Sarbu <florin.sarbu@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-17 18:04:21 +01:00
Andrei Gherzan 5334a93d26 package.bbclass: Create symlinks for packages with different packaged name
While generating license.manifest package information is searched in:
filename=`ls ${TMPDIR}/pkgdata/*/runtime/${pkg}| head -1`
This is ok as long as package name is the same as the package name
after packaging.
For example dbus is packaged as dbus-1. So, searching
ls ${TMPDIR}/pkgdata/*/runtime/dbus-1 will fail because there is no file
with this package name.

Create a symlink to the pkgdata file in a runtime-reverse directory so
that these reverse lookups are possible.

Fixes [YOCTO #2638].

(From OE-Core rev: 76ef414b8a017557cf5f3ad7b3ca8a324f7aad29)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-26 14:40:47 +01:00
Richard Purdie 73cf0335c4 Remove a number of unneeded import os/bb calls
The bb and os modules are always imported so having these extra import calls
are a waste of space/execution time. They also set a bad example for people
copy and pasting code so clean them up.

(From OE-Core rev: 7d674820958be3a7051ea619effe1a6061d9cbe2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-19 12:24:50 +01:00
Richard Purdie bfd279de32 Convert tab indentation in python functions into four-space
(From OE-Core rev: 604d46c686d06d62d5a07b9c7f4fa170f99307d8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-19 10:24:50 +01:00
Paul Eggleton 2fefa9c335 classes/license: fix manifest to work with deb
Prepend the license manifest creation call to ROOTFS_POSTPROCESS_COMMAND
instead of appending to ROOTFS_POSTINSTALL_COMMAND. The latter is not
implemented for the deb backend (and probably ought to just be removed
completely), and by using _prepend we can still ensure it occurs before
package info is removed (and before buildhistory in case it is needed
there in future).

(From OE-Core rev: 56fafe083fdb63f156a081344fb1d836e3182bf0)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 16:58:58 +01:00
Elizabeth Flanagan 885e1f7e68 license.bbclass: optimize pkg runtime data
This fixes an ugly way I was trying to find pkg runtime
data for package and license manifest creation.

rootfs generation times for core-image-minimal:

Prior to patch
real	0m41.570s
user	1m40.466s
sys	0m6.768s

With patch
real	0m27.527s
user	0m9.833s
sys	0m3.496s

(From OE-Core rev: 664bbf3207c229eef5ef94a08713a652f33a8466)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>

Conflicts:

	meta/classes/license.bbclass
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-05 23:04:59 +01:00
Elizabeth Flanagan f25a6c09da license.bbclass: Adding PV to package.manifest
Per request, adding the package version to the package manifest
file.

(From OE-Core rev: bf216369f3131ad38c0b2b92620e4805ca9eecb9)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-05 23:04:59 +01:00
Andrei Gherzan 1dc560c9d2 license.bbclass: Check if copyfile succeeded with isfile
A cleaner way to check if copyfile suceeded is to use os.path.isfile.
In this way we can omit warns in some python versions where copyfile
return the same non-0 value even is this action is successfull.

(From OE-Core rev: fa51fe19a1dc1ddc4c9ec879a782953fd6a15117)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-04 17:17:51 +01:00
Eric Bénard 3774cf0fdc license.bbclass: remove existing license.manifest before appending new data
without this fix, we append license each time we build again the same image,
ending with a large not up to date file.

(From OE-Core rev: 2d49a8f659694b60cdb706e8993cd9550e2002bd)

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-29 16:50:06 +01:00
Elizabeth Flanagan 7fdf6b522f license.bbclass: Style guide compliance
4 spaces. Correcting some bash whitespace in license to comply
with the style guide.

(From OE-Core rev: 0945bf7871fd33df3587cdfb1290b028d7843915)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-25 12:23:38 +01:00
Elizabeth Flanagan bdf2d94c35 INCOMPATIBLE_LICENSE: support for spdx and pkg licenses
This adds a few things to the incompatible license functionality

1. INCOMPATIBLE_LICENSE was unable to distinguish any variation
within LICENSE (e.g. GPLv3 v. GPLv3.0). This now utilizes the
SPDXLICENSEMAP of the license indicated as INCOMPATIBLE_LICENSE

2. Given a recipe where the main LICENSE was incompatible but
a package of the recipe was compatible, the entire recipe would
be excluded. This allows us some finer grained control over what
exactly gets excluded.

(From OE-Core rev: a8d7246f7b13ef2636c325263c8bfa22552d7a57)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-25 12:23:38 +01:00
Elizabeth Flanagan a3da6c381f license.bbclass: Whitespace standardization
Removing tabs within check_license_flags to standardize to
4 space tabbing

(From OE-Core rev: 178be339e09078c56a5231a10551f3b9aed16f9c)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-25 12:23:38 +01:00
Elizabeth Flanagan 5de2b70afc license.bbclass: Add spdx mapping to GPL-1.0
Perl is GPL-1.0. For consistency sake, adding an spdx map for
GPLv1

(From OE-Core rev: 2bc1d04e62a8c84e3195d538f844e90c32df8acc)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-25 12:23:37 +01:00
Robert P. J. Day 9e3c79cfe8 Fix common typoes "existant", "dependant" and variations
Fix a couple common typoes, all contained within comments so there
should be no effect on functionality.

(From OE-Core rev: dc52c3cbf3a7b7242d53019f7643495eb40c0566)

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-22 16:47:06 +00:00
Richard Purdie e25a02eb2b license.bbclass: Add mapping for LGPLv2.0, pango uses it
(From OE-Core rev: 3b9256140bde09f8319a96bc8cbe15288ff5899b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-13 11:45:06 +00:00
Richard Purdie 06f2f8ce0a meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)
Using "1" with getVar is bad coding style and "True" is preferred.
This patch is a sed over the meta directory of the form:

sed \
 -e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \
 -e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \
 -i `grep -ril getVar *`

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-05 10:22:56 -08:00
Elizabeth Flanagan d7cef163e4 license.bbclass: Symbolic links of generic license
This is to reduce the size of licenses added to images. With this
commit license.manifest, original license and generic license
adds about .5M to a core-image-minimal image, substantially less
than what is currently occuring when COPY_LIC_MANIFEST and
COPY_LIC_DIRS are set.

(From OE-Core rev: 2c753a714c1ee2b7c6479836f47aeec182ca3670)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-24 23:25:52 +00:00
Elizabeth Flanagan 5272e883ff license.bbclass: Gather Pkg level licenses
We should look for LICENSE at a package level first. If it's
not found, we should use the recipe level LICENSE. This adds a
bit more granularity to license manifests where needed.

(From OE-Core rev: d50dd280f52587b6225bc5db3c9e85f78107f5f5)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-24 23:25:52 +00:00
Tom Zanussi b68ea54360 license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.

In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image.  To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list.  This mechanism relies on a global list defined in
default-distrovars.inc.

The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist.  Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.

The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific.  We then
try to match that string against the whitelist.  So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.

However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'

This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific.  So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).

Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist).  For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.

The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".

That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:

 # This is a list of packages that require a commercial license to ship
 # product. If shipped as part of an image these packages may have
 # implications so they are disabled by default.  To enable them,
 # un-comment the below as appropriate.
 #LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
 #                           commercial_gst-openmax \
 #                           commercial_gst-plugins-ugly \
 #                           commercial_lame \
 #                           commercial_libmad \
 #                           commercial_libomxil \
 #                           commercial_mpeg2dec \
 #                           commercial_qmmp"

The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist.  To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".

(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)

Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-24 11:54:15 +00:00
Andrei Gherzan 4005c3ff5e license.bbclass base.bbclass: support for 'or' operand in LICENSE and for SPDX license names
A new function was defined in license.bbclass in order to correctly exclude packages where OE-Style licence naming
is used. In this way licenses as GPL-3, GPLv3, GPLv3.0 etc will be excluded from a non-GPLv3 build. This function
takes into consideration if 'or' operand is used.
The function defined in license.bbclass is called in base.bbclass where packages are excluded based on
INCOMPATIBLE_LICENSE variable.

[YOCTO #1884]
[YOCTO #1844]

(From OE-Core rev: 28456593be0b7e15bb51595d547d7e5347cce24b)

Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 17:40:44 +00:00
Beth Flanagan 2ee3156284 license: Fix manifest conditional
The manifest conditionals COPY_LIC_MANIFEST and COPY_LIC_DIRS
were returning true due to missing quotes in the bash test. This
made images larger than expected.

(From OE-Core rev: dc751b9c637db0d442ef553f0b0568cb493f3cd3)

Signed-off-by: Beth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-21 17:16:29 +00:00
Elizabeth Flanagan ee2af267b7 license.bbclass: remove bashism
Removing a bashism that was dumping errors into rootfs log.

(From OE-Core rev: 3e05acab1c119a3b2a4703ea8729cc768935d36e)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-16 16:50:46 +00:00
Elizabeth Flanagan bd75266ab3 license: PR bump failure
This addtask for do_populate_lic should be reverted back
to before do_package as before do_compile causes failures
when recipes are updated.

[YOCTO #1819]

(From OE-Core rev: 513c620815fcf8e7bcc9ac38a916850ad6173a16)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-12 21:50:20 +00:00
Elizabeth Flanagan 924b1e47ab license/copyleft: exception for ast parse
As the standard for LICENSE format is not well defined, we
may well run into issues where LICENSE cannot be parsed via
ast. In cases like this, we need to warn and continue.

(From OE-Core rev: 07f94fa1d661d38b775ce2d99b84e5610c369392)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-10 00:18:15 +00:00
Elizabeth Flanagan 45f6a21065 license.bbclass: remove deb exclusion
This commit requires 4a13766c7b223d as it removes the exclusion
of deb package types from license manifest creation.

(From OE-Core rev: 5328587ecaa14a54ad7bced6f7ead218471dbf86)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-10 00:18:15 +00:00
Elizabeth Flanagan 50195e4af1 license.bbclass: remove bashism.
bashism in create_license_manifest removed.

(From OE-Core rev: 035a569d5241be9a217dbdbd6650ee04c4c4d67f)

Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-10 00:18:14 +00:00