Mailinglist Archive: zypp-devel (56 mails)

< Previous Next >
Re: [zypp-devel] How to get a packages' depends and requires from libzypp
  • From: "Boyd Timothy" <btimothy@xxxxxxxxx>
  • Date: Tue, 11 Dec 2007 09:01:37 -0700
  • Message-id: <d0151e9d0712110801w43d9240nb5b68e611045ff42@xxxxxxxxxxxxxx>
On Dec 7, 2007 9:55 AM, Boyd Timothy <btimothy@xxxxxxxxx> wrote:

On Dec 7, 2007 8:48 AM, Boyd Timothy <btimothy@xxxxxxxxx> wrote:

On Dec 7, 2007 1:30 AM, Stefan Schubert <schubi@xxxxxxx> wrote:
Boyd Timothy schrieb:

On Dec 6, 2007 3:54 AM, Stefan Schubert <schubi@xxxxxxx> wrote:

Duncan Mac-Vicar Prett schrieb:
const solver::detail::ItemCapKindList isInstalledBy (const
PoolItem_Ref item);

const solver::detail::ItemCapKindList installs (const PoolItem_Ref

Been trying to figure out how to call this. Right now in my code, I
iterate through the pool looking for the main package, mark it to be
installed, run the solver, and now I'm to the point where I'd call
installs(). Where do I get a PoolItem_Ref?

Sample code here:

Line 98 is where I'm stumped. installs() takes a PoolItem_Ref, but
where do I get one of those? Line #65 doesn't compile either, for
what it's worth.


It is defined in the return value:

* Gives information about WHICH additional items will be installed
due the installation of an item.
* \param item Evaluate additional information for this
* \return A list of structures which contains:
* item Item which will be installed due to the
installation of the given param item too.
* cap Capability which causes the installation
* capKind Kind of that capability (e.g.
* Note: In order to have a result start a solver run before. Not
matter if it is valid or invalid.
const solver::detail::ItemCapKindList installs (const PoolItem_Ref

The class ItemCapKindList is defined solver/details/Resolver.h:

// CLASS NAME : ItemCapKind
/** */
struct ItemCapKind
Capability cap; //Capability which has triggerd this selection
Dep capKind; //Kind of that capability
PoolItem_Ref item; //Item which has triggered this selection
bool initialInstallation; //This item has triggered the installation
//Not already fullfilled requierement only.

ItemCapKind() : capKind("FRESHENS") {}
ItemCapKind( PoolItem i, Capability c, Dep k, bool initial)
: cap( c )
, capKind( k )
, item( i )
, initialInstallation( initial )
{ }
typedef std::multimap<PoolItem_Ref,ItemCapKind> ItemCapKindMap;
typedef std::list<ItemCapKind> ItemCapKindList;

Here is a little example:

zypp::solver::detail::ItemCapKindList installList =
resolver->installs (item);
zypp::solver::detail::ItemCapKindList installedList =
resolver->isInstalledBy (item);

for (zypp::solver::detail::ItemCapKindList::const_iterator iter =
iter != installedList.end(); ++iter) {
QListViewItem *element = new QListViewItem( installedListView,

for (zypp::solver::detail::ItemCapKindList::const_iterator iter =
iter != installList.end(); ++iter) {
QListViewItem *element = new QListViewItem( installListView,



Okay, well, once you have the PoolItem_Ref, the code makes sense, but
I'm still unsure where I get the PoolItem_Ref originally. What call
can I make to get that?

Ah, thanks to mvidner in #zypp, we learned that you can get it from
Selectable::candidatePoolItem ().

Please take a minute and review the following code:

Is this what you had in mind? Isn't there an easier way to get this

I noticed that this only works for packages that are not installed.
Is there a mechanism that would work for packages that are installed?


To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups