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"
39 static Locks _instance;
45 template <
typename TPredicate>
48 LockSet::iterator first = lockset_r.begin();
49 LockSet::iterator last = lockset_r.end();
50 while ( first != last )
52 LockSet::iterator next = first;
54 if ( pred_r( *first ) )
55 lockset_r.erase( first );
122 DBG <<
"lock "<< item.name();
131 template <
class OutputIterator>
150 MIL <<
"read and apply locks from "<<file << endl;
151 PathInfo pinfo(file);
152 if ( pinfo.isExist() )
159 MIL <<
"file does not exist(or cannot be stat), no lock added." << endl;
165 MIL <<
"read locks from "<<file << endl;
166 PathInfo pinfo(file);
167 if ( pinfo.isExist() )
170 MIL <<
"file does not exist(or cannot be stat), no lock added." << endl;
176 DBG <<
"apply locks" << endl;
183 MIL <<
"add new lock" << endl;
191 DBG <<
"query removed from toRemove" << endl;
195 DBG <<
"query added as new" << endl;
218 DBG <<
"add lock by identifier" << endl;
224 MIL <<
"remove lock" << endl;
233 DBG <<
"query removed from added" << endl;
237 DBG <<
"need to remove some old lock" << endl;
260 DBG <<
"remove lock by Selectable" << endl;
302 switch (
report->execute(q))
313 INT <<
"Unexpected return value from callback. Need to adapt switch statement." << std::endl;
323 MIL <<
"clean of locks" << endl;
333 MIL <<
"cleaning aborted" << endl;
357 bool intersect =
false;
360 if ( s.find(*it)!=s.end() )
370 return intersect ? 1 : 0;
384 DBG <<
"identical queries" << endl;
402 MIL <<
"find conflict: " << cs << endl;
403 switch (
report->conflict(q,cs))
407 DBG <<
"abort merging" << endl;
410 DBG <<
"force delete" << endl;
413 DBG <<
"skip lock" << endl;
416 INT <<
"Unexpected return value from callback. Need to adapt switch statement." << std::endl;
425 MIL <<
"merge list old: " <<
locks().size()
426 <<
" to add: " <<
toAdd.size() <<
"to remove: " <<
toRemove.size() << endl;
429 std::set<sat::Solvable> s(it->begin(),it->end());
433 if (!report->progress())
458 DBG <<
"locks merged" << endl;
468 DBG <<
"nothing changed in locks - no write to file" << endl;