Patchwork [4/7] packageinfo.bbclass: add a new bbclass to pass package information

login
register
mail settings
Submitter Dongxiao Xu
Date Jan. 6, 2012, 9:05 a.m.
Message ID <0642f4ea3b43b7753405481c5f4999cf9f822142.1325840474.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/18639/
State New
Headers show

Comments

Dongxiao Xu - Jan. 6, 2012, 9:05 a.m.
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@intel.com>
---
 meta/classes/packageinfo.bbclass |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/packageinfo.bbclass
Koen Kooi - Jan. 6, 2012, 10:32 a.m.
Op 6 jan. 2012, om 10:05 heeft Dongxiao Xu het volgende geschreven:

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

Why not reuse buildhistory for this?
Dongxiao Xu - Jan. 7, 2012, 8 a.m.
Hi Koen,

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> Koen Kooi
> Sent: Friday, January 06, 2012 6:32 PM
> To: Patches and discussions about the oe-core layer
> Subject: Re: [OE-core] [PATCH 4/7] packageinfo.bbclass: add a new bbclass to
> pass package information
> 
> 
> Op 6 jan. 2012, om 10:05 heeft Dongxiao Xu het volgende geschreven:
> 
> > packageinfo.bbclass is to pass the accurate package information to
> > clients (e.g. Hob), including PN, PV, RDEPENDS, PKGSIZE, etc.
> 
> Why not reuse buildhistory for this?

I didn't aware the existence of buildhistory.bbclass when I wrote my code. I will have a look at that.

Thanks,
Dongxiao

> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

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