#include <zypp/ResObjects.h>
#include <zypp/sat/LookupAttr.h>
+#include <zypp/PoolQuery.h>
- static std::string pidAndAppname()
+static std::string pidAndAppname()
+{
+ static std::string _val;
+ if ( _val.empty() )
{
- static std::string _val;
- if ( _val.empty() )
- {
- pid_t mypid = getpid();
- Pathname p( "/proc/"+str::numstring(mypid)+"/exe" );
- Pathname myname( filesystem::readlink( p ) );
+ pid_t mypid = getpid();
+ Pathname p( "/proc/"+str::numstring(mypid)+"/exe" );
+ Pathname myname( filesystem::readlink( p ) );
- _val += str::numstring(mypid);
- _val += ":";
- _val += myname.basename();
- }
- return _val;
+ _val += str::numstring(mypid);
+ _val += ":";
+ _val += myname.basename();
+ }
+ return _val;
+}
+
+bool solve()
+{
+ static unsigned run = 0;
+ USR << "Solve " << run++ << endl;
+ bool rres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ rres = getZYpp()->resolver()->resolvePool();
+ }
+ if ( ! rres )
+ {
+ ERR << "resolve " << rres << endl;
+ getZYpp()->resolver()->problems();
+ return false;
}
+ return true;
+}
+
+typedef sat::ArrayAttr<std::string,std::string> FileList;
+
/******************************************************************
**
** FUNCTION NAME : main
{
INT << "===[START]==========================================" << endl;
- SEC << pidAndAppname() << endl;
-
-
- INT << "===[END]============================================" << endl << endl;
- return 0;
- Pathname mroot( "/tmp/Bb" );
+ Pathname mroot( "/tmp/ToolScanRepos" );
TestSetup test( mroot, Arch_x86_64 );
- test.loadRepo( "/Local/ROOT/cache/raw/11.1-update" );
- test.loadRepo( "/Local/ROOT/cache/raw/11.0-update" );
+ test.loadRepo("/Local/ROOT/cache/solv/@System/solv");
- sat::Pool satpool( test.satpool() );
- for_( it, satpool.reposBegin(), satpool.reposEnd() )
+ ResPool pool( test.pool() );
+ {
+ Measure x("filelist");
+ unsigned p = 0;
+ unsigned f = 0;
+ std::string a;
+ for_( it, pool.byKindBegin<Package>(), pool.byKindEnd<Package>() )
+ {
+ ++p;
+ f += (*it)->asKind<Package>()->filelist().size();
+ for_( i, (*it)->asKind<Package>()->filelist().begin(), (*it)->asKind<Package>()->filelist().end() )
+ a = *i;
+ }
+ SEC << p << " : " << f << endl;
+ }
{
- MIL << *it << endl;
- DBG << it->generatedTimestamp() << endl;
- DBG << it->suggestedExpirationTimestamp() << endl;
+ Measure x("filenames");
+ unsigned p = 0;
+ unsigned f = 0;
+ std::string a;
+ for_( it, pool.byKindBegin<Package>(), pool.byKindEnd<Package>() )
+ {
+ ++p;
+ std::list<std::string> l( (*it)->asKind<Package>()->filenames() );
+ f += l.size();
+ for_( i, l.begin(), l.end() )
+ a = *i;
+ }
+ SEC << p << " : " << f << endl;
}
INT << "===[END]============================================" << endl << endl;
return 0;
- sat::LookupRepoAttr q( sat::SolvAttr::repositoryAddedFileProvides );
- USR << q << endl;
- USR << dump(q) << endl;
- for_( it, q.begin(), q.end() )
- {
- MIL << it << endl;
- }
+ //ui::Selectable::Ptr getSel( const std::string & name_r )
+ getSel<Package>( "gcompris" )->setToInstall();
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+
+ if ( solve() )
+ {
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+ SEC << getSel<Package>( "librsvg" ) << endl;
+ }
INT << "===[END]============================================" << endl << endl;
return 0;
}
public:
typedef sat::ArrayAttr<PackageKeyword,IdString> Keywords;
+ typedef sat::ArrayAttr<std::string,std::string> FileList;
public:
/**
* Returns the level of supportability the vendor
* gives to this package.
- *
+ *
* This is one value from \ref VendorSupportOption
*/
VendorSupportOption vendorSupport() const;
ByteCount sourcesize() const;
/** */
std::list<std::string> authors() const;
- /** */
- std::list<std::string> filenames() const;
+
+ /** Return the packages filelist (if available).
+ * The returned \ref FileList appears to be a container of
+ * \c std::string. In fact it is a query, so it does not
+ * consume much memory.
+ */
+ FileList filelist() const;
+ /** \deprecated Use filelist, it's faster and saves memeory. */
+ std::list<std::string> filenames() const ZYPP_DEPRECATED;
/** Name of the source rpm this package was built from.
*/