[OE-core] [PATCH 4/7] packageinfo.bbclass: add a new bbclass to pass package information

Dongxiao Xu dongxiao.xu at intel.com
Fri Jan 6 09:05:02 UTC 2012


packageinfo.bbclass is to pass the accurate package information to
clients (e.g. Hob), including PN, PV, RDEPENDS, PKGSIZE, etc.

Signed-off-by: Dongxiao Xu <dongxiao.xu at intel.com>
---
 meta/classes/packageinfo.bbclass |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/packageinfo.bbclass

diff --git a/meta/classes/packageinfo.bbclass b/meta/classes/packageinfo.bbclass
new file mode 100644
index 0000000..644b482
--- /dev/null
+++ b/meta/classes/packageinfo.bbclass
@@ -0,0 +1,30 @@
+inherit packagedata
+
+python do_package_info () {
+    bb.build.exec_func("read_subpackage_metadata", d)
+    pn = d.getVar('PN', True) or ""
+    pv = d.getVar('PV', True) or ""
+    pr = d.getVar('PR', True) or ""
+    recipe = pn + '-' + pv + '-' + pr
+
+    packages = d.getVar('PACKAGES', True) or ""
+    pkginfolist = []
+    for pkg in packages.split():
+        pkginfo = {}
+        pkginfo['pkg'] = pkg
+        pkginfo['pkgv'] = d.getVar('PKGV', True) or ""
+        pkginfo['pkgr'] = d.getVar('PKGR', True) or ""
+        pkginfo['pkg_rename'] = d.getVar('PKG_%s' % pkg, True) or ""
+        pkginfo['section'] = d.getVar('SECTION', True) or ""
+        pkginfo['summary'] = d.getVar('SUMMARY', True) or ""
+        pkginfo['rdep'] = d.getVar('RDEPENDS_%s' % pkg, True) or ""
+        pkginfo['rrec'] = d.getVar('RRECOMMENDS_%s' % pkg, True) or ""
+        pkginfo['rprov'] = d.getVar('RPROVIDES_%s' % pkg, True) or ""
+        pkginfo['size'] = d.getVar('PKGSIZE_%s' % pkg, True) or ""
+        pkginfo['allow_empty'] = d.getVar('ALLOW_EMPTY_%s' % pkg, True) or d.getVar('ALLOW_EMPTY', True) or ""
+        pkginfolist.append(pkginfo)
+
+    bb.event.fire(bb.event.PackageInfo(recipe, pkginfolist), d)
+}
+do_package_info[nostamp] = "1"
+addtask package_info after do_package_write
-- 
1.7.0.4





More information about the Openembedded-core mailing list