summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-11-13 14:29:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-01 21:07:20 +0000
commita58e8e164b888a6e4747ef62a7a43825c4f47c32 (patch)
treee141300b8ed9e0b43a35f4acb9aec72bc622e3e8 /meta/classes
parentf1a0a86ea2db6f16d9b643636a8973aaeb85e4a6 (diff)
downloadopenembedded-core-a58e8e164b888a6e4747ef62a7a43825c4f47c32.tar.gz
openembedded-core-a58e8e164b888a6e4747ef62a7a43825c4f47c32.tar.bz2
openembedded-core-a58e8e164b888a6e4747ef62a7a43825c4f47c32.zip
license.bbclass: Create image license manifest
This change adds the license_deployed_manifest function that will create the manifest for the packages deployed next to the image but not installed in rootfs. Some examples of these recipes would be the bootloaders, or the kernel. This new function was added to ROOTFS_POSTPROCESS_COMMAND so it will run after every rootfs task. This change also modify the write_license_files because the image manifest is different from the root manifest. [YOCTO #6772] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/license.bbclass62
1 files changed, 51 insertions, 11 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 48d457e824..be1e0e7095 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -25,6 +25,10 @@ python write_package_manifest() {
'w+').write(image_list_installed_packages(d))
}
+python write_deploy_manifest() {
+ license_deployed_manifest(d)
+}
+
python license_create_manifest() {
import oe.packagedata
from oe.rootfs import image_list_installed_packages
@@ -70,16 +74,24 @@ def write_license_files(d, license_manifest, pkg_dic):
pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
- license_file.write("PACKAGE NAME: %s\n" % pkg)
- license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
- license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
- license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
-
- # If the package doesn't contain any file, that is, its size is 0, the license
- # isn't relevant as far as the final image is concerned. So doing license check
- # doesn't make much sense, skip it.
- if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
- continue
+ if not "IMAGE_MANIFEST" in pkg_dic[pkg]:
+ # Rootfs manifest
+ license_file.write("PACKAGE NAME: %s\n" % pkg)
+ license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
+ license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
+ license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
+
+ # If the package doesn't contain any file, that is, its size is 0, the license
+ # isn't relevant as far as the final image is concerned. So doing license check
+ # doesn't make much sense, skip it.
+ if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
+ continue
+ else:
+ # Image manifest
+ license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
+ license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
+ license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
+ license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
for lic in pkg_dic[pkg]["LICENSES"]:
lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY', True),
@@ -141,6 +153,34 @@ def write_license_files(d, license_manifest, pkg_dic):
os.link(pkg_license, pkg_rootfs_license)
+def license_deployed_manifest(d):
+ """
+ Write the license manifest for the deployed recipes.
+ The deployed recipes usually includes the bootloader
+ and extra files to boot the target.
+ """
+
+ dep_dic = {}
+ man_dic = {}
+ lic_dir = d.getVar("LICENSE_DIRECTORY", True)
+
+ dep_dic = get_deployed_dependencies(d)
+ for dep in dep_dic.keys():
+ man_dic[dep] = {}
+ # It is necessary to mark this will be used for image manifest
+ man_dic[dep]["IMAGE_MANIFEST"] = True
+ man_dic[dep]["PN"] = dep
+ man_dic[dep]["FILES"] = \
+ " ".join(get_deployed_files(dep_dic[dep]))
+ with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
+ for line in f.readlines():
+ key,val = line.split(": ", 1)
+ man_dic[dep][key] = val[:-1]
+
+ image_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True),
+ d.getVar('IMAGE_NAME', True), 'image_license.manifest')
+ write_license_files(d, image_license_manifest, man_dic)
+
def get_deployed_dependencies(d):
"""
Get all the deployed dependencies of an image
@@ -591,7 +631,7 @@ SSTATETASKS += "do_populate_lic"
do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
-ROOTFS_POSTPROCESS_COMMAND_prepend = "write_package_manifest; license_create_manifest; "
+ROOTFS_POSTPROCESS_COMMAND_prepend = "write_package_manifest; write_deploy_manifest; license_create_manifest; "
do_rootfs[recrdeptask] += "do_populate_lic"
do_populate_lic_setscene[dirs] = "${LICSSTATEDIR}/${PN}"