2 #include <zypp/ResObjects.h>
4 #include <zypp/sat/LookupAttr.h>
5 #include <zypp/PoolQuery.h>
6 #include <zypp/ZYppCallbacks.h>
8 struct IRR : public zypp::callback::ReceiveReport<zypp::target::rpm::InstallResolvableReport>
14 ABORT, // abort and return error
16 IGNORE // ignore the failure
21 NOT_FOUND, // the requested Url was not found
23 INVALID // th resolvable is invalid
26 // the level of RPM pushing
27 /** \deprecated We fortunately no longer do 3 attempts. */
35 virtual void reportbegin()
37 virtual void reportend()
40 virtual void start(Resolvable::constPtr /*resolvable*/)
43 virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
48 INT << "return abort" << endl;
54 virtual Action problem(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*description*/, RpmLevel /*level*/)
56 INT << "return abort" << endl;
60 virtual void finish(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*reason*/, RpmLevel /*level*/)
64 struct RRR : public zypp::callback::ReceiveReport<zypp::target::rpm::RemoveResolvableReport>
70 ABORT, // abort and return error
72 IGNORE // ignore the failure
77 NOT_FOUND, // the requested Url was not found
79 INVALID // th resolvable is invalid
83 virtual void reportbegin()
85 virtual void reportend()
88 virtual void start( Resolvable::constPtr /*resolvable*/ )
91 virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
92 { INT << endl; return true; }
94 virtual Action problem( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*description*/ )
95 { INT << endl; return ABORT; }
97 virtual void finish( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*reason*/ )
103 static unsigned run = 0;
104 USR << "Solve " << run++ << endl;
107 zypp::base::LogControl::TmpLineWriter shutUp;
108 rres = getZYpp()->resolver()->resolvePool();
112 ERR << "resolve " << rres << endl;
113 getZYpp()->resolver()->problems();
121 ZYppCommitPolicy pol;
123 pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) );
124 SEC << "START commit..." << endl;
125 SEC << getZYpp()->commit( pol ) << endl;
129 /******************************************************************
131 ** FUNCTION NAME : main
132 ** FUNCTION TYPE : int
134 int main( int argc, char * argv[] )
136 INT << "===[START]==========================================" << endl;
139 Pathname mroot( "/tmp/ToolScanRepos" );
140 TestSetup test( mroot, Arch_i586 );
144 ResPool pool( test.pool() );
145 ui::Selectable::Ptr sel;
147 getSel<Package>( "rpm" )->setToInstall();
148 vdumpPoolStats( USR << "Selected:"<< endl,
149 make_filter_begin<resfilter::ByTransact>(pool),
150 make_filter_end<resfilter::ByTransact>(pool) ) << endl;
154 vdumpPoolStats( USR << "Solved:"<< endl,
155 make_filter_begin<resfilter::ByTransact>(pool),
156 make_filter_end<resfilter::ByTransact>(pool) ) << endl;
161 INT << "===[END]============================================" << endl << endl;