From d7106e597490fe8f4a132abf04b296038dc19be7 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 7 Jul 2009 13:53:07 +0200 Subject: [PATCH] backup --- devel/devel.ma/NewPool.cc | 122 +++++++++++++++++++++++++++------------------- devel/devel.ma/main.cc | 69 ++++++++++++++++++++------ tools/NameReqPrv.cc | 4 +- 3 files changed, 127 insertions(+), 68 deletions(-) diff --git a/devel/devel.ma/NewPool.cc b/devel/devel.ma/NewPool.cc index 603a08a..3ebf937 100644 --- a/devel/devel.ma/NewPool.cc +++ b/devel/devel.ma/NewPool.cc @@ -30,7 +30,7 @@ #include "zypp/RepoManager.h" #include "zypp/Repository.h" #include "zypp/RepoInfo.h" - +#include "zypp/TriBool.h" #include "zypp/repo/PackageProvider.h" #include "zypp/ResPoolProxy.h" @@ -453,7 +453,7 @@ void diffquery( const Lcont & l, const Rcont & r ) INT << rs << endl; } -bool querycompare( const PoolQuery & q ) +bool querycompare( const PoolQuery & q, bool verbose = true ) { q.begin(); SEC << q << endl; @@ -464,13 +464,16 @@ bool querycompare( const PoolQuery & q ) for_( it, q.begin(), q.end() ) { ++nc; - //DBG << it << endl; + if ( verbose ) + DBG << it << endl; } - MIL << nc << endl; + SEC << "--> MATCHES: " << nc << endl; } return true; } +#include "zypp/MediaProducts.h" + /****************************************************************** ** ** FUNCTION NAME : main @@ -478,12 +481,15 @@ bool querycompare( const PoolQuery & q ) */ int main( int argc, char * argv[] ) try { - --argc; - ++argv; + --argc,++argv; zypp::base::LogControl::instance().logToStdErr(); INT << "===[START]==========================================" << endl; ZConfig::instance(); + USR << ZConfig::instance().rpmInstallFlags() << endl; + + return 0; + ResPool pool( ResPool::instance() ); sat::Pool satpool( sat::Pool::instance() ); @@ -592,54 +598,70 @@ try { /////////////////////////////////////////////////////////////////// - Match m( Match::GLOB ); - SEC << m << endl; - SEC << Match::REGEX << endl; - - m = Match::GLOB; - SEC << m << endl; - m = Match::NOTHING - | Match::GLOB; - SEC << m << endl; - m = Match::GLOB - | Match::STRING; - SEC << m << endl; - m = Match::FILES - | Match::NOTHING; - SEC << m << endl; - m = Match::FILES - Match::STRING; - SEC << m << endl; - - SEC << (Match::FILES==Match::NOTHING) << endl; - SEC << (Match::FILES!=Match::NOTHING) << endl; - - /////////////////////////////////////////////////////////////////// - - std::string search("devel"); - - PoolQuery q; - //querycompare( q ); - - q.addString(search); - //q.addAttribute(sat::SolvAttr::name, "augeas" ); - //q.addAttribute(sat::SolvAttr::name ); - q.addAttribute(sat::SolvAttr::summary); - q.setMatchSubstring(); - //q.setMatchExact(); - q.setCaseSensitive( false ); - - //q.addRepo( "11.1-update" ); - //q.addRepo( "@System" ); + { + PoolQuery q; + q.setCaseSensitive( false ); + q.setMatchSubstring(); + q.addString( "xteddy" ); + q.addDependency( sat::SolvAttr::provides, "libzypp", Rel::EQ, Edition("4.2.6") ); + q.addDependency( sat::SolvAttr::name, "zypper", Rel::LE, Edition("4.2.6") ); + //q.addDependency( sat::SolvAttr::name, Capability("kernel-default") ); + q.addKind( ResKind::package ); + querycompare( q ); + } + ////////////////////////////////////////////////////////////////// + INT << "===[END]============================================" << endl << endl; + zypp::base::LogControl::instance().logNothing(); + return 0; - //q.addKind( ResKind::package ); - //q.addKind( ResKind::pattern ); - //q.addKind( ResKind::patch ); + { + PoolQuery q; + q.setCaseSensitive( false ); + q.setMatchSubstring(); + q.addAttribute( sat::SolvAttr::provides, "libzypp" ); + q.addKind( ResKind::package ); + querycompare( q, false ); + + q.setMatchExact(); + querycompare( q, false ); + + q.addString( "xteddy" ); + querycompare( q, false ); + } + { + PoolQuery q; + q.setCaseSensitive( false ); + q.setMatchExact(); + q.addKind( ResKind::package ); - //q.setEdition( Edition("1.0"), Rel::GE ); + q.addAttribute( sat::SolvAttr::provides, "xteddy" ); + querycompare( q, false ); + } - q.setMatchFiles(); + { + PoolQuery q; + q.setCaseSensitive( false ); + q.setMatchSubstring(); + q.addDependency( sat::SolvAttr::provides, "libzypp" ); + q.addKind( ResKind::package ); + querycompare( q, false ); + + q.setMatchExact(); + querycompare( q, false ); + + q.addString( "xteddy" ); + querycompare( q, false ); + } + { + PoolQuery q; + q.setCaseSensitive( false ); + q.setMatchExact(); + q.addKind( ResKind::package ); + + q.addDependency( sat::SolvAttr::provides, "xteddy" ); + querycompare( q, false ); + } - querycompare( q ); #if 0 getZYpp()->resolver()->addRequire( Capability("amarok") ); diff --git a/devel/devel.ma/main.cc b/devel/devel.ma/main.cc index 9e85f45..28bddb7 100644 --- a/devel/devel.ma/main.cc +++ b/devel/devel.ma/main.cc @@ -1,14 +1,19 @@ #include "Tools.h" -#include "zypp/pool/GetResolvablesToInsDel.h" -static TestSetup test( Arch_x86_64 ); // use x86_64 as system arch +#include + +/////////////////////////////////////////////////////////////////// + +static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); + +/////////////////////////////////////////////////////////////////// bool solve() { bool rres = false; { //zypp::base::LogControl::TmpLineWriter shutUp; - rres = test.resolver().resolvePool(); + //rres = test.resolver().resolvePool(); } if ( ! rres ) { @@ -25,23 +30,55 @@ try { ++argv; zypp::base::LogControl::instance().logToStdErr(); INT << "===[START]==========================================" << endl; + ZConfig::instance(); + TestSetup::LoadSystemAt( sysRoot ); + /////////////////////////////////////////////////////////////////// + ResPool pool( ResPool::instance() ); + sat::Pool satpool( sat::Pool::instance() ); + /////////////////////////////////////////////////////////////////// + dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ) << endl; + USR << "pool: " << pool << endl; + /////////////////////////////////////////////////////////////////// - test.loadTarget(); // initialize and load target - test.loadRepo( Url("iso:/?iso=/mounts/dist/install/openSUSE-11.1-Beta2-DONTUSE/kiwi.out.dvd-i586.iso") ); + if ( 1 ) + { + Measure x("-"); + sat::LookupAttr q( sat::SolvAttr::updateReference ); + for_( res, q.begin(), q.end() ) + { + MIL << res << endl; + } + } - ResPool pool( test.pool() ); - Resolver & resolver( test.resolver() ); + if ( 0 ) + { + Measure( "x" ); - resolver.addRequire( Capability("glibc") ); - resolver.addRequire( Capability("zlib") ); - resolver.addRequire( Capability("lsb-buildenv") ); - solve(); - vdumpPoolStats( USR << "Transacting:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; + PoolQuery q; + q.setMatchSubstring(); + q.setCaseSensitive( false ); + q.addAttribute( sat::SolvAttr::updateReference ); - pool::GetResolvablesToInsDel collect( pool, pool::GetResolvablesToInsDel::ORDER_BY_MEDIANR ); - MIL << "GetResolvablesToInsDel:" << endl << collect << endl; + for_( it, q.begin(), q.end() ) + { + // for each matching patch + MIL << *it << endl; + + if ( 0 ) + { + for_( d, it.matchesBegin(), it.matchesEnd() ) + { + // for each matching updateReferenceId in that patch: + DBG << " - " << d->inSolvAttr() << "\t\"" << d->asString() << "\" has type \"" + << d->subFind( sat::SolvAttr::updateReferenceType ).asString() << "\"" << endl; + for_( s, d->subBegin(), d->subEnd() ) + { + DBG << " -" << s.inSolvAttr() << "\t\"" << s.asString() << "\"" << endl; + } + } + } + } + } /////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; diff --git a/tools/NameReqPrv.cc b/tools/NameReqPrv.cc index 3329ba2..dc3fdaa 100644 --- a/tools/NameReqPrv.cc +++ b/tools/NameReqPrv.cc @@ -32,7 +32,7 @@ int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) cerr << " denotes a sover testcase, the testcase is loaded." << endl; cerr << " -i/-I turn on/off case insensitive search (default on)" << endl; cerr << " -n/-N turn on/off looking for names (default on)" << endl; - cerr << " -p/-P turn on/off looking for provides (default off)" << endl; + cerr << " -p/-P turn on/off looking for provides (default on)" << endl; cerr << " -r/-R turn on/off looking for requires (default off)" << endl; cerr << " -a short for -n -p -r" << endl; cerr << " -A short for -n -P -R" << endl; @@ -137,7 +137,7 @@ int main( int argc, char * argv[] ) bool ignorecase( true ); bool names ( true ); - bool provides ( false ); + bool provides ( true ); bool requires ( false ); for ( ; argc; --argc,++argv ) -- 2.7.4