[OE-core] [oe-core] How to query installed rpm packages

Paul Eggleton paul.eggleton at linux.intel.com
Mon May 28 13:26:13 UTC 2012


On Monday 28 May 2012 15:14:32 Giuseppe Condorelli wrote:
> I need to query, via rpm command, the packages installed building an own
> image recipe.
> I know the populate_rootfs step for images uses rpm to install the packages
> (if we set PACKAGE_CLASSES).
> To do this it sets a dbpath and a root path for installing the packages.
> I need to know how to query them (rpm -qa ....) given that dbpath is set to
> /var/lib/rpm but I think it actually doesn't override
> the real /var/lib/rpm database (also I'm not building as superuser).

Have a look at list_installed_packages() in classes/rootfs_rpm.bbclass; that 
does exactly this. You can call this from your own shell function which you 
can add to ROOTFS_POSTPROCESS_COMMAND.

Note that if all you want is a listing of the installed packages in a file that 
gets written every time an image is built, you can get that using buildhistory 
without any extra work:

https://wiki.yoctoproject.org/wiki/Buildhistory

Cheers,
Paul

--

Paul Eggleton
Intel Open Source Technology Centre




More information about the Openembedded-core mailing list