diff options
| -rw-r--r-- | meta/classes/license.bbclass | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 40dcbeba33..4b392ceea0 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
| @@ -266,23 +266,23 @@ def incompatible_license(d,dont_want_license): | |||
| 266 | dont_want_licenses = [] | 266 | dont_want_licenses = [] |
| 267 | dont_want_licenses.append(d.getVar('INCOMPATIBLE_LICENSE', True)) | 267 | dont_want_licenses.append(d.getVar('INCOMPATIBLE_LICENSE', True)) |
| 268 | if d.getVarFlag('SPDXLICENSEMAP', dont_want_license): | 268 | if d.getVarFlag('SPDXLICENSEMAP', dont_want_license): |
| 269 | dont_want_licenses.append(d.getVarFlag('SPDXLICENSEMAP', dont_want_license)) | 269 | dont_want_licenses.append(d.getVarFlag('SPDXLICENSEMAP', dont_want_license)) |
| 270 | 270 | ||
| 271 | def include_license(license): | 271 | def include_license(license): |
| 272 | if any(fnmatch(license, pattern) for pattern in dont_want_licenses): | 272 | if any(fnmatch(license, pattern) for pattern in dont_want_licenses): |
| 273 | return False | 273 | return False |
| 274 | else: | 274 | else: |
| 275 | spdx_license = d.getVarFlag('SPDXLICENSEMAP', license) | 275 | spdx_license = d.getVarFlag('SPDXLICENSEMAP', license) |
| 276 | if spdx_license and any(fnmatch(spdx_license, pattern) for pattern in dont_want_licenses): | 276 | if spdx_license and any(fnmatch(spdx_license, pattern) for pattern in dont_want_licenses): |
| 277 | return False | 277 | return False |
| 278 | else: | 278 | else: |
| 279 | return True | 279 | return True |
| 280 | 280 | ||
| 281 | def choose_licenses(a, b): | 281 | def choose_licenses(a, b): |
| 282 | if all(include_license(lic) for lic in a): | 282 | if all(include_license(lic) for lic in a): |
| 283 | return a | 283 | return a |
| 284 | else: | 284 | else: |
| 285 | return b | 285 | return b |
| 286 | 286 | ||
| 287 | """ | 287 | """ |
| 288 | If you want to exlude license named generically 'X', we surely want to exlude 'X+' as well. | 288 | If you want to exlude license named generically 'X', we surely want to exlude 'X+' as well. |
| @@ -290,13 +290,13 @@ def incompatible_license(d,dont_want_license): | |||
| 290 | is not a 'X+' license. | 290 | is not a 'X+' license. |
| 291 | """ | 291 | """ |
| 292 | if not re.search(r'[+]',dont_want_license): | 292 | if not re.search(r'[+]',dont_want_license): |
| 293 | licenses=oe.license.flattened_licenses(re.sub(r'[+]', '', d.getVar('LICENSE', True)), choose_licenses) | 293 | licenses=oe.license.flattened_licenses(re.sub(r'[+]', '', d.getVar('LICENSE', True)), choose_licenses) |
| 294 | else: | 294 | else: |
| 295 | licenses=oe.license.flattened_licenses(d.getVar('LICENSE', True), choose_licenses) | 295 | licenses=oe.license.flattened_licenses(d.getVar('LICENSE', True), choose_licenses) |
| 296 | 296 | ||
| 297 | for onelicense in licenses: | 297 | for onelicense in licenses: |
| 298 | if not include_license(onelicense): | 298 | if not include_license(onelicense): |
| 299 | return True | 299 | return True |
| 300 | return False | 300 | return False |
| 301 | 301 | ||
| 302 | 302 | ||
| @@ -361,7 +361,6 @@ def check_license_flags(d): | |||
| 361 | return unmatched_flag | 361 | return unmatched_flag |
| 362 | return None | 362 | return None |
| 363 | 363 | ||
| 364 | |||
| 365 | SSTATETASKS += "do_populate_lic" | 364 | SSTATETASKS += "do_populate_lic" |
| 366 | do_populate_lic[sstate-name] = "populate-lic" | 365 | do_populate_lic[sstate-name] = "populate-lic" |
| 367 | do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" | 366 | do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" |
