diff options
| author | Joshua Lock <joshua.g.lock@intel.com> | 2016-12-14 21:13:04 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-16 10:23:23 +0000 |
| commit | c4e2c59088765d1f1de7ec57cde91980f887c2ff (patch) | |
| tree | a2fda8ac5916fb59a711e9220c2177008cca9347 /meta/classes/license.bbclass | |
| parent | d5e67725ac11e3296cad104470931ffa16824b90 (diff) | |
| download | poky-c4e2c59088765d1f1de7ec57cde91980f887c2ff.tar.gz | |
meta: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.
Search made with the following regex: getVar ?\(( ?[^,()]*), True\)
(From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f)
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
| -rw-r--r-- | meta/classes/license.bbclass | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index afcfbfc038..c5d1204ca1 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
| @@ -37,13 +37,13 @@ python license_create_manifest() { | |||
| 37 | import oe.packagedata | 37 | import oe.packagedata |
| 38 | from oe.rootfs import image_list_installed_packages | 38 | from oe.rootfs import image_list_installed_packages |
| 39 | 39 | ||
| 40 | build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS', True) | 40 | build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS') |
| 41 | if build_images_from_feeds == "1": | 41 | if build_images_from_feeds == "1": |
| 42 | return 0 | 42 | return 0 |
| 43 | 43 | ||
| 44 | pkg_dic = {} | 44 | pkg_dic = {} |
| 45 | for pkg in sorted(image_list_installed_packages(d)): | 45 | for pkg in sorted(image_list_installed_packages(d)): |
| 46 | pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), | 46 | pkg_info = os.path.join(d.getVar('PKGDATA_DIR'), |
| 47 | 'runtime-reverse', pkg) | 47 | 'runtime-reverse', pkg) |
| 48 | pkg_name = os.path.basename(os.readlink(pkg_info)) | 48 | pkg_name = os.path.basename(os.readlink(pkg_info)) |
| 49 | 49 | ||
| @@ -52,15 +52,15 @@ python license_create_manifest() { | |||
| 52 | pkg_lic_name = "LICENSE_" + pkg_name | 52 | pkg_lic_name = "LICENSE_" + pkg_name |
| 53 | pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] | 53 | pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] |
| 54 | 54 | ||
| 55 | rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), | 55 | rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'), |
| 56 | d.getVar('IMAGE_NAME', True), 'license.manifest') | 56 | d.getVar('IMAGE_NAME'), 'license.manifest') |
| 57 | write_license_files(d, rootfs_license_manifest, pkg_dic) | 57 | write_license_files(d, rootfs_license_manifest, pkg_dic) |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | def write_license_files(d, license_manifest, pkg_dic): | 60 | def write_license_files(d, license_manifest, pkg_dic): |
| 61 | import re | 61 | import re |
| 62 | 62 | ||
| 63 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split() | 63 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() |
| 64 | bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) | 64 | bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) |
| 65 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | 65 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) |
| 66 | 66 | ||
| @@ -72,7 +72,7 @@ def write_license_files(d, license_manifest, pkg_dic): | |||
| 72 | oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"], | 72 | oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"], |
| 73 | bad_licenses, canonical_license, d) | 73 | bad_licenses, canonical_license, d) |
| 74 | except oe.license.LicenseError as exc: | 74 | except oe.license.LicenseError as exc: |
| 75 | bb.fatal('%s: %s' % (d.getVar('P', True), exc)) | 75 | bb.fatal('%s: %s' % (d.getVar('P'), exc)) |
| 76 | else: | 76 | else: |
| 77 | pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"]) | 77 | pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"]) |
| 78 | pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"]) | 78 | pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"]) |
| @@ -98,7 +98,7 @@ def write_license_files(d, license_manifest, pkg_dic): | |||
| 98 | license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"]) | 98 | license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"]) |
| 99 | 99 | ||
| 100 | for lic in pkg_dic[pkg]["LICENSES"]: | 100 | for lic in pkg_dic[pkg]["LICENSES"]: |
| 101 | lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY', True), | 101 | lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'), |
| 102 | pkg_dic[pkg]["PN"], "generic_%s" % | 102 | pkg_dic[pkg]["PN"], "generic_%s" % |
| 103 | re.sub('\+', '', lic)) | 103 | re.sub('\+', '', lic)) |
| 104 | # add explicity avoid of CLOSED license because isn't generic | 104 | # add explicity avoid of CLOSED license because isn't generic |
| @@ -114,8 +114,8 @@ def write_license_files(d, license_manifest, pkg_dic): | |||
| 114 | # - Just copy the manifest | 114 | # - Just copy the manifest |
| 115 | # - Copy the manifest and the license directories | 115 | # - Copy the manifest and the license directories |
| 116 | # With both options set we see a .5 M increase in core-image-minimal | 116 | # With both options set we see a .5 M increase in core-image-minimal |
| 117 | copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST', True) | 117 | copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST') |
| 118 | copy_lic_dirs = d.getVar('COPY_LIC_DIRS', True) | 118 | copy_lic_dirs = d.getVar('COPY_LIC_DIRS') |
| 119 | if copy_lic_manifest == "1": | 119 | if copy_lic_manifest == "1": |
| 120 | rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS', 'True'), | 120 | rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS', 'True'), |
| 121 | 'usr', 'share', 'common-licenses') | 121 | 'usr', 'share', 'common-licenses') |
| @@ -129,7 +129,7 @@ def write_license_files(d, license_manifest, pkg_dic): | |||
| 129 | for pkg in sorted(pkg_dic): | 129 | for pkg in sorted(pkg_dic): |
| 130 | pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg) | 130 | pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg) |
| 131 | bb.utils.mkdirhier(pkg_rootfs_license_dir) | 131 | bb.utils.mkdirhier(pkg_rootfs_license_dir) |
| 132 | pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY', True), | 132 | pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), |
| 133 | pkg_dic[pkg]["PN"]) | 133 | pkg_dic[pkg]["PN"]) |
| 134 | licenses = os.listdir(pkg_license_dir) | 134 | licenses = os.listdir(pkg_license_dir) |
| 135 | for lic in licenses: | 135 | for lic in licenses: |
| @@ -166,7 +166,7 @@ def license_deployed_manifest(d): | |||
| 166 | 166 | ||
| 167 | dep_dic = {} | 167 | dep_dic = {} |
| 168 | man_dic = {} | 168 | man_dic = {} |
| 169 | lic_dir = d.getVar("LICENSE_DIRECTORY", True) | 169 | lic_dir = d.getVar("LICENSE_DIRECTORY") |
| 170 | 170 | ||
| 171 | dep_dic = get_deployed_dependencies(d) | 171 | dep_dic = get_deployed_dependencies(d) |
| 172 | for dep in dep_dic.keys(): | 172 | for dep in dep_dic.keys(): |
| @@ -181,8 +181,8 @@ def license_deployed_manifest(d): | |||
| 181 | key,val = line.split(": ", 1) | 181 | key,val = line.split(": ", 1) |
| 182 | man_dic[dep][key] = val[:-1] | 182 | man_dic[dep][key] = val[:-1] |
| 183 | 183 | ||
| 184 | lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY', True), | 184 | lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), |
| 185 | d.getVar('IMAGE_NAME', True)) | 185 | d.getVar('IMAGE_NAME')) |
| 186 | bb.utils.mkdirhier(lic_manifest_dir) | 186 | bb.utils.mkdirhier(lic_manifest_dir) |
| 187 | image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest') | 187 | image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest') |
| 188 | write_license_files(d, image_license_manifest, man_dic) | 188 | write_license_files(d, image_license_manifest, man_dic) |
| @@ -202,7 +202,7 @@ def get_deployed_dependencies(d): | |||
| 202 | depends = list(set([dep[0] for dep | 202 | depends = list(set([dep[0] for dep |
| 203 | in list(taskdata.values()) | 203 | in list(taskdata.values()) |
| 204 | if not dep[0].endswith("-native")])) | 204 | if not dep[0].endswith("-native")])) |
| 205 | extra_depends = d.getVar("EXTRA_IMAGEDEPENDS", True) | 205 | extra_depends = d.getVar("EXTRA_IMAGEDEPENDS") |
| 206 | boot_depends = get_boot_dependencies(d) | 206 | boot_depends = get_boot_dependencies(d) |
| 207 | depends.extend(extra_depends.split()) | 207 | depends.extend(extra_depends.split()) |
| 208 | depends.extend(boot_depends) | 208 | depends.extend(boot_depends) |
| @@ -212,13 +212,13 @@ def get_deployed_dependencies(d): | |||
| 212 | # the SSTATE_MANIFESTS for "deploy" task. | 212 | # the SSTATE_MANIFESTS for "deploy" task. |
| 213 | # The manifest file name contains the arch. Because we are not running | 213 | # The manifest file name contains the arch. Because we are not running |
| 214 | # in the recipe context it is necessary to check every arch used. | 214 | # in the recipe context it is necessary to check every arch used. |
| 215 | sstate_manifest_dir = d.getVar("SSTATE_MANIFESTS", True) | 215 | sstate_manifest_dir = d.getVar("SSTATE_MANIFESTS") |
| 216 | sstate_archs = d.getVar("SSTATE_ARCHS", True) | 216 | sstate_archs = d.getVar("SSTATE_ARCHS") |
| 217 | extra_archs = d.getVar("PACKAGE_EXTRA_ARCHS", True) | 217 | extra_archs = d.getVar("PACKAGE_EXTRA_ARCHS") |
| 218 | archs = list(set(("%s %s" % (sstate_archs, extra_archs)).split())) | 218 | archs = list(set(("%s %s" % (sstate_archs, extra_archs)).split())) |
| 219 | for dep in depends: | 219 | for dep in depends: |
| 220 | # Some recipes have an arch on their own, so we try that first. | 220 | # Some recipes have an arch on their own, so we try that first. |
| 221 | special_arch = d.getVar("PACKAGE_ARCH_pn-%s" % dep, True) | 221 | special_arch = d.getVar("PACKAGE_ARCH_pn-%s" % dep) |
| 222 | if special_arch: | 222 | if special_arch: |
| 223 | sstate_manifest_file = os.path.join(sstate_manifest_dir, | 223 | sstate_manifest_file = os.path.join(sstate_manifest_dir, |
| 224 | "manifest-%s-%s.deploy" % (special_arch, dep)) | 224 | "manifest-%s-%s.deploy" % (special_arch, dep)) |
| @@ -254,7 +254,7 @@ def get_boot_dependencies(d): | |||
| 254 | in boot_depends_string.split() | 254 | in boot_depends_string.split() |
| 255 | if not dep.split(":")[0].endswith("-native")] | 255 | if not dep.split(":")[0].endswith("-native")] |
| 256 | for dep in boot_depends: | 256 | for dep in boot_depends: |
| 257 | info_file = os.path.join(d.getVar("LICENSE_DIRECTORY", True), | 257 | info_file = os.path.join(d.getVar("LICENSE_DIRECTORY"), |
| 258 | dep, "recipeinfo") | 258 | dep, "recipeinfo") |
| 259 | # If the recipe and dependency name is the same | 259 | # If the recipe and dependency name is the same |
| 260 | if os.path.exists(info_file): | 260 | if os.path.exists(info_file): |
| @@ -265,7 +265,7 @@ def get_boot_dependencies(d): | |||
| 265 | # The fifth field contains what the task provides | 265 | # The fifth field contains what the task provides |
| 266 | if dep in taskdep[4]: | 266 | if dep in taskdep[4]: |
| 267 | info_file = os.path.join( | 267 | info_file = os.path.join( |
| 268 | d.getVar("LICENSE_DIRECTORY", True), | 268 | d.getVar("LICENSE_DIRECTORY"), |
| 269 | taskdep[0], "recipeinfo") | 269 | taskdep[0], "recipeinfo") |
| 270 | if os.path.exists(info_file): | 270 | if os.path.exists(info_file): |
| 271 | depends.append(taskdep[0]) | 271 | depends.append(taskdep[0]) |
| @@ -295,7 +295,7 @@ python do_populate_lic() { | |||
| 295 | lic_files_paths = find_license_files(d) | 295 | lic_files_paths = find_license_files(d) |
| 296 | 296 | ||
| 297 | # The base directory we wrangle licenses to | 297 | # The base directory we wrangle licenses to |
| 298 | destdir = os.path.join(d.getVar('LICSSTATEDIR', True), d.getVar('PN', True)) | 298 | destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('PN')) |
| 299 | copy_license_files(lic_files_paths, destdir) | 299 | copy_license_files(lic_files_paths, destdir) |
| 300 | info = get_recipe_info(d) | 300 | info = get_recipe_info(d) |
| 301 | with open(os.path.join(destdir, "recipeinfo"), "w") as f: | 301 | with open(os.path.join(destdir, "recipeinfo"), "w") as f: |
| @@ -306,11 +306,11 @@ python do_populate_lic() { | |||
| 306 | # it would be better to copy them in do_install_append, but find_license_filesa is python | 306 | # it would be better to copy them in do_install_append, but find_license_filesa is python |
| 307 | python perform_packagecopy_prepend () { | 307 | python perform_packagecopy_prepend () { |
| 308 | enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d) | 308 | enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d) |
| 309 | if d.getVar('CLASSOVERRIDE', True) == 'class-target' and enabled: | 309 | if d.getVar('CLASSOVERRIDE') == 'class-target' and enabled: |
| 310 | lic_files_paths = find_license_files(d) | 310 | lic_files_paths = find_license_files(d) |
| 311 | 311 | ||
| 312 | # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY | 312 | # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY |
| 313 | destdir = d.getVar('D', True) + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY', True), d.getVar('PN', True)) | 313 | destdir = d.getVar('D') + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY'), d.getVar('PN')) |
| 314 | copy_license_files(lic_files_paths, destdir) | 314 | copy_license_files(lic_files_paths, destdir) |
| 315 | add_package_and_files(d) | 315 | add_package_and_files(d) |
| 316 | } | 316 | } |
| @@ -318,15 +318,15 @@ perform_packagecopy[vardeps] += "LICENSE_CREATE_PACKAGE" | |||
| 318 | 318 | ||
| 319 | def get_recipe_info(d): | 319 | def get_recipe_info(d): |
| 320 | info = {} | 320 | info = {} |
| 321 | info["PV"] = d.getVar("PV", True) | 321 | info["PV"] = d.getVar("PV") |
| 322 | info["PR"] = d.getVar("PR", True) | 322 | info["PR"] = d.getVar("PR") |
| 323 | info["LICENSE"] = d.getVar("LICENSE", True) | 323 | info["LICENSE"] = d.getVar("LICENSE") |
| 324 | return info | 324 | return info |
| 325 | 325 | ||
| 326 | def add_package_and_files(d): | 326 | def add_package_and_files(d): |
| 327 | packages = d.getVar('PACKAGES', True) | 327 | packages = d.getVar('PACKAGES') |
| 328 | files = d.getVar('LICENSE_FILES_DIRECTORY', True) | 328 | files = d.getVar('LICENSE_FILES_DIRECTORY') |
| 329 | pn = d.getVar('PN', True) | 329 | pn = d.getVar('PN') |
| 330 | pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX', False)) | 330 | pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX', False)) |
| 331 | if pn_lic in packages: | 331 | if pn_lic in packages: |
| 332 | bb.warn("%s package already existed in %s." % (pn_lic, pn)) | 332 | bb.warn("%s package already existed in %s." % (pn_lic, pn)) |
| @@ -334,7 +334,7 @@ def add_package_and_files(d): | |||
| 334 | # first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY | 334 | # first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY |
| 335 | d.setVar('PACKAGES', "%s %s" % (pn_lic, packages)) | 335 | d.setVar('PACKAGES', "%s %s" % (pn_lic, packages)) |
| 336 | d.setVar('FILES_' + pn_lic, files) | 336 | d.setVar('FILES_' + pn_lic, files) |
| 337 | rrecommends_pn = d.getVar('RRECOMMENDS_' + pn, True) | 337 | rrecommends_pn = d.getVar('RRECOMMENDS_' + pn) |
| 338 | if rrecommends_pn: | 338 | if rrecommends_pn: |
| 339 | d.setVar('RRECOMMENDS_' + pn, "%s %s" % (pn_lic, rrecommends_pn)) | 339 | d.setVar('RRECOMMENDS_' + pn, "%s %s" % (pn_lic, rrecommends_pn)) |
| 340 | else: | 340 | else: |
| @@ -390,12 +390,12 @@ def find_license_files(d): | |||
| 390 | from collections import defaultdict, OrderedDict | 390 | from collections import defaultdict, OrderedDict |
| 391 | 391 | ||
| 392 | # All the license files for the package | 392 | # All the license files for the package |
| 393 | lic_files = d.getVar('LIC_FILES_CHKSUM', True) or "" | 393 | lic_files = d.getVar('LIC_FILES_CHKSUM') or "" |
| 394 | pn = d.getVar('PN', True) | 394 | pn = d.getVar('PN') |
| 395 | # The license files are located in S/LIC_FILE_CHECKSUM. | 395 | # The license files are located in S/LIC_FILE_CHECKSUM. |
| 396 | srcdir = d.getVar('S', True) | 396 | srcdir = d.getVar('S') |
| 397 | # Directory we store the generic licenses as set in the distro configuration | 397 | # Directory we store the generic licenses as set in the distro configuration |
| 398 | generic_directory = d.getVar('COMMON_LICENSE_DIR', True) | 398 | generic_directory = d.getVar('COMMON_LICENSE_DIR') |
| 399 | # List of basename, path tuples | 399 | # List of basename, path tuples |
| 400 | lic_files_paths = [] | 400 | lic_files_paths = [] |
| 401 | # Entries from LIC_FILES_CHKSUM | 401 | # Entries from LIC_FILES_CHKSUM |
| @@ -403,7 +403,7 @@ def find_license_files(d): | |||
| 403 | license_source_dirs = [] | 403 | license_source_dirs = [] |
| 404 | license_source_dirs.append(generic_directory) | 404 | license_source_dirs.append(generic_directory) |
| 405 | try: | 405 | try: |
| 406 | additional_lic_dirs = d.getVar('LICENSE_PATH', True).split() | 406 | additional_lic_dirs = d.getVar('LICENSE_PATH').split() |
| 407 | for lic_dir in additional_lic_dirs: | 407 | for lic_dir in additional_lic_dirs: |
| 408 | license_source_dirs.append(lic_dir) | 408 | license_source_dirs.append(lic_dir) |
| 409 | except: | 409 | except: |
| @@ -473,18 +473,18 @@ def find_license_files(d): | |||
| 473 | try: | 473 | try: |
| 474 | (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url) | 474 | (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url) |
| 475 | except bb.fetch.MalformedUrl: | 475 | except bb.fetch.MalformedUrl: |
| 476 | bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF', True), url)) | 476 | bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), url)) |
| 477 | # We want the license filename and path | 477 | # We want the license filename and path |
| 478 | chksum = parm['md5'] if 'md5' in parm else parm['sha256'] | 478 | chksum = parm['md5'] if 'md5' in parm else parm['sha256'] |
| 479 | lic_chksums[path] = chksum | 479 | lic_chksums[path] = chksum |
| 480 | 480 | ||
| 481 | v = FindVisitor() | 481 | v = FindVisitor() |
| 482 | try: | 482 | try: |
| 483 | v.visit_string(d.getVar('LICENSE', True)) | 483 | v.visit_string(d.getVar('LICENSE')) |
| 484 | except oe.license.InvalidLicense as exc: | 484 | except oe.license.InvalidLicense as exc: |
| 485 | bb.fatal('%s: %s' % (d.getVar('PF', True), exc)) | 485 | bb.fatal('%s: %s' % (d.getVar('PF'), exc)) |
| 486 | except SyntaxError: | 486 | except SyntaxError: |
| 487 | bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF', True))) | 487 | bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF'))) |
| 488 | 488 | ||
| 489 | # Add files from LIC_FILES_CHKSUM to list of license files | 489 | # Add files from LIC_FILES_CHKSUM to list of license files |
| 490 | lic_chksum_paths = defaultdict(OrderedDict) | 490 | lic_chksum_paths = defaultdict(OrderedDict) |
| @@ -542,7 +542,7 @@ def expand_wildcard_licenses(d, wildcard_licenses): | |||
| 542 | 542 | ||
| 543 | def incompatible_license_contains(license, truevalue, falsevalue, d): | 543 | def incompatible_license_contains(license, truevalue, falsevalue, d): |
| 544 | license = canonical_license(d, license) | 544 | license = canonical_license(d, license) |
| 545 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE', True) or "").split() | 545 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() |
| 546 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | 546 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) |
| 547 | return truevalue if license in bad_licenses else falsevalue | 547 | return truevalue if license in bad_licenses else falsevalue |
| 548 | 548 | ||
| @@ -553,9 +553,9 @@ def incompatible_license(d, dont_want_licenses, package=None): | |||
| 553 | as canonical (SPDX) names. | 553 | as canonical (SPDX) names. |
| 554 | """ | 554 | """ |
| 555 | import oe.license | 555 | import oe.license |
| 556 | license = d.getVar("LICENSE_%s" % package, True) if package else None | 556 | license = d.getVar("LICENSE_%s" % package) if package else None |
| 557 | if not license: | 557 | if not license: |
| 558 | license = d.getVar('LICENSE', True) | 558 | license = d.getVar('LICENSE') |
| 559 | 559 | ||
| 560 | # Handles an "or" or two license sets provided by | 560 | # Handles an "or" or two license sets provided by |
| 561 | # flattened_licenses(), pick one that works if possible. | 561 | # flattened_licenses(), pick one that works if possible. |
| @@ -566,7 +566,7 @@ def incompatible_license(d, dont_want_licenses, package=None): | |||
| 566 | try: | 566 | try: |
| 567 | licenses = oe.license.flattened_licenses(license, choose_lic_set) | 567 | licenses = oe.license.flattened_licenses(license, choose_lic_set) |
| 568 | except oe.license.LicenseError as exc: | 568 | except oe.license.LicenseError as exc: |
| 569 | bb.fatal('%s: %s' % (d.getVar('P', True), exc)) | 569 | bb.fatal('%s: %s' % (d.getVar('P'), exc)) |
| 570 | return any(not oe.license.license_ok(canonical_license(d, l), \ | 570 | return any(not oe.license.license_ok(canonical_license(d, l), \ |
| 571 | dont_want_licenses) for l in licenses) | 571 | dont_want_licenses) for l in licenses) |
| 572 | 572 | ||
| @@ -614,16 +614,16 @@ def check_license_flags(d): | |||
| 614 | 614 | ||
| 615 | def all_license_flags_match(license_flags, whitelist): | 615 | def all_license_flags_match(license_flags, whitelist): |
| 616 | """ Return first unmatched flag, None if all flags match """ | 616 | """ Return first unmatched flag, None if all flags match """ |
| 617 | pn = d.getVar('PN', True) | 617 | pn = d.getVar('PN') |
| 618 | split_whitelist = whitelist.split() | 618 | split_whitelist = whitelist.split() |
| 619 | for flag in license_flags.split(): | 619 | for flag in license_flags.split(): |
| 620 | if not license_flag_matches(flag, split_whitelist, pn): | 620 | if not license_flag_matches(flag, split_whitelist, pn): |
| 621 | return flag | 621 | return flag |
| 622 | return None | 622 | return None |
| 623 | 623 | ||
| 624 | license_flags = d.getVar('LICENSE_FLAGS', True) | 624 | license_flags = d.getVar('LICENSE_FLAGS') |
| 625 | if license_flags: | 625 | if license_flags: |
| 626 | whitelist = d.getVar('LICENSE_FLAGS_WHITELIST', True) | 626 | whitelist = d.getVar('LICENSE_FLAGS_WHITELIST') |
| 627 | if not whitelist: | 627 | if not whitelist: |
| 628 | return license_flags | 628 | return license_flags |
| 629 | unmatched_flag = all_license_flags_match(license_flags, whitelist) | 629 | unmatched_flag = all_license_flags_match(license_flags, whitelist) |
| @@ -637,8 +637,8 @@ def check_license_format(d): | |||
| 637 | Validate operators in LICENSES. | 637 | Validate operators in LICENSES. |
| 638 | No spaces are allowed between LICENSES. | 638 | No spaces are allowed between LICENSES. |
| 639 | """ | 639 | """ |
| 640 | pn = d.getVar('PN', True) | 640 | pn = d.getVar('PN') |
| 641 | licenses = d.getVar('LICENSE', True) | 641 | licenses = d.getVar('LICENSE') |
| 642 | from oe.license import license_operator, license_operator_chars, license_pattern | 642 | from oe.license import license_operator, license_operator_chars, license_pattern |
| 643 | 643 | ||
| 644 | elements = list(filter(lambda x: x.strip(), license_operator.split(licenses))) | 644 | elements = list(filter(lambda x: x.strip(), license_operator.split(licenses))) |
