diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2018-11-07 08:51:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-14 11:14:39 +0000 |
commit | 97c9fb7ba0735e1c4c6ae95c3150ddfd1788f1de (patch) | |
tree | 0aa9cba21dbf2afe1b23b5b524baa033ab641f0c /meta/classes/license.bbclass | |
parent | c77d38acd63bc3b91ce0616c9595fc9a914906ba (diff) | |
download | poky-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/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 19 |
1 files changed, 10 insertions, 9 deletions
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 | ||
375 | def check_license_format(d): | 376 | def check_license_format(d): |