summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2018-11-07 08:51:56 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-13 15:18:28 +0000
commitb71cd1ec45e247db688b784697829c1b485ca9ca (patch)
tree434a94a1303a4378c2ac298b99a405ddfb764268 /meta
parentcbc9b743a711f07c04cf9f5b2fc3f83da6d28913 (diff)
downloadopenembedded-core-b71cd1ec45e247db688b784697829c1b485ca9ca.tar.gz
base.bbclass: Display name of licenses which caused SkipRecipe
Display the name of the restricted licenses which caused the recipe to be skipped. This makes it easy to determine which license or licenses are missing and need to be checked and whitelisted. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/base.bbclass15
-rw-r--r--meta/classes/license.bbclass19
2 files changed, 19 insertions, 15 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index bc9b236b84..e715ffa1b2 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -467,12 +467,15 @@ python () {
if bb.data.inherits_class('license', d):
check_license_format(d)
- unmatched_license_flag = check_license_flags(d)
- if unmatched_license_flag:
- bb.debug(1, "Skipping %s because it has a restricted license not"
- " whitelisted in LICENSE_FLAGS_WHITELIST" % pn)
- raise bb.parse.SkipRecipe("because it has a restricted license not"
- " whitelisted in LICENSE_FLAGS_WHITELIST")
+ unmatched_license_flags = check_license_flags(d)
+ if unmatched_license_flags:
+ if len(unmatched_license_flags) == 1:
+ message = "because it has a restricted license '{0}'. Which is not whitelisted in LICENSE_FLAGS_WHITELIST".format(unmatched_license_flags[0])
+ else:
+ message = "because it has restricted licenses {0}. Which are not whitelisted in LICENSE_FLAGS_WHITELIST".format(
+ ", ".join("'{0}'".format(f) for f in unmatched_license_flags))
+ bb.debug(1, "Skipping %s %s" % (pn, message))
+ raise bb.parse.SkipRecipe(message)
# If we're building a target package we need to use fakeroot (pseudo)
# in order to capture permissions, owners, groups and special files
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 4cf7f074fc..0e5675c500 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -316,8 +316,8 @@ def check_license_flags(d):
This function checks if a recipe has any LICENSE_FLAGS that
aren't whitelisted.
- If it does, it returns the first LICENSE_FLAGS item missing from the
- whitelist, or all of the LICENSE_FLAGS if there is no whitelist.
+ If it does, it returns the all LICENSE_FLAGS missing from the whitelist, or
+ all of the LICENSE_FLAGS if there is no whitelist.
If everything is is properly whitelisted, it returns None.
"""
@@ -354,22 +354,23 @@ def check_license_flags(d):
return False
def all_license_flags_match(license_flags, whitelist):
- """ Return first unmatched flag, None if all flags match """
+ """ Return all unmatched flags, None if all flags match """
pn = d.getVar('PN')
split_whitelist = whitelist.split()
+ flags = []
for flag in license_flags.split():
if not license_flag_matches(flag, split_whitelist, pn):
- return flag
- return None
+ flags.append(flag)
+ return flags if flags else None
license_flags = d.getVar('LICENSE_FLAGS')
if license_flags:
whitelist = d.getVar('LICENSE_FLAGS_WHITELIST')
if not whitelist:
- return license_flags
- unmatched_flag = all_license_flags_match(license_flags, whitelist)
- if unmatched_flag:
- return unmatched_flag
+ return license_flags.split()
+ unmatched_flags = all_license_flags_match(license_flags, whitelist)
+ if unmatched_flags:
+ return unmatched_flags
return None
def check_license_format(d):