Mailinglist Archive: zypp-devel (56 mails)

< Previous Next >
Re: [zypp-devel] How to get a packages' depends and requires from libzypp
  • From: Stefan Schubert <schubi@xxxxxxx>
  • Date: Fri, 07 Dec 2007 09:30:25 +0100
  • Message-id: <475904A1.3030905@xxxxxxx>
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
item);


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: http://pastebin.com/f78dc52da

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.

-Boyd


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 resolvable.
* \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.
Dep::REQUIRES,Dep::RECOMMENDS,... )
*
* 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
item);


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

///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ItemCapKind
//
/** */
struct ItemCapKind
{
public:
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);
installListView->clear();
installedListView->clear();

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

iter->item->edition().asString()+"."+iter->item->arch().asString(),
iter->cap.asString(),
iter->capKind.asString());
}
for (zypp::solver::detail::ItemCapKindList::const_iterator iter =
installList.begin();
iter != installList.end(); ++iter) {
QListViewItem *element = new QListViewItem( installListView,
iter->item->name(),

iter->item->edition().asString()+"."+iter->item->arch().asString(),
iter->cap.asString(),
iter->capKind.asString());
}


Greetings Stefan
--
*******************************************************************************
Stefan Schubert
SUSE LINUX GmbH - Maxfeldstrasse 5 - D-90409 Nuernberg, Germany
e-mail: schubi@xxxxxxx
-------------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)


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

< Previous Next >
Follow Ups