[OE-core] [PATCH 4/6] license.bbclass: Added get_package_from_deployed

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Mon Nov 9 10:23:49 UTC 2015


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

This function will verify if the dependency is
a package by itself or if the dependency installed
more packages. This is special useful with the kernels
because the dependency could be "linux-yocto" that in
fact installed other packages. This function will be
useful to get the version of the packages.

[YOCTO #6772]

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

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 4e00170..d384491 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -95,6 +95,21 @@ def get_deployed_dependencies(d):
 
     return deploy
 
+def get_package_from_deployed(d, dep):
+    """ Get just one package from a dependency """
+
+    import oe.packagedata
+
+    # Only one package is neccesary to get the version
+    data_file = os.path.join(d.getVar("PKGDATA_DIR",True),
+            "runtime", dep)
+    if os.path.exists(data_file):
+        return dep
+    else:
+        pkg_file = os.path.join(d.getVar("PKGDATA_DIR",True), dep)
+        pkgdata = oe.packagedata.read_pkgdatafile(pkg_file)
+        return pkgdata["PACKAGES"].split()[0]
+
 def get_boot_dependencies(d):
     """ Return the dependencies from boot tasks """
 
-- 
1.8.4.5




More information about the Openembedded-core mailing list