From: Michael Andres Date: Fri, 7 Aug 2009 10:28:18 +0000 (+0200) Subject: backup X-Git-Tag: 6.13.3~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98f1bec57a8a79f0c3eac51aeb4510678c1938e6;p=platform%2Fupstream%2Flibzypp.git backup --- diff --git a/devel/devel.ma/Main.cc b/devel/devel.ma/Main.cc index 55c0f42..8443087 100644 --- a/devel/devel.ma/Main.cc +++ b/devel/devel.ma/Main.cc @@ -1,11 +1,13 @@ #include "Tools.h" #include +#include /////////////////////////////////////////////////////////////////// //static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); static const Pathname sysRoot( "/tmp/Local/ma/DNL-test" ); +//static const Pathname sysRoot( "/" ); /////////////////////////////////////////////////////////////////// @@ -14,17 +16,45 @@ bool solve() bool rres = false; { //zypp::base::LogControl::TmpLineWriter shutUp; - //rres = test.resolver().resolvePool(); + rres = getZYpp()->resolver()->resolvePool(); } if ( ! rres ) { ERR << "resolve " << rres << endl; + getZYpp()->resolver()->problems(); return false; } MIL << "resolve " << rres << endl; return true; } +bool upgrade() +{ + bool rres = false; + { + //zypp::base::LogControl::TmpLineWriter shutUp; + Measure x( "Upgrade" ); + rres = getZYpp()->resolver()->doUpgrade(); + } + if ( ! rres ) + { + Measure x( "Upgrade Error" ); + ERR << "upgrade " << rres << endl; + getZYpp()->resolver()->problems(); + return false; + } + MIL << "upgrade " << rres << endl; + return true; +} + +namespace zypp +{ + namespace target + { + void writeUpgradeTestcase(); + } +} + int main( int argc, char * argv[] ) try { --argc; @@ -33,6 +63,7 @@ try { INT << "===[START]==========================================" << endl; ZConfig::instance(); TestSetup::LoadSystemAt( sysRoot ); + getZYpp()->initializeTarget( sysRoot ); /////////////////////////////////////////////////////////////////// ResPool pool( ResPool::instance() ); sat::Pool satpool( sat::Pool::instance() ); @@ -41,12 +72,25 @@ try { USR << "pool: " << pool << endl; /////////////////////////////////////////////////////////////////// + if ( 1 ) + { + getZYpp()->resolver()->addRequire( Capability("emacs") ); + solve(); + vdumpPoolStats( USR << "Transacting:"<< endl, + make_filter_begin(pool), + make_filter_end(pool) ) << endl; + } + - getZYpp()->resolver()->addRequire( Capability("xteddy") ); - solve(); - vdumpPoolStats( USR << "Transacting:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; + { + ZYppCommitPolicy policy; + policy.dryRun( true ); + policy.downloadMode( DownloadOnly ); + + USR << policy << endl; + ZYppCommitResult result( getZYpp()->commit( policy ) ); + USR << result << endl; + } /////////////////////////////////////////////////////////////////// diff --git a/devel/devel.ma/main.cc b/devel/devel.ma/main.cc index 28bddb7..948d73f 100644 --- a/devel/devel.ma/main.cc +++ b/devel/devel.ma/main.cc @@ -1,37 +1,31 @@ #include "Tools.h" +#include +#include #include +#include + /////////////////////////////////////////////////////////////////// -static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); +Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); /////////////////////////////////////////////////////////////////// -bool solve() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - //rres = test.resolver().resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - return false; - } - MIL << "resolve " << rres << endl; - return true; -} - int main( int argc, char * argv[] ) try { --argc; ++argv; zypp::base::LogControl::instance().logToStdErr(); INT << "===[START]==========================================" << endl; + if ( argc ) + { + unsetenv("SYSROOT"); + sysRoot = Pathname(*argv); + setenv( "ZYPP_CONF", (sysRoot/"etc/zypp.conf").c_str(), true ); + } ZConfig::instance(); - TestSetup::LoadSystemAt( sysRoot ); + //TestSetup::LoadSystemAt( sysRoot ); /////////////////////////////////////////////////////////////////// ResPool pool( ResPool::instance() ); sat::Pool satpool( sat::Pool::instance() ); @@ -40,46 +34,16 @@ try { USR << "pool: " << pool << endl; /////////////////////////////////////////////////////////////////// - if ( 1 ) - { - Measure x("-"); - sat::LookupAttr q( sat::SolvAttr::updateReference ); - for_( res, q.begin(), q.end() ) - { - MIL << res << endl; - } - } - - if ( 0 ) { - Measure( "x" ); - - PoolQuery q; - q.setMatchSubstring(); - q.setCaseSensitive( false ); - q.addAttribute( sat::SolvAttr::updateReference ); - - 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; - } - } - } - } + Measure x("x"); + CheckAccessDeleted checker; + USR << checker << endl; } - + SEC << CheckAccessDeleted::findService( "syslog" ) << endl; + SEC << CheckAccessDeleted::findService( "syslogd" ) << endl; + SEC << CheckAccessDeleted::findService( "ssh" ) << endl; + SEC << CheckAccessDeleted::findService( "sshd" ) << endl; + SEC << CheckAccessDeleted::findService( 3844 ) << endl; /////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; zypp::base::LogControl::instance().logNothing();