diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-05-08 20:41:32 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-09 22:28:14 +0100 |
commit | 2d69dd2caf9f67a8b9c965687a4a54ff590534fa (patch) | |
tree | 6c271619b4b5c032396f92789c8a13eaaf0a9e7d /meta | |
parent | b394cd4c7e1997f3df4a0c796446b48dd7fe2c07 (diff) | |
download | poky-2d69dd2caf9f67a8b9c965687a4a54ff590534fa.tar.gz |
license_class: license_create_manifest improvment
Use image_list_installed_packges instead of open manually the package
manifest and iterate over it.
(From OE-Core rev: 7ffe10df73cc20d10fcd41b121074445273bd60e)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/license.bbclass | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 54ab123840..7972c79af5 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -28,6 +28,7 @@ python write_package_manifest() { | |||
28 | python license_create_manifest() { | 28 | python license_create_manifest() { |
29 | import re | 29 | import re |
30 | import oe.packagedata | 30 | import oe.packagedata |
31 | from oe.rootfs import image_list_installed_packages | ||
31 | 32 | ||
32 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split() | 33 | bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split() |
33 | bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) | 34 | bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) |
@@ -38,19 +39,15 @@ python license_create_manifest() { | |||
38 | return 0 | 39 | return 0 |
39 | 40 | ||
40 | pkg_dic = {} | 41 | pkg_dic = {} |
41 | package_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), | 42 | for pkg in image_list_installed_packages(d).split("\n"): |
42 | d.getVar('IMAGE_NAME', True), 'package.manifest') | 43 | pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), |
43 | with open(package_manifest, "r") as package_file: | 44 | 'runtime-reverse', pkg) |
44 | pkg_list = package_file.read().split() | 45 | pkg_name = os.path.basename(os.readlink(pkg_info)) |
45 | for pkg in pkg_list: | 46 | |
46 | pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), | 47 | pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info) |
47 | 'runtime-reverse', pkg) | 48 | if not "LICENSE" in pkg_dic[pkg_name].keys(): |
48 | pkg_name = os.path.basename(os.readlink(pkg_info)) | 49 | pkg_lic_name = "LICENSE_" + pkg_name |
49 | 50 | pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] | |
50 | pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info) | ||
51 | if not "LICENSE" in pkg_dic[pkg_name].keys(): | ||
52 | pkg_lic_name = "LICENSE_" + pkg_name | ||
53 | pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] | ||
54 | 51 | ||
55 | license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), | 52 | license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), |
56 | d.getVar('IMAGE_NAME', True), 'license.manifest') | 53 | d.getVar('IMAGE_NAME', True), 'license.manifest') |