From patchwork Mon Jan 2 19:29:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/5] base.bbclass: add support for LICENSE_FLAGS Date: Mon, 02 Jan 2012 19:29:24 -0000 From: Tom Zanussi X-Patchwork-Id: 17951 Message-Id: <6f382ab47a126d96637ba3581f11bf1f2093b5a0.1325526807.git.tom.zanussi@intel.com> To: openembedded-core@lists.openembedded.org, sgw@linux.intel.com From: Tom Zanussi LICENSE_FLAGS are a per-recipe replacement for COMMERCIAL_FLAGS. Any flags listed in a recipe's LICENSE_FLAGS variable must have a match in the global LICENSE_FLAGS_WHITELIST variable. Signed-off-by: Tom Zanussi --- meta/classes/base.bbclass | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index fbcaefb..9132ed4 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -350,6 +350,25 @@ python () { if license == "INVALID": bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn) + def skip_package(pn, flag): + bb.debug(1, "Skipping %s because it has a restricted license (%s) not" + " whitelisted in LICENSE_FLAGS_WHITELIST" % (pn, flag)) + raise bb.parse.SkipPackage("because it may require a special license" + " to ship in a product (listed in LICENSE_FLAGS)") + + def all_license_flags_match(flags, whitelist): + for flag in flags.split(): + if not flag in whitelist.split(): + return False + return True + + license_flags = d.getVar('LICENSE_FLAGS', True) + if license_flags: + license_flags_whitelist = d.getVar('LICENSE_FLAGS_WHITELIST', True) + if not license_flags_whitelist or not all_license_flags_match( + license_flags, license_flags_whitelist): + skip_package(pn, license_flags) + commercial_license = " %s " % d.getVar('COMMERCIAL_LICENSE', 1) import re pnr = "[ \t]%s[ \t]" % pn.replace('+', "\+")