12 #include <boost/function.hpp>
13 #include <boost/function_output_iterator.hpp>
27 #undef ZYPP_BASE_LOGGER_LOGGROUP
28 #define ZYPP_BASE_LOGGER_LOGGROUP "locks"
34 using namespace zypp::str;
41 static Locks _instance;
58 Locks::Locks() : _pimpl(new
Impl){}
89 template <
class OutputIterator>
108 MIL <<
"read and apply locks from "<<file << endl;
109 PathInfo pinfo(file);
110 if ( pinfo.isExist() )
118 MIL <<
"file not exist(or cannot be stat), no lock added." << endl;
124 MIL <<
"read locks from "<<file << endl;
125 PathInfo pinfo(file);
126 if ( pinfo.isExist() )
130 MIL <<
"file not exist(or cannot be stat), no lock added." << endl;
136 DBG <<
"apply locks" << endl;
143 MIL <<
"add new lock" << endl;
153 DBG <<
"query removed from toRemove" << endl;
158 DBG <<
"query added as new" << endl;
181 DBG <<
"add lock by identifier" << endl;
187 MIL <<
"remove lock" << endl;
198 DBG <<
"query removed from added" << endl;
203 DBG <<
"needed remove some old lock" << endl;
227 DBG <<
"remove lock by selectactable" << endl;
269 switch (
report->execute(q))
280 WAR <<
"Unknown returned value. Callback have more value then"
281 <<
" this switch. Need correct handle all enum values." << std::endl;
291 MIL <<
"cleaning of locks" << endl;
301 MIL <<
"cleaning aborted" << endl;
325 bool intersect =
false;
328 if ( s.find(*it)!=s.end() )
338 return intersect ? 1 : 0;
352 DBG <<
"identical queries" << endl;
370 MIL <<
"find conflict: " << cs << endl;
371 switch (
report->conflict(q,cs))
375 DBG <<
"abort merging" << endl;
378 DBG <<
"force delete" << endl;
381 DBG <<
"skip lock" << endl;
384 WAR <<
"should not reached, some state is missing" << endl;
393 MIL <<
"merging list old: " <<
locks.size()
394 <<
" to add: " <<
toAdd.size() <<
"to remove: " <<
toRemove.size() << endl;
397 std::set<sat::Solvable> s(it->begin(),it->end());
401 if (!report->progress())
407 locks.push_back( *it );
430 DBG <<
"locks merged" << endl;
440 DBG <<
"nothing changed in locks - no write to file" << endl;