[OE-core] [PATCHv2 2/6] license.bbclass: Added get_boot_dependencies function

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Mon Nov 9 14:04:39 UTC 2015


From: Mariano Lopez <mariano.lopez at linux.intel.com>

This function gets the dependencies from the classes that
create a boot image, this is required because sometimes
the bootloader dependecy is in these classes. The current
classes covered are bootimg and bootdirectdisk because
these are the only clases that add dependencies.

[YOCTO #6772]

Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 meta/classes/license.bbclass | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 98f1733..d1bfe61 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -49,6 +49,37 @@ python license_create_manifest() {
     write_license_files(d, rootfs_license_manifest, pkg_dic)
 }
 
+def get_boot_dependencies(d):
+    """ Return the dependencies from boot tasks """
+
+    depends = ""
+    boot_depends_string = ""
+    taskdepdata = d.getVar("BB_TASKDEPDATA", True)
+    # Only bootimg and bootdirectdisk include the depends flag
+    boot_tasks = ["do_bootimg", "do_bootdirectdisk",]
+
+    for task in boot_tasks:
+        boot_depends_string = "%s %s" % (boot_depends_string,
+                d.getVarFlag(task, "depends", True) or "")
+    boot_depends = [dep.split(":")[0] for dep
+                in boot_depends_string.split()
+                if not dep.split(":")[0].endswith("-native")]
+    for dep in boot_depends:
+        pkgs_file = os.path.join(d.getVar('PKGDATA_DIR', True), dep)
+        # If the package and dependency name is the same
+        if os.path.exists(pkgs_file):
+            depends = "%s %s" % (depends, dep)
+        # We need to search for the provider of the dependency
+        else:
+            for taskdep in taskdepdata.itervalues():
+                # The fifth field contains what the task provides
+                if dep in taskdep[4]:
+                    pkgs_file = os.path.join(d.getVar('PKGDATA_DIR', True), taskdep[0])
+                    if os.path.isfile(pkgs_file):
+                        depends = "%s %s" % (depends, taskdep[0])
+                        break
+    return depends
+
 def write_license_files(d, license_manifest, pkg_dic):
     import re
 
-- 
1.8.4.5




More information about the Openembedded-core mailing list