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:26:02 +0100 |
commit | 7ffe10df73cc20d10fcd41b121074445273bd60e (patch) | |
tree | 5062d4794bb216544bdcda7a7cd7dfc583eae003 /meta/classes | |
parent | d1278570041029d7c9fc6ce657e9a1701a421841 (diff) | |
download | openembedded-core-7ffe10df73cc20d10fcd41b121074445273bd60e.tar.gz openembedded-core-7ffe10df73cc20d10fcd41b121074445273bd60e.tar.bz2 openembedded-core-7ffe10df73cc20d10fcd41b121074445273bd60e.zip |
license_class: license_create_manifest improvment
Use image_list_installed_packges instead of open manually the package
manifest and iterate over it.
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/classes')
-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() { python license_create_manifest() { import re import oe.packagedata + from oe.rootfs import image_list_installed_packages bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split() bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) @@ -38,19 +39,15 @@ python license_create_manifest() { return 0 pkg_dic = {} - package_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), - d.getVar('IMAGE_NAME', True), 'package.manifest') - with open(package_manifest, "r") as package_file: - pkg_list = package_file.read().split() - for pkg in pkg_list: - pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), - 'runtime-reverse', pkg) - pkg_name = os.path.basename(os.readlink(pkg_info)) - - pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info) - if not "LICENSE" in pkg_dic[pkg_name].keys(): - pkg_lic_name = "LICENSE_" + pkg_name - pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] + for pkg in image_list_installed_packages(d).split("\n"): + pkg_info = os.path.join(d.getVar('PKGDATA_DIR', True), + 'runtime-reverse', pkg) + pkg_name = os.path.basename(os.readlink(pkg_info)) + + pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info) + if not "LICENSE" in pkg_dic[pkg_name].keys(): + pkg_lic_name = "LICENSE_" + pkg_name + pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), d.getVar('IMAGE_NAME', True), 'license.manifest') |