summaryrefslogtreecommitdiffstats
path: root/meta/classes
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-14 11:14:39 +0000
commit97c9fb7ba0735e1c4c6ae95c3150ddfd1788f1de (patch)
tree0aa9cba21dbf2afe1b23b5b524baa033ab641f0c /meta/classes
parentc77d38acd63bc3b91ce0616c9595fc9a914906ba (diff)
downloadpoky-97c9fb7ba0735e1c4c6ae95c3150ddfd1788f1de.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. (From OE-Core rev: b71cd1ec45e247db688b784697829c1b485ca9ca) Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 () {
467 467
468 if bb.data.inherits_class('license', d): 468 if bb.data.inherits_class('license', d):
469 check_license_format(d) 469 check_license_format(d)
470 unmatched_license_flag = check_license_flags(d) 470 unmatched_license_flags = check_license_flags(d)
471 if unmatched_license_flag: 471 if unmatched_license_flags:
472 bb.debug(1, "Skipping %s because it has a restricted license not" 472 if len(unmatched_license_flags) == 1:
473 " whitelisted in LICENSE_FLAGS_WHITELIST" % pn) 473 message = "because it has a restricted license '{0}'. Which is not whitelisted in LICENSE_FLAGS_WHITELIST".format(unmatched_license_flags[0])
474 raise bb.parse.SkipRecipe("because it has a restricted license not" 474 else:
475 " whitelisted in LICENSE_FLAGS_WHITELIST") 475 message = "because it has restricted licenses {0}. Which are not whitelisted in LICENSE_FLAGS_WHITELIST".format(
476 ", ".join("'{0}'".format(f) for f in unmatched_license_flags))
477 bb.debug(1, "Skipping %s %s" % (pn, message))
478 raise bb.parse.SkipRecipe(message)
476 479
477 # If we're building a target package we need to use fakeroot (pseudo) 480 # If we're building a target package we need to use fakeroot (pseudo)
478 # in order to capture permissions, owners, groups and special files 481 # 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):
316 This function checks if a recipe has any LICENSE_FLAGS that 316 This function checks if a recipe has any LICENSE_FLAGS that
317 aren't whitelisted. 317 aren't whitelisted.
318 318
319 If it does, it returns the first LICENSE_FLAGS item missing from the 319 If it does, it returns the all LICENSE_FLAGS missing from the whitelist, or
320 whitelist, or all of the LICENSE_FLAGS if there is no whitelist. 320 all of the LICENSE_FLAGS if there is no whitelist.
321 321
322 If everything is is properly whitelisted, it returns None. 322 If everything is is properly whitelisted, it returns None.
323 """ 323 """
@@ -354,22 +354,23 @@ def check_license_flags(d):
354 return False 354 return False
355 355
356 def all_license_flags_match(license_flags, whitelist): 356 def all_license_flags_match(license_flags, whitelist):
357 """ Return first unmatched flag, None if all flags match """ 357 """ Return all unmatched flags, None if all flags match """
358 pn = d.getVar('PN') 358 pn = d.getVar('PN')
359 split_whitelist = whitelist.split() 359 split_whitelist = whitelist.split()
360 flags = []
360 for flag in license_flags.split(): 361 for flag in license_flags.split():
361 if not license_flag_matches(flag, split_whitelist, pn): 362 if not license_flag_matches(flag, split_whitelist, pn):
362 return flag 363 flags.append(flag)
363 return None 364 return flags if flags else None
364 365
365 license_flags = d.getVar('LICENSE_FLAGS') 366 license_flags = d.getVar('LICENSE_FLAGS')
366 if license_flags: 367 if license_flags:
367 whitelist = d.getVar('LICENSE_FLAGS_WHITELIST') 368 whitelist = d.getVar('LICENSE_FLAGS_WHITELIST')
368 if not whitelist: 369 if not whitelist:
369 return license_flags 370 return license_flags.split()
370 unmatched_flag = all_license_flags_match(license_flags, whitelist) 371 unmatched_flags = all_license_flags_match(license_flags, whitelist)
371 if unmatched_flag: 372 if unmatched_flags:
372 return unmatched_flag 373 return unmatched_flags
373 return None 374 return None
374 375
375def check_license_format(d): 376def check_license_format(d):