#include "Tools.h"
#include <zypp/PoolQuery.h>
+#include <zypp/target/rpm/librpmDb.h>
///////////////////////////////////////////////////////////////////
//static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" );
static const Pathname sysRoot( "/tmp/Local/ma/DNL-test" );
+//static const Pathname sysRoot( "/" );
///////////////////////////////////////////////////////////////////
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;
INT << "===[START]==========================================" << endl;
ZConfig::instance();
TestSetup::LoadSystemAt( sysRoot );
+ getZYpp()->initializeTarget( sysRoot );
///////////////////////////////////////////////////////////////////
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );
USR << "pool: " << pool << endl;
///////////////////////////////////////////////////////////////////
+ if ( 1 )
+ {
+ getZYpp()->resolver()->addRequire( Capability("emacs") );
+ solve();
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+ }
+
- getZYpp()->resolver()->addRequire( Capability("xteddy") );
- solve();
- vdumpPoolStats( USR << "Transacting:"<< endl,
- make_filter_begin<resfilter::ByTransact>(pool),
- make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+ {
+ ZYppCommitPolicy policy;
+ policy.dryRun( true );
+ policy.downloadMode( DownloadOnly );
+
+ USR << policy << endl;
+ ZYppCommitResult result( getZYpp()->commit( policy ) );
+ USR << result << endl;
+ }
///////////////////////////////////////////////////////////////////
#include "Tools.h"
+#include <zypp/ResPool.h>
+#include <zypp/ResObjects.h>
#include <zypp/PoolQuery.h>
+#include <zypp/misc/CheckAccessDeleted.h>
+
///////////////////////////////////////////////////////////////////
-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() );
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();