diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2025-11-07 14:14:37 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-11-14 06:45:29 -0800 |
| commit | ff754175475ae52a4f3fe91cf5d985a8b703dd11 (patch) | |
| tree | 8a41633c20b3ec597c583b258b7cc311e3975610 /meta/classes-recipe | |
| parent | b16bf27386d3a411f452908c913aaf2335be0f22 (diff) | |
| download | poky-ff754175475ae52a4f3fe91cf5d985a8b703dd11.tar.gz | |
classes-global/license: Move functions to library code
Moves several of the functions in license.bbclass to be library code
New function dependencies were manually verified using bitbake-dumpsigs
to ensure that bitbake identified the same dependencies even though they
are now in library code (although the new function names mean that the
task hashes still change)
(From OE-Core rev: 5e220e20833fd800687b05c8f5cef602dfc47202)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0333e04e353991260c5f67a72f80f3ab9dcf526a)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/classes-recipe')
| -rw-r--r-- | meta/classes-recipe/license_image.bbclass | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/meta/classes-recipe/license_image.bbclass b/meta/classes-recipe/license_image.bbclass index 19b3dc55ba..b18a64d2bc 100644 --- a/meta/classes-recipe/license_image.bbclass +++ b/meta/classes-recipe/license_image.bbclass | |||
| @@ -58,7 +58,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
| 58 | import stat | 58 | import stat |
| 59 | 59 | ||
| 60 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() | 60 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() |
| 61 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | 61 | bad_licenses = oe.license.expand_wildcard_licenses(d, bad_licenses) |
| 62 | pkgarchs = d.getVar("SSTATE_ARCHS").split() | 62 | pkgarchs = d.getVar("SSTATE_ARCHS").split() |
| 63 | pkgarchs.reverse() | 63 | pkgarchs.reverse() |
| 64 | 64 | ||
| @@ -66,17 +66,17 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
| 66 | with open(license_manifest, "w") as license_file: | 66 | with open(license_manifest, "w") as license_file: |
| 67 | for pkg in sorted(pkg_dic): | 67 | for pkg in sorted(pkg_dic): |
| 68 | remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) | 68 | remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) |
| 69 | incompatible_licenses = incompatible_pkg_license(d, remaining_bad_licenses, pkg_dic[pkg]["LICENSE"]) | 69 | incompatible_licenses = oe.license.incompatible_pkg_license(d, remaining_bad_licenses, pkg_dic[pkg]["LICENSE"]) |
| 70 | if incompatible_licenses: | 70 | if incompatible_licenses: |
| 71 | bb.fatal("Package %s cannot be installed into the image because it has incompatible license(s): %s" %(pkg, ' '.join(incompatible_licenses))) | 71 | bb.fatal("Package %s cannot be installed into the image because it has incompatible license(s): %s" %(pkg, ' '.join(incompatible_licenses))) |
| 72 | else: | 72 | else: |
| 73 | incompatible_licenses = incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"]) | 73 | incompatible_licenses = oe.license.incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"]) |
| 74 | if incompatible_licenses: | 74 | if incompatible_licenses: |
| 75 | oe.qa.handle_error('license-incompatible', "Including %s with incompatible license(s) %s into the image, because it has been allowed by exception list." %(pkg, ' '.join(incompatible_licenses)), d) | 75 | oe.qa.handle_error('license-incompatible', "Including %s with incompatible license(s) %s into the image, because it has been allowed by exception list." %(pkg, ' '.join(incompatible_licenses)), d) |
| 76 | try: | 76 | try: |
| 77 | (pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \ | 77 | (pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \ |
| 78 | oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"], | 78 | oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"], |
| 79 | remaining_bad_licenses, canonical_license, d) | 79 | remaining_bad_licenses, oe.license.canonical_license, d) |
| 80 | except oe.license.LicenseError as exc: | 80 | except oe.license.LicenseError as exc: |
| 81 | bb.fatal('%s: %s' % (d.getVar('P'), exc)) | 81 | bb.fatal('%s: %s' % (d.getVar('P'), exc)) |
| 82 | 82 | ||
| @@ -144,7 +144,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
| 144 | if not os.path.exists(pkg_license_dir ): | 144 | if not os.path.exists(pkg_license_dir ): |
| 145 | bb.fatal("Couldn't find license information for dependency %s" % pkg) | 145 | bb.fatal("Couldn't find license information for dependency %s" % pkg) |
| 146 | 146 | ||
| 147 | pkg_manifest_licenses = [canonical_license(d, lic) \ | 147 | pkg_manifest_licenses = [oe.license.canonical_license(d, lic) \ |
| 148 | for lic in pkg_dic[pkg]["LICENSES"]] | 148 | for lic in pkg_dic[pkg]["LICENSES"]] |
| 149 | 149 | ||
| 150 | licenses = os.listdir(pkg_license_dir) | 150 | licenses = os.listdir(pkg_license_dir) |
| @@ -153,7 +153,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
| 153 | pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic) | 153 | pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic) |
| 154 | 154 | ||
| 155 | if re.match(r"^generic_.*$", lic): | 155 | if re.match(r"^generic_.*$", lic): |
| 156 | generic_lic = canonical_license(d, | 156 | generic_lic = oe.license.canonical_license(d, |
| 157 | re.search(r"^generic_(.*)$", lic).group(1)) | 157 | re.search(r"^generic_(.*)$", lic).group(1)) |
| 158 | 158 | ||
| 159 | # Do not copy generic license into package if isn't | 159 | # Do not copy generic license into package if isn't |
| @@ -176,7 +176,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
| 176 | if not os.path.exists(pkg_rootfs_license): | 176 | if not os.path.exists(pkg_rootfs_license): |
| 177 | os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license) | 177 | os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license) |
| 178 | else: | 178 | else: |
| 179 | if (oe.license.license_ok(canonical_license(d, | 179 | if (oe.license.license_ok(oe.license.canonical_license(d, |
| 180 | lic), bad_licenses) == False or | 180 | lic), bad_licenses) == False or |
| 181 | os.path.exists(pkg_rootfs_license)): | 181 | os.path.exists(pkg_rootfs_license)): |
| 182 | continue | 182 | continue |
