Mailinglist Archive: zypp-devel (56 mails)
| < Previous | Next > |
Re: [zypp-devel] How to get a packages' depends and requires from libzypp
- From: Michael Andres <ma@xxxxxxx>
- Date: Fri, 14 Dec 2007 22:54:23 +0100
- Message-id: <20071214215422.GA32298@xxxxxxx>
On Thu, Dec 13, Michael Andres wrote:
Attached a small test program. Maybe you want to give it a try and see
whether it matches your expectations. It computes 'dependent packages'
(whatever this exacly means) for both, installed and available packages.
'NAME [EDITION [ARCH]]:' is a prompt. Enter a name and it looks for the
best available package. If you specify an edition, it will first look for
an installed one:
NAME [EDITION [ARCH]]: A
AdobeICCProfiles (I 2.0-74)(A 2.0-74.1 2.0-74 2.0-74)
NAME [EDITION [ARCH]]: AdobeICCProfiles
Package: U__s_[S1:1][package]AdobeICCProfiles-2.0-74.1.noarch
depends on (0) {}
NAME [EDITION [ARCH]]: AdobeICCProfiles 2.0-74
Package: I_TsU[S0:0][package]AdobeICCProfiles-2.0-74.noarch
depends on (0) {}
U__s_.. - U means uninstalled
I_TsU.. - I means installed
A more exiting ;=O example:
NAME [EDITION [ARCH]]: sendmail
Package: U__s_[S1:1][package]sendmail-8.14.1-53.1.x86_64
depends on (16) {
I__s_[S0:0][package]filesystem-10.3-50.x86_64
I__s_[S0:0][package]sed-4.1.5-64.x86_64
I__s_[S0:0][package]fillup-1.42-179.x86_64
I__s_[S0:0][package]coreutils-6.9-43.x86_64
I__s_[S0:0][package]glibc-2.6.1-18.3.x86_64
I__s_[S0:0][package]libopenssl0_9_8-0.9.8e-45.5.x86_64
I__s_[S0:0][package]libdb-4_5-4.5.20-29.x86_64
I__s_[S0:0][package]openldap2-client-2.3.37-20.x86_64
I__s_[S0:0][package]cyrus-sasl-2.1.22-82.x86_64
I__s_[S0:0][package]tcpd-7.6-791.x86_64
I__s_[S0:0][package]m4-1.4.10-17.x86_64
I__s_[S0:0][package]netcfg-10.3-39.noarch
I__s_[S0:0][package]procmail-3.22-139.x86_64
I__s_[S0:0][package]bash-3.2-61.x86_64
I__s_[S0:0][package]perl-base-5.8.8-76.2.x86_64
I__s_[S0:0][package]insserv-1.09.0-46.x86_64
}
NAME [EDITION [ARCH]]: postfix
Package: U__s_[S1:1][package]postfix-2.4.5-20.1.x86_64
depends on (15) {
I__s_[S0:0][package]openldap2-client-2.3.37-20.x86_64
I__s_[S0:0][package]insserv-1.09.0-46.x86_64
I__s_[S0:0][package]sed-4.1.5-64.x86_64
I__s_[S0:0][package]fillup-1.42-179.x86_64
I__s_[S0:0][package]coreutils-6.9-43.x86_64
I__s_[S0:0][package]glibc-2.6.1-18.3.x86_64
I__s_[S0:0][package]libopenssl0_9_8-0.9.8e-45.5.x86_64
I__s_[S0:0][package]pcre-7.2-14.2.x86_64
I__s_[S0:0][package]libdb-4_5-4.5.20-29.x86_64
I__s_[S0:0][package]cyrus-sasl-2.1.22-82.x86_64
I__s_[S0:0][package]netcfg-10.3-39.noarch
I__s_[S0:0][package]bash-3.2-61.x86_64
I__s_[S0:0][package]grep-2.5.2-28.x86_64
I__s_[S0:0][package]pwdutils-3.1.4-27.x86_64
I__s_[S0:0][package]gawk-3.1.5g-25.x86_64
}
Compared to http://pastebin.ca/812178:
- I load all the repos AND the target system. This is necessary to process
installed packages and IMO gives a better result for available packages.
- In 'FindDependent' I get the interesting PoolItem via 'getPi'. You use
the PoolProxy class and get the selectable->candidateObj().
Even if the candidateObj's edition does not match the one you're looking
for, it might be that a package with a matching edition is in the
Selctable. 'getPi' tries a bit harder to find a package with your
edition.
- For solving I use 'setForceResolve( true )' to minimize the cases where
the solver fails. Otherwise sendmail in the example above would not
succeed, because it conflicts with my postfix installed.
And I don't solve installed items, which is ok provided the system is in
a consistent state. But one could as well solve in any case.
- Finaly zypp::forEachPoolItemMatchedBy extracts the dependent packages.
@ // TODO: Figure out how to determine whether a package is installed or not
- You usually have a PoolItem pi
- A PoolItem has a status: pi.status()
- The status tells (among other things) whether it is installed:
pi.status().isInstalled()
In your case: it->item.status().isInstalled()
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
#include <iostream>
#include <zypp/base/LogControl.h>
#include <zypp/base/LogTools.h>
#include <zypp/base/PtrTypes.h>
#include <zypp/base/Exception.h>
#include <zypp/base/IOStream.h>
#include <zypp/base/Easy.h>
#include "zypp/ZYppFactory.h"
#include "zypp/RepoManager.h"
#include "zypp/NameKindProxy.h"
#include "zypp/CapMatchHelper.h"
#include "zypp/ResPoolProxy.h"
#include "zypp/ResTraits.h"
#include "zypp/ResPool.h"
#include "zypp/Package.h"
#include "zypp/Dep.h"
using std::endl;
#define LOG std::cout
#define LER std::cout
#define LIN std::cin
///////////////////////////////////////////////////////////////////
// Load all enabled repos and the target.
void loadPool()
{
// Load all enabled repos
zypp::RepoManager repoManager;
zypp::RepoInfoList repos = repoManager.knownRepositories();
for ( zypp::RepoInfoList::iterator it = repos.begin(); it != repos.end();
++it )
{
zypp::RepoInfo & nrepo( *it );
if ( ! nrepo.enabled() )
continue;
LOG << "Loading repo " << nrepo << "..." << endl;
if ( ! repoManager.isCached( nrepo ) )
{
repoManager.refreshMetadata( nrepo );
repoManager.buildCache( nrepo );
}
zypp::getZYpp()->addResolvables( repoManager.createFromCache( nrepo
).resolvables() );
}
// Load installed resolvables.
LOG << "Loading target..." << endl;
zypp::getZYpp()->initializeTarget( "/" );
zypp::getZYpp()->addResolvables( zypp::getZYpp()->target()->resolvables(),
true );
}
///////////////////////////////////////////////////////////////////
// Functor returning true if PoolItem matches name-edition.arch
// Empty values are widcards.
struct MatchPi
{
MatchPi( const std::string & name_r,
const zypp::Edition & edition_r,
const zypp::Arch & arch_r )
: _name( name_r ), _edition( edition_r ), _arch( arch_r )
{}
bool operator()( const zypp::PoolItem & pi_r ) const
{
return( ( _name.empty() || _name == pi_r->name() )
&& ( _edition == zypp::Edition() || _edition == pi_r->edition() )
&& ( _arch == zypp::Arch("") || _arch == pi_r->arch() ) );
}
private:
std::string _name;
zypp::Edition _edition;
zypp::Arch _arch;
};
//////////////////////////////////////////////////////////////////
// Get the 1st matching PoolItem within an iterator range.
// Templating it is just convenience.
template<class _MatchFn, class _Iterator>
zypp::PoolItem findMatching( _Iterator begin_r, _Iterator end_r, _MatchFn
match_r )
{
_Iterator match( std::find_if( begin_r, end_r, match_r ) );
if ( match == end_r )
return zypp::PoolItem(); // not found
return *match;
}
///////////////////////////////////////////////////////////////////
// Get the best matching PoolItem.
template<class _Res>
zypp::PoolItem getPi( const std::string & name_r,
const zypp::Edition & edition_r,
const zypp::Arch & arch_r )
{
zypp::ResPool pool( zypp::getZYpp()->pool() );
zypp::NameKindProxy nkp( zypp::nameKindProxy<_Res>( pool, name_r ) );
// No need to match the name in MatchPi because nkp only contains
// items named name_r.
// If edidion is specified, we prefer an installed item.
if ( edition_r != zypp::Edition() || nkp.availableEmpty() )
{
zypp::PoolItem pi( findMatching( nkp.installedBegin(), nkp.installedEnd(),
MatchPi( std::string(), edition_r, arch_r
) ) );
if ( pi )
return pi;
}
return findMatching( nkp.availableBegin(), nkp.availableEnd(),
MatchPi( std::string(), edition_r, arch_r ) );
}
///////////////////////////////////////////////////////////////////
template<class _Res>
struct FindDependent
{
FindDependent( const std::string & name_r,
const zypp::Edition & edition_r,
const zypp::Arch & arch_r )
{
// look up the poolitem
_poolItem = getPi<_Res>( name_r, edition_r, arch_r );
if ( ! _poolItem )
throw _poolItem; // no such item in pool
// provided the system is consistent, we don't need to solve
// installed items.
if ( ! _poolItem.status().isInstalled() )
{
_poolItem.status().setTransact( true, zypp::ResStatus::USER );
zypp::getZYpp()->resolver()->setForceResolve( true );
bool res = zypp::getZYpp()->resolver()->resolvePool();
zypp::getZYpp()->resolver()->setForceResolve( false );
_poolItem.status().resetTransact( zypp::ResStatus::USER );
if ( ! res )
throw _poolItem; // solver failed
}
// Walk all items hit by requirements...
zypp::forEachPoolItemMatchedBy( zypp::getZYpp()->pool(), _poolItem,
zypp::Dep::REQUIRES,
zypp::OncePerPoolItem(
boost::bind( &FindDependent::collectIf,
this, _1 ),
_poolItem // skip item itself
) );
}
// ..process the hits.
bool collectIf( const zypp::PoolItem & pi_r )
{
// collect if:
// installed && !transact ==> stays installed
// !installed && transact ==> to be installed
if ( pi_r.status().isInstalled() != pi_r.status().transacts() )
_dependent.push_back( pi_r );
return true;
}
// The result:
zypp::PoolItem _poolItem;
std::list<zypp::PoolItem> _dependent;
};
///////////////////////////////////////////////////////////////////
int main( int argc, char **argv )
{
//zypp::base::LogControl::instance().logfile( "-" );
INT << "===[START]==========================================" << endl;
// load all enabled repos and target
LOG << "Preparing the pool..." << endl;
loadPool();
LOG << "Ready. (Ctrl-D to quit)" << endl;
while ( LIN.good() )
{
LOG << "NAME [EDITION [ARCH]]: " << std::flush;
std::string line( zypp::iostr::getline( LIN ) );
if ( line.size() <= 1 )
{
zypp::ResPoolProxy poolP( zypp::getZYpp()->poolProxy() );
for_( nit, poolP.byKindBegin<zypp::Package>(),
poolP.byKindEnd<zypp::Package>() )
{
if ( line.size() == 1 && line[0] != (*nit)->name()[0] )
continue;
LOG << (*nit)->name() << " ";
if ( (*nit)->installedPoolItem() )
LOG << "(I " << (*nit)->installedPoolItem()->edition() << ")";
if ( (*nit)->availableObjs() )
{
LOG << "(A";
for_( it, (*nit)->availablePoolItemBegin(),
(*nit)->availablePoolItemEnd() )
LOG << " " << (*it)->edition();
LOG << ")";
}
LOG << " ";
}
LOG << endl;
continue;
}
std::string name ( "" );
zypp::Edition edition( "" );
zypp::Arch arch ( "" );
std::vector<std::string> words;
zypp::str::split( line, std::back_inserter(words) );
switch ( words.size() )
{
case 3:
arch = zypp::Arch( words[2] );
case 2:
edition = zypp::Edition( words[1] );
case 1:
name = words[0];
}
try
{
// Here we go...
FindDependent<zypp::Package> deps( name, edition, arch );
LOG << " Package: " << deps._poolItem << endl;
LOG << " depends on (" << deps._dependent.size() << ") " <<
deps._dependent << endl;
}
catch ( zypp::PoolItem pi )
{
if ( ! pi )
LER << "***No package matching " << name << "-" << edition << "." <<
arch << endl;
else
LER << "***Cant resolve dependencies of " << pi << endl;
}
}
INT << "===[END]==========================================" << endl;
return 0;
}
///////////////////////////////////////////////////////////////////
//#include "QPool.moc"
///////////////////////////////////////////////////////////////////
[...]Please take a minute and review the following code:
http://pastebin.ca/812178
Is this what you had in mind? Isn't there an easier way to get this
information?
I noticed that this only works for packages that are not installed.
Is there a mechanism that would work for packages that are installed?
Attached a small test program. Maybe you want to give it a try and see
whether it matches your expectations. It computes 'dependent packages'
(whatever this exacly means) for both, installed and available packages.
'NAME [EDITION [ARCH]]:' is a prompt. Enter a name and it looks for the
best available package. If you specify an edition, it will first look for
an installed one:
NAME [EDITION [ARCH]]: A
AdobeICCProfiles (I 2.0-74)(A 2.0-74.1 2.0-74 2.0-74)
NAME [EDITION [ARCH]]: AdobeICCProfiles
Package: U__s_[S1:1][package]AdobeICCProfiles-2.0-74.1.noarch
depends on (0) {}
NAME [EDITION [ARCH]]: AdobeICCProfiles 2.0-74
Package: I_TsU[S0:0][package]AdobeICCProfiles-2.0-74.noarch
depends on (0) {}
U__s_.. - U means uninstalled
I_TsU.. - I means installed
A more exiting ;=O example:
NAME [EDITION [ARCH]]: sendmail
Package: U__s_[S1:1][package]sendmail-8.14.1-53.1.x86_64
depends on (16) {
I__s_[S0:0][package]filesystem-10.3-50.x86_64
I__s_[S0:0][package]sed-4.1.5-64.x86_64
I__s_[S0:0][package]fillup-1.42-179.x86_64
I__s_[S0:0][package]coreutils-6.9-43.x86_64
I__s_[S0:0][package]glibc-2.6.1-18.3.x86_64
I__s_[S0:0][package]libopenssl0_9_8-0.9.8e-45.5.x86_64
I__s_[S0:0][package]libdb-4_5-4.5.20-29.x86_64
I__s_[S0:0][package]openldap2-client-2.3.37-20.x86_64
I__s_[S0:0][package]cyrus-sasl-2.1.22-82.x86_64
I__s_[S0:0][package]tcpd-7.6-791.x86_64
I__s_[S0:0][package]m4-1.4.10-17.x86_64
I__s_[S0:0][package]netcfg-10.3-39.noarch
I__s_[S0:0][package]procmail-3.22-139.x86_64
I__s_[S0:0][package]bash-3.2-61.x86_64
I__s_[S0:0][package]perl-base-5.8.8-76.2.x86_64
I__s_[S0:0][package]insserv-1.09.0-46.x86_64
}
NAME [EDITION [ARCH]]: postfix
Package: U__s_[S1:1][package]postfix-2.4.5-20.1.x86_64
depends on (15) {
I__s_[S0:0][package]openldap2-client-2.3.37-20.x86_64
I__s_[S0:0][package]insserv-1.09.0-46.x86_64
I__s_[S0:0][package]sed-4.1.5-64.x86_64
I__s_[S0:0][package]fillup-1.42-179.x86_64
I__s_[S0:0][package]coreutils-6.9-43.x86_64
I__s_[S0:0][package]glibc-2.6.1-18.3.x86_64
I__s_[S0:0][package]libopenssl0_9_8-0.9.8e-45.5.x86_64
I__s_[S0:0][package]pcre-7.2-14.2.x86_64
I__s_[S0:0][package]libdb-4_5-4.5.20-29.x86_64
I__s_[S0:0][package]cyrus-sasl-2.1.22-82.x86_64
I__s_[S0:0][package]netcfg-10.3-39.noarch
I__s_[S0:0][package]bash-3.2-61.x86_64
I__s_[S0:0][package]grep-2.5.2-28.x86_64
I__s_[S0:0][package]pwdutils-3.1.4-27.x86_64
I__s_[S0:0][package]gawk-3.1.5g-25.x86_64
}
Compared to http://pastebin.ca/812178:
- I load all the repos AND the target system. This is necessary to process
installed packages and IMO gives a better result for available packages.
- In 'FindDependent' I get the interesting PoolItem via 'getPi'. You use
the PoolProxy class and get the selectable->candidateObj().
Even if the candidateObj's edition does not match the one you're looking
for, it might be that a package with a matching edition is in the
Selctable. 'getPi' tries a bit harder to find a package with your
edition.
- For solving I use 'setForceResolve( true )' to minimize the cases where
the solver fails. Otherwise sendmail in the example above would not
succeed, because it conflicts with my postfix installed.
And I don't solve installed items, which is ok provided the system is in
a consistent state. But one could as well solve in any case.
- Finaly zypp::forEachPoolItemMatchedBy extracts the dependent packages.
@ // TODO: Figure out how to determine whether a package is installed or not
- You usually have a PoolItem pi
- A PoolItem has a status: pi.status()
- The status tells (among other things) whether it is installed:
pi.status().isInstalled()
In your case: it->item.status().isInstalled()
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
#include <iostream>
#include <zypp/base/LogControl.h>
#include <zypp/base/LogTools.h>
#include <zypp/base/PtrTypes.h>
#include <zypp/base/Exception.h>
#include <zypp/base/IOStream.h>
#include <zypp/base/Easy.h>
#include "zypp/ZYppFactory.h"
#include "zypp/RepoManager.h"
#include "zypp/NameKindProxy.h"
#include "zypp/CapMatchHelper.h"
#include "zypp/ResPoolProxy.h"
#include "zypp/ResTraits.h"
#include "zypp/ResPool.h"
#include "zypp/Package.h"
#include "zypp/Dep.h"
using std::endl;
#define LOG std::cout
#define LER std::cout
#define LIN std::cin
///////////////////////////////////////////////////////////////////
// Load all enabled repos and the target.
void loadPool()
{
// Load all enabled repos
zypp::RepoManager repoManager;
zypp::RepoInfoList repos = repoManager.knownRepositories();
for ( zypp::RepoInfoList::iterator it = repos.begin(); it != repos.end();
++it )
{
zypp::RepoInfo & nrepo( *it );
if ( ! nrepo.enabled() )
continue;
LOG << "Loading repo " << nrepo << "..." << endl;
if ( ! repoManager.isCached( nrepo ) )
{
repoManager.refreshMetadata( nrepo );
repoManager.buildCache( nrepo );
}
zypp::getZYpp()->addResolvables( repoManager.createFromCache( nrepo
).resolvables() );
}
// Load installed resolvables.
LOG << "Loading target..." << endl;
zypp::getZYpp()->initializeTarget( "/" );
zypp::getZYpp()->addResolvables( zypp::getZYpp()->target()->resolvables(),
true );
}
///////////////////////////////////////////////////////////////////
// Functor returning true if PoolItem matches name-edition.arch
// Empty values are widcards.
struct MatchPi
{
MatchPi( const std::string & name_r,
const zypp::Edition & edition_r,
const zypp::Arch & arch_r )
: _name( name_r ), _edition( edition_r ), _arch( arch_r )
{}
bool operator()( const zypp::PoolItem & pi_r ) const
{
return( ( _name.empty() || _name == pi_r->name() )
&& ( _edition == zypp::Edition() || _edition == pi_r->edition() )
&& ( _arch == zypp::Arch("") || _arch == pi_r->arch() ) );
}
private:
std::string _name;
zypp::Edition _edition;
zypp::Arch _arch;
};
//////////////////////////////////////////////////////////////////
// Get the 1st matching PoolItem within an iterator range.
// Templating it is just convenience.
template<class _MatchFn, class _Iterator>
zypp::PoolItem findMatching( _Iterator begin_r, _Iterator end_r, _MatchFn
match_r )
{
_Iterator match( std::find_if( begin_r, end_r, match_r ) );
if ( match == end_r )
return zypp::PoolItem(); // not found
return *match;
}
///////////////////////////////////////////////////////////////////
// Get the best matching PoolItem.
template<class _Res>
zypp::PoolItem getPi( const std::string & name_r,
const zypp::Edition & edition_r,
const zypp::Arch & arch_r )
{
zypp::ResPool pool( zypp::getZYpp()->pool() );
zypp::NameKindProxy nkp( zypp::nameKindProxy<_Res>( pool, name_r ) );
// No need to match the name in MatchPi because nkp only contains
// items named name_r.
// If edidion is specified, we prefer an installed item.
if ( edition_r != zypp::Edition() || nkp.availableEmpty() )
{
zypp::PoolItem pi( findMatching( nkp.installedBegin(), nkp.installedEnd(),
MatchPi( std::string(), edition_r, arch_r
) ) );
if ( pi )
return pi;
}
return findMatching( nkp.availableBegin(), nkp.availableEnd(),
MatchPi( std::string(), edition_r, arch_r ) );
}
///////////////////////////////////////////////////////////////////
template<class _Res>
struct FindDependent
{
FindDependent( const std::string & name_r,
const zypp::Edition & edition_r,
const zypp::Arch & arch_r )
{
// look up the poolitem
_poolItem = getPi<_Res>( name_r, edition_r, arch_r );
if ( ! _poolItem )
throw _poolItem; // no such item in pool
// provided the system is consistent, we don't need to solve
// installed items.
if ( ! _poolItem.status().isInstalled() )
{
_poolItem.status().setTransact( true, zypp::ResStatus::USER );
zypp::getZYpp()->resolver()->setForceResolve( true );
bool res = zypp::getZYpp()->resolver()->resolvePool();
zypp::getZYpp()->resolver()->setForceResolve( false );
_poolItem.status().resetTransact( zypp::ResStatus::USER );
if ( ! res )
throw _poolItem; // solver failed
}
// Walk all items hit by requirements...
zypp::forEachPoolItemMatchedBy( zypp::getZYpp()->pool(), _poolItem,
zypp::Dep::REQUIRES,
zypp::OncePerPoolItem(
boost::bind( &FindDependent::collectIf,
this, _1 ),
_poolItem // skip item itself
) );
}
// ..process the hits.
bool collectIf( const zypp::PoolItem & pi_r )
{
// collect if:
// installed && !transact ==> stays installed
// !installed && transact ==> to be installed
if ( pi_r.status().isInstalled() != pi_r.status().transacts() )
_dependent.push_back( pi_r );
return true;
}
// The result:
zypp::PoolItem _poolItem;
std::list<zypp::PoolItem> _dependent;
};
///////////////////////////////////////////////////////////////////
int main( int argc, char **argv )
{
//zypp::base::LogControl::instance().logfile( "-" );
INT << "===[START]==========================================" << endl;
// load all enabled repos and target
LOG << "Preparing the pool..." << endl;
loadPool();
LOG << "Ready. (Ctrl-D to quit)" << endl;
while ( LIN.good() )
{
LOG << "NAME [EDITION [ARCH]]: " << std::flush;
std::string line( zypp::iostr::getline( LIN ) );
if ( line.size() <= 1 )
{
zypp::ResPoolProxy poolP( zypp::getZYpp()->poolProxy() );
for_( nit, poolP.byKindBegin<zypp::Package>(),
poolP.byKindEnd<zypp::Package>() )
{
if ( line.size() == 1 && line[0] != (*nit)->name()[0] )
continue;
LOG << (*nit)->name() << " ";
if ( (*nit)->installedPoolItem() )
LOG << "(I " << (*nit)->installedPoolItem()->edition() << ")";
if ( (*nit)->availableObjs() )
{
LOG << "(A";
for_( it, (*nit)->availablePoolItemBegin(),
(*nit)->availablePoolItemEnd() )
LOG << " " << (*it)->edition();
LOG << ")";
}
LOG << " ";
}
LOG << endl;
continue;
}
std::string name ( "" );
zypp::Edition edition( "" );
zypp::Arch arch ( "" );
std::vector<std::string> words;
zypp::str::split( line, std::back_inserter(words) );
switch ( words.size() )
{
case 3:
arch = zypp::Arch( words[2] );
case 2:
edition = zypp::Edition( words[1] );
case 1:
name = words[0];
}
try
{
// Here we go...
FindDependent<zypp::Package> deps( name, edition, arch );
LOG << " Package: " << deps._poolItem << endl;
LOG << " depends on (" << deps._dependent.size() << ") " <<
deps._dependent << endl;
}
catch ( zypp::PoolItem pi )
{
if ( ! pi )
LER << "***No package matching " << name << "-" << edition << "." <<
arch << endl;
else
LER << "***Cant resolve dependencies of " << pi << endl;
}
}
INT << "===[END]==========================================" << endl;
return 0;
}
///////////////////////////////////////////////////////////////////
//#include "QPool.moc"
///////////////////////////////////////////////////////////////////
| < Previous | Next > |