* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
+#include <sstream>
#include "zypp/solver/detail/Helper.h"
-
#include "zypp/Capabilities.h"
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
return info.is_best;
}
+std::string
+Helper::itemToString (PoolItem_Ref item, bool shortVersion)
+{
+ ostringstream os;
+ if (!item) return "";
+
+ if (item->kind() != ResTraits<zypp::Package>::kind)
+ os << item->kind() << ':';
+ os << item->name();
+ if (!shortVersion) {
+ os << '-' << item->edition();
+ if (item->arch() != "") {
+ os << '.' << item->arch();
+ }
+ Repository s = item->repository();
+ if (s) {
+ string alias = s.info().alias();
+ if (!alias.empty()
+ && alias != "@system")
+ {
+ os << '[' << s.info().alias() << ']';
+ }
+ }
+ }
+ return os.str();
+}
+
+std::string
+Helper::capToString (const Capability & capability)
+{
+ ostringstream os;
+ os << capability.asString();
+ return os.str();
+}
+
///////////////////////////////////////////////////////////////////
};// namespace detail
#include "zypp/ResPool.h"
#include "zypp/PoolItem.h"
#include "zypp/Capabilities.h"
-
+#include "zypp/base/String.h"
#include "zypp/solver/detail/Types.h"
/////////////////////////////////////////////////////////////////////////
// for item, check if this is the 'best' uninstalled (best arch, best version) item
static bool isBestUninstalledItem (const ResPool & pool, PoolItem_Ref item);
+ // Human readable item
+ static std::string itemToString (PoolItem_Ref item, bool shortVersion=false);
+ static std::string capToString (const Capability & capability);
+
friend std::ostream& operator<<(std::ostream&, const PoolItemList & itemlist);
};
#include "zypp/base/Gettext.h"
#include "zypp/solver/detail/ProblemSolutionCombi.h"
-#include "zypp/solver/detail/ResolverInfo.h"
using namespace std;
#include "zypp/base/Gettext.h"
#include "zypp/base/Logger.h"
#include "zypp/solver/detail/ProblemSolutionIgnore.h"
+#include "zypp/solver/detail/Helper.h"
using namespace std;
item->name().c_str());
// TranslatorExplanation %s = name of package, patch, selection ...
_details = str::form(_("%s provides this dependency, but would change the architecture of the installed item"),
- ResolverInfo::toString (item).c_str());
+ Helper::itemToString (item).c_str());
addAction ( new InjectSolutionAction (item, ARCHITECTURE));
}
item->name().c_str());
// TranslatorExplanation %s = name of package, patch, selection ...
_details = str::form(_("%s provides this dependency, but would change the vendor of the installed item"),
- ResolverInfo::toString (item).c_str());
+ Helper::itemToString (item).c_str());
addAction ( new InjectSolutionAction (item, VENDOR));
}
{
// TranslatorExplanation %s = name of package, patch, selection ...
_description = str::form (_("Ignore the obsolete %s in %s"),
- ResolverInfo::toString (capability).c_str(),
+ Helper::capToString (capability).c_str(),
otherItem->name().c_str());
addAction (new InjectSolutionAction (item, capability, OBSOLETES, otherItem));
}
#include "zypp/base/Gettext.h"
#include "zypp/solver/detail/ProblemSolutionInstall.h"
-#include "zypp/solver/detail/ResolverInfo.h"
+#include "zypp/solver/detail/Helper.h"
using namespace std;
// TranslatorExplanation %s = name of package, patch, selection ...
_description = str::form (_("install %s"), item->name().c_str() );
// TranslatorExplanation %s = name of package, patch, selection ...
- _details = str::form (_("install %s"), ResolverInfo::toString (item).c_str());
+ _details = str::form (_("install %s"), Helper::itemToString (item).c_str());
addAction ( new TransactionSolutionAction (item,
INSTALL));
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
#include "zypp/solver/detail/ProblemSolutionKeep.h"
-#include "zypp/solver/detail/ResolverInfo.h"
+#include "zypp/solver/detail/Helper.h"
using namespace std;
// TranslatorExplanation %s = name of package, patch, selection ...
_description = str::form (_("keep %s"), item->name().c_str() );
// TranslatorExplanation %s = name of package, patch, selection ...
- _details = str::form (_("keep %s"), ResolverInfo::toString (item).c_str());
+ _details = str::form (_("keep %s"), Helper::itemToString (item).c_str());
addAction ( new TransactionSolutionAction (item,
KEEP));
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
#include "zypp/solver/detail/ProblemSolutionUninstall.h"
-#include "zypp/solver/detail/ResolverInfo.h"
+#include "zypp/solver/detail/Helper.h"
using namespace std;
// TranslatorExplanation %s = name of package, patch, selection ...
_description = str::form (_("delete %s"), item->name().c_str() );
// TranslatorExplanation %s = name of package, patch, selection ...
- _details = str::form (_("delete %s"), ResolverInfo::toString (item).c_str());
+ _details = str::form (_("delete %s"), Helper::itemToString (item).c_str());
} else {
// TranslatorExplanation %s = name of package, patch, selection ...
_description = str::form (_("do not install %s"), item->name().c_str() );
// TranslatorExplanation %s = name of package, patch, selection ...
- _details = str::form (_("do not install %s"), ResolverInfo::toString (item).c_str());
+ _details = str::form (_("do not install %s"), Helper::itemToString (item).c_str());
}
addAction ( new TransactionSolutionAction (item, REMOVE));
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
#include "zypp/CapFilters.h"
-#include "zypp/ZYppFactory.h"
-#include "zypp/SystemResObject.h"
-#include "zypp/solver/detail/ResolverInfoNeededBy.h"
-#include "zypp/capability/FilesystemCap.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/Solvable.h"
#include "zypp/sat/SATResolver.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace zypp_detail
- { /////////////////////////////////////////////////////////////////
- Arch defaultArchitecture();
- /////////////////////////////////////////////////////////////////
- } // namespace zypp_detail
- ///////////////////////////////////////////////////////////////////
-
///////////////////////////////////////////////////////////////////////
namespace solver
{ /////////////////////////////////////////////////////////////////////
IMPL_PTR_TYPE(Resolver);
-static const unsigned MAX_SECOND_RUNS( 3 );
-static const unsigned MAX_VALID_SOLUTIONS( 10 );
-static const unsigned TIMOUT_SECOND_RUN( 30 );
-
-static PoolItemSet triggeredSolution; // only the latest state of an item is interesting
- // for the pool. Documents already inserted items.
//---------------------------------------------------------------------------
-class compare_items {
-public:
- int operator() (PoolItem_Ref p1,
- PoolItem_Ref p2) const
- { return compareByNVRA(p1.resolvable(),p2.resolvable()) < 0; }
-};
-
std::ostream &
Resolver::dumpOn( std::ostream & os ) const
return os << "<resolver/>";
}
-// Generating a system resolvable in the pool in order to trigger
-// modaliases and hals
-void assertSystemResObjectInPool()
-{
- ResPool pool( getZYpp()->pool() );
- if ( pool.byKindBegin<SystemResObject>()
- == pool.byKindEnd<SystemResObject>() )
- {
- // SystemResObject is missing in the pool ==> insert
- ResStore store;
- store.insert( SystemResObject::instance() );
- getZYpp()->addResolvables( store, true ); // true = is installed
- }
-
- // set lock
- if ( ! pool.byKindBegin<SystemResObject>()
- ->status().setLock( true, ResStatus::USER ) )
- {
- WAR << "Unable to set SystemResObject to lock" << endl;
- }
-}
//---------------------------------------------------------------------------
: _pool (pool)
, _satResolver (NULL)
, _poolchanged( _pool.serial() )
- , _timeout_seconds (0)
- , _maxSolverPasses (0)
- , _verifying (false)
- , _testing (false)
- , _tryAllPossibilities (false)
- , _valid_solution_count (0)
- , _best_context (NULL)
- , _establish_context (NULL)
- , _timed_out (false)
- , _architecture( zypp_detail::defaultArchitecture() )
, _forceResolve (false)
- , _upgradeMode (false)
- , _preferHighestVersion (true)
{
}
void
-Resolver::reset (bool resetValidResults, bool keepExtras )
+Resolver::reset (bool keepExtras )
{
- _verifying = false;
-
- _initial_items.clear();
-
- _items_to_install.clear();
- _items_to_remove.clear();
_items_to_verify.clear();
- _items_to_establish.clear();
- _items_to_keep.clear();
if (!keepExtras) {
- _extra_caps.clear();
+ _extra_requires.clear();
_extra_conflicts.clear();
}
-
- _pending_queues.clear();
- _pruned_queues.clear();
- _complete_queues.clear();
- _deferred_queues.clear();
- _invalid_queues.clear();
-
- _valid_solution_count = 0;
-
- _best_context = NULL;
- _timed_out = false;
-
- _isInstalledBy.clear();
- _installs.clear();
-
- if (resetValidResults)
- contextPool.reset();
-
-}
-
-//--------------------------------------------------------------------------------------------------
-// Get more information about the solverrun
-// Which item will be installed by another item or triggers an item for installation
-typedef struct {
- ItemCapKindMap isInstalledBy;
- ItemCapKindMap installs;
-} Collector;
-
-
-static void
-collector_cb_needed (ResolverInfo_Ptr info, void *data)
-{
- Collector *collector = (Collector *)data;
- if (info->type() == RESOLVER_INFO_TYPE_NEEDED_BY) {
- ResolverInfoNeededBy_constPtr needed_by = dynamic_pointer_cast<const ResolverInfoNeededBy>(info);
- if (needed_by->items().size() >= 1) {
- PoolItem_Ref item = info->affected();
- PoolItemList itemList = needed_by->items();
-
- for (PoolItemList::const_iterator iter = itemList.begin();
- iter != itemList.end(); iter++) {
- bool found = false;
- ItemCapKindMap::const_iterator pos = collector->isInstalledBy.find(item);
- while (pos != collector->isInstalledBy.end()
- && pos->first == item
- && !found) {
- ItemCapKind capKind = pos->second;
- if (capKind.item == *iter) found = true;
- pos++;
- }
- if (!found) {
- ItemCapKind capKind( *iter, needed_by->capability(), needed_by->capKind(), needed_by->initialInstallation() );
- collector->isInstalledBy.insert (make_pair( item, capKind));
- }
- found = false;
- pos = collector->installs.find (*iter);
- while (pos != collector->installs.end()
- && pos->first == *iter
- && !found) {
- ItemCapKind capKind = pos->second;
- if (capKind.item == item) found = true;
- pos++;
- }
- if (!found) {
- ItemCapKind capKindReverse( item, needed_by->capability(), needed_by->capKind(), needed_by->initialInstallation() );
- collector->installs.insert (make_pair( *iter, capKindReverse));
- }
- }
-
- }
- }
-}
-
-void
-Resolver::collectResolverInfo(void)
-{
- ResolverContext_Ptr collectContext = context(); // best context or failed context
- if ( collectContext != NULL
- && _isInstalledBy.empty()
- && _installs.empty()) {
- Collector collector;
- collectContext->foreachInfo (PoolItem(), RESOLVER_INFO_PRIORITY_VERBOSE, collector_cb_needed, &collector, false); // do not merge information
- _isInstalledBy = collector.isInstalledBy;
- _installs = collector.installs;
- }
-}
-
-
-const ItemCapKindList Resolver::isInstalledBy (const PoolItem_Ref item) {
- ItemCapKindList ret;
- collectResolverInfo();
-
- for (ItemCapKindMap::const_iterator iter = _isInstalledBy.find(item); iter != _isInstalledBy.end();) {
- ItemCapKind info = iter->second;
- PoolItem_Ref iterItem = iter->first;
- if (iterItem == item) {
- ret.push_back(info);
- iter++;
- } else {
- // exit
- iter = _isInstalledBy.end();
- }
- }
- return ret;
-}
-
-const ItemCapKindList Resolver::installs (const PoolItem_Ref item) {
- ItemCapKindList ret;
- collectResolverInfo();
-
- for (ItemCapKindMap::const_iterator iter = _installs.find(item); iter != _installs.end();) {
- ItemCapKind info = iter->second;
- PoolItem_Ref iterItem = iter->first;
- if (iterItem == item) {
- ret.push_back(info);
- iter++;
- } else {
- // exit
- iter = _installs.end();
- }
- }
- return ret;
-}
-
-
-//----------------------------------------------------------------------------------------------------
-ResolverContext_Ptr
-Resolver::context (void) const
-{
- if (_best_context) return _best_context;
- if (_invalid_queues.empty()) return NULL;
- ResolverQueue_Ptr invalid = _invalid_queues.front();
- return invalid->context();
-}
-
-void Resolver::dumpTaskList(const PoolItemList &install, const PoolItemList &remove )
-{
- for (PoolItemList::const_iterator iter = install.begin();
- iter != install.end(); iter++) {
- XXX << " to_install " << *iter << endl;
- }
- for (PoolItemList::const_iterator iter = remove.begin();
- iter != remove.end(); iter++) {
- XXX << " to_remove " << *iter << endl;
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-void
-Resolver::addSubscribedSource (Repository repo)
-{
- _subscribed.insert(repo);
-}
-
-void
-Resolver::addPoolItemToInstall (PoolItem_Ref item)
-{
- bool found = false;
- for (PoolItemList::const_iterator iter = _items_to_remove.begin();
- iter != _items_to_remove.end(); iter++) {
- if (*iter == item) {
- _items_to_remove.remove(*iter);
- found = true;
- break;
- }
- }
- if (!found) {
- _items_to_install.push_back (item);
- _items_to_install.unique ();
- }
-}
-
-
-void
-Resolver::addPoolItemsToInstallFromList (PoolItemList & rl)
-{
- for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addPoolItemToInstall (*iter);
- }
-}
-
-
-void
-Resolver::addPoolItemToRemove (PoolItem_Ref item)
-{
- bool found = false;
- for (PoolItemList::const_iterator iter = _items_to_install.begin();
- iter != _items_to_install.end(); iter++) {
- if (*iter == item) {
- _items_to_install.remove(*iter);
- found = true;
- break;
- }
- }
- if (!found) {
- _items_to_remove.push_back (item);
- _items_to_remove.unique ();
- }
-}
-
-
-void
-Resolver::addPoolItemsToRemoveFromList (PoolItemList & rl)
-{
- for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addPoolItemToRemove (*iter);
- }
-}
-
-void
-Resolver::addPoolItemToLockUninstalled (PoolItem_Ref item)
-{
- _items_to_lockUninstalled.push_back (item);
- _items_to_lockUninstalled.unique ();
-}
-
-void
-Resolver::addPoolItemToKepp (PoolItem_Ref item)
-{
- _items_to_keep.push_back (item);
- _items_to_keep.unique ();
-}
-
-void
-Resolver::addPoolItemToEstablish (PoolItem_Ref item)
-{
- _items_to_establish.push_back (item);
-}
-
-
-void
-Resolver::addPoolItemsToEstablishFromList (PoolItemList & rl)
-{
- for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addPoolItemToEstablish (*iter);
- }
}
void
Resolver::addPoolItemToVerify (PoolItem_Ref item)
{
-#if 0
- /** Order PoolItems based on name and edition only. */
- struct {
- /** 'less then' based on name and edition */
- bool operator()( PoolItem_Ref lhs, PoolItem_Ref rhs ) const
- {
- int res = lhs->name().compare( rhs->name() );
- if ( res )
- return res == -1; // lhs < rhs ?
- // here: lhs == rhs, so compare edition:
- return lhs->edition() < rhs->edition();
- }
- } order;
-#endif
_items_to_verify.push_back (item);
-
-#warning Should order by name (and probably edition since with zypp we could have multiple editions installed in parallel)
-// _items_to_verify.sort (order); //(GCompareFunc) rc_item_compare_name);
}
void
-Resolver::addExtraCapability (const Capability & capability)
+Resolver::addExtraRequires (const Capability & capability)
{
- _extra_caps.insert (capability);
+ _extra_requires.insert (capability);
}
void
-Resolver::removeExtraCapability (const Capability & capability)
+Resolver::removeExtraRequires (const Capability & capability)
{
- _extra_caps.erase (capability);
+ _extra_requires.erase (capability);
}
-
void
Resolver::addExtraConflict (const Capability & capability)
{
_extra_conflicts.insert (capability);
}
-
void
Resolver::removeExtraConflict (const Capability & capability)
{
_extra_conflicts.erase (capability);
}
-
void
Resolver::addIgnoreConflict (const PoolItem_Ref item,
const Capability & capability)
_ignoreConflicts.insert(make_pair(item, capability));
}
-
void
Resolver::addIgnoreRequires (const PoolItem_Ref item,
const Capability & capability)
};
bool
-Resolver::verifySystem (bool considerNewHardware)
+Resolver::verifySystem ()
{
UndoTransact resetting (ResStatus::APPL_HIGH);
- _DEBUG ("Resolver::verifySystem() " << (considerNewHardware ? "consider new hardware":""));
+ _DEBUG ("Resolver::verifySystem() ");
invokeOnEach ( _pool.begin(), _pool.end(),
resfilter::ByTransact( ), // Resetting all transcations
resfilter::ByInstalled ( ),
functor::functorRef<bool,PoolItem>(info) );
-
- _verifying = true;
-
- bool success = false;
-
- if (considerNewHardware) {
- // evaluate all Freshens/Supplements and solve
- success = freshenPool(false) && bestContext() && bestContext()->isValid();
- }
- else {
- success = resolveDependencies (); // do solve only
- }
+// FIXME setting verify mode
+#if 0
+ bool success = resolveDependencies (); // do solve only
DoTransact setting (ResStatus::APPL_HIGH);
invokeOnEach ( _pool.begin(), _pool.end(),
resfilter::ByTransact( ),
functor::functorRef<bool,PoolItem>(setting) );
-
- return success;
-}
-
-
-//---------------------------------------------------------------------------
-
-// copy marked item from solution back to pool
-// if data != NULL, set as APPL_LOW (from establishPool())
-
-static void
-solution_to_pool (PoolItem_Ref item, const ResStatus & status, void *data)
-{
- if (triggeredSolution.find(item) != triggeredSolution.end()) {
- _XDEBUG("solution_to_pool(" << item << ") is already in the pool --> skip");
- return;
- }
-
- triggeredSolution.insert(item);
-
- // resetting transaction only
- item.status().resetTransact((data != NULL) ? ResStatus::APPL_LOW : ResStatus::SOLVER );
-
- bool r;
-
- if (status.isToBeInstalled()) {
- r = item.status().setToBeInstalled( (data != NULL) ? ResStatus::APPL_LOW : ResStatus::SOLVER );
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") install !" << r);
- }
- else if (status.isToBeUninstalledDueToUpgrade()) {
- r = item.status().setToBeUninstalledDueToUpgrade( (data != NULL) ? ResStatus::APPL_LOW : ResStatus::SOLVER );
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") upgrade !" << r);
- }
- else if (status.isToBeUninstalled()) {
- r = item.status().setToBeUninstalled( (data != NULL) ? ResStatus::APPL_LOW : ResStatus::SOLVER );
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") remove !" << r);
- }
- else if (status.isIncomplete()
- || status.isNeeded()) {
- r = item.status().setIncomplete();
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") incomplete !" << r);
- }
- else if (status.isUnneeded()) {
- r = item.status().setUnneeded();
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") unneeded !" << r);
- }
- else if (status.isSatisfied()) {
- r = item.status().setSatisfied();
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") satisfied !" << r);
- } else {
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") unchanged !");
- }
- return;
-}
-
-
-//---------------------------------------------------------------------------
-// establish state
-
-struct EstablishState
-{
- Resolver & resolver;
-
- EstablishState (Resolver & r)
- : resolver (r)
- { }
-
- bool operator()( PoolItem_Ref provider )
- {
- resolver.addPoolItemToEstablish (provider);
- return true;
- }
-};
-
-
-void
-Resolver::establishState( ResolverContext_Ptr context )
-{
- _DEBUG( "Resolver::establishState ()" );
- typedef list<Resolvable::Kind> KindList;
- static KindList ordered;
- if (ordered.empty()) {
- ordered.push_back (ResTraits<zypp::Atom>::kind);
- ordered.push_back (ResTraits<zypp::Message>::kind);
- ordered.push_back (ResTraits<zypp::Script>::kind);
- ordered.push_back (ResTraits<zypp::Patch>::kind);
- ordered.push_back (ResTraits<zypp::Pattern>::kind);
- ordered.push_back (ResTraits<zypp::Product>::kind);
- }
-
- if (context == NULL)
- context = new ResolverContext(_pool, _architecture);
-
- context->setEstablishing (true);
- context->setIgnoreCababilities (_ignoreConflicts,
- _ignoreRequires,
- _ignoreObsoletes,
- _ignoreInstalledItem,
- _ignoreArchitectureItem,
- _ignoreVendorItem);
- context->setForceResolve( _forceResolve );
- context->setEstablishContext( _establish_context );
- context->setPreferHighestVersion ( _preferHighestVersion );
- context->setUpgradeMode( _upgradeMode );
-
- for (KindList::const_iterator iter = ordered.begin(); iter != ordered.end(); iter++) {
- const Resolvable::Kind kind = *iter;
-
- _XDEBUG( "establishing state for kind " << kind.asString() );
-
- //world()->foreachResItemByKind (kind, trial_establish_cb, this);
-
- EstablishState info (*this);
-
- invokeOnEach( pool().byKindBegin( kind ),
- pool().byKindEnd( kind ),
- functor::functorRef<bool,PoolItem>(info) );
-
- // process the queue
- resolveDependencies( context );
- reset( false, true ); //resetValidResults,keepExtras
- }
-
- context->setEstablishing (false);
-
- _best_context = context;
- _establish_context = context;
-
- return;
-}
-
-
-bool
-Resolver::establishPool ()
-{
- MIL << "Resolver::establishPool()" << endl;
-
- establishState (); // establish !
- ResolverContext_Ptr solution = bestContext();
-
- if (solution) { // copy solution back to pool
- triggeredSolution.clear();
- solution->foreachMarked (solution_to_pool, (void *)1); // as APPL_LOW
- }
- else {
- ERR << "establishState did not return a bestContext" << endl;
- return false;
- }
-
- return true;
-}
-
-
-//---------------------------------------------------------------------------
-// freshen state
-
-typedef map<string, PoolItem_Ref> FreshenMap;
-
-// add item to itemmap
-// check for item with same name and only keep
-// best architecture, best version
-
-static void
-addToFreshen( PoolItem_Ref item, FreshenMap & itemmap )
-{
- FreshenMap::iterator it = itemmap.find( item->name() );
- if (it != itemmap.end()) { // item with same name found
- int cmp = it->second->arch().compare( item->arch() );
- if (cmp < 0) { // new item has better arch
- it->second = item;
- }
- else if (cmp == 0) { // new item has equal arch
- if (it->second->edition().compare( item->edition() ) < 0) {
- it->second = item; // new item has better edition
- }
- }
- }
- else {
- itemmap[item->name()] = item;
- }
- return;
-}
-
-
-struct FreshenState
-{
- FreshenMap itemmap;
-
- FreshenState()
- { }
-
- bool operator()( PoolItem_Ref item)
- {
- Capabilities freshens( item->dep( Dep::FRESHENS ) );
- if (!freshens.empty()) {
- addToFreshen( item, itemmap );
- }
- else { // if no freshens, look at supplements
- // Also regarding supplements e.g. in order to recognize
- // modalias dependencies. Bug #163140
- Capabilities supplements( item->dep( Dep::SUPPLEMENTS ) );
- if (!supplements.empty()) {
- addToFreshen( item, itemmap );
- }
- }
- return true;
- }
-};
-
-
-void
-Resolver::freshenState( ResolverContext_Ptr context,
- bool resetAfterSolve )
-{
- _DEBUG( "Resolver::freshenState ()" );
-
- if (context == NULL)
- context = new ResolverContext( _pool, _architecture );
-
- context->setEstablishing( true );
- context->setIgnoreCababilities( _ignoreConflicts,
- _ignoreRequires,
- _ignoreObsoletes,
- _ignoreInstalledItem,
- _ignoreArchitectureItem,
- _ignoreVendorItem);
- context->setForceResolve( _forceResolve );
- context->setEstablishContext( _establish_context );
- context->setPreferHighestVersion( _preferHighestVersion );
- context->setUpgradeMode( _upgradeMode );
-
- FreshenState info;
-
- // collect items to be established
-
- invokeOnEach( pool().byKindBegin( ResTraits<zypp::Package>::kind ),
- pool().byKindEnd( ResTraits<zypp::Package>::kind ),
- functor::functorRef<bool,PoolItem>(info) );
-
- // schedule all collected items for establish
-
- for (FreshenMap::iterator it = info.itemmap.begin(); it != info.itemmap.end(); ++it) {
- addPoolItemToEstablish( it->second );
- }
-
- // process the queue
- resolveDependencies( context );
-
- if (resetAfterSolve) {
- reset( false, true ); //resetValidResults,keepExtras
- context->setEstablishing( false );
- _best_context = context;
- }
-
- return;
-}
-
-
-bool
-Resolver::freshenPool (bool resetAfterSolve)
-{
- MIL << "Resolver::freshenPool()" << endl;
-
- freshenState (NULL, resetAfterSolve); // establish all packages with freshens; (NULL)= no initial context
- ResolverContext_Ptr solution = bestContext();
-
- if (solution) { // copy solution back to pool
- triggeredSolution.clear();
- solution->foreachMarked (solution_to_pool, (void *)1); // as APPL_LOW
- }
- else {
- ERR << "freshenState did not return a bestContext" << endl;
- return false;
- }
-
- return true;
-}
-
-//---------------------------------------------------------------------------
-
-struct FileSystemEstablishItem
-{
- Resolver & resolver;
-
- FileSystemEstablishItem (Resolver & r)
- : resolver (r)
- { }
-
- // items with filecaps has to be evaluate again via establish
-
- bool operator()( const CapAndItem & cai )
- {
- _XDEBUG( "QueueItemInstall::FileSystemEstablishItem (" << cai.item << ", " << cai.cap << ")");
- resolver.addPoolItemToEstablish (cai.item);
- return true;
- }
-};
-
-
-
-bool
-Resolver::resolveDependencies (const ResolverContext_Ptr context)
-{
-
- time_t t_start, t_now;
-
- MIL << "Resolver::resolveDependencies()" << endl;
-
- _pending_queues.clear();
- _pruned_queues.clear();
- _complete_queues.clear();
- _deferred_queues.clear();
- _invalid_queues.clear();
- _valid_solution_count = 0;
- _best_context = NULL;
-
-#warning local items disabled
-#if 0
- bool have_local_items = false;
-
- /* Walk through are list of to-be-installed packages and see if any of them are local. */
-
- for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
- if ((*iter)->local()) {
- have_local_items = true;
- break;
- }
- }
-
- World_Ptr the_world = world();
- StoreWorld_Ptr local_world = NULL;
- MultiWorld_Ptr local_multiworld = NULL;
-
- Channel_Ptr local_channel = NULL;
-
- if (have_local_items) {
- local_multiworld = new MultiWorld();
- local_world = new StoreWorld();
-
- local_channel = new Channel ("", "Local ResItems", "@local", "");
-
- local_world->addChannel (local_channel);
-
- local_multiworld->addSubworld (local_world);
- local_multiworld->addSubworld (the_world);
-
- the_world = local_multiworld;
- }
-#endif
-
- // Checking if we have to make additional establish concerning filesystem capabilities
- FileSystemEstablishItem establish(*this);
- Dep dep( Dep::SUPPLEMENTS);
- invokeOnEach( pool().byCapabilityIndexBegin( "filesystem()", dep ), // begin()
- pool().byCapabilityIndexEnd( "filesystem()", dep ), // end()
- functor::functorRef<bool,CapAndItem>( establish ) );
-
- // create initial_queue
-
- ResolverQueue_Ptr initial_queue = new ResolverQueue(_pool, _architecture, context);
-
- // adding "external" provides, the the requirements will be ignored
- IgnoreMap ignoreRequires = _ignoreRequires;
- ResPool::AdditionalCapabilities additionalCapabilities = pool().additionaProvide();
- for (ResPool::AdditionalCapabilities::const_iterator it = additionalCapabilities.begin();
- it != additionalCapabilities.end(); it++) {
- Capabilities cset = it->second;
- for (Capabilities::const_iterator cit = cset.begin(); cit != cset.end(); ++cit) {
- ignoreRequires.insert(make_pair(PoolItem_Ref(), *cit));
- }
- }
-
- // Initialize all ignoring dependencies
- initial_queue->context()->setIgnoreCababilities (_ignoreConflicts,
- ignoreRequires,
- _ignoreObsoletes,
- _ignoreInstalledItem,
- _ignoreArchitectureItem,
- _ignoreVendorItem);
- initial_queue->context()->setForceResolve( _forceResolve );
- initial_queue->context()->setEstablishContext( _establish_context );
- initial_queue->context()->setPreferHighestVersion( _preferHighestVersion );
- initial_queue->context()->setUpgradeMode( _upgradeMode );
- initial_queue->context()->setTryAllPossibilities( _tryAllPossibilities );
-
- /* If this is a verify, we do a "soft resolution" */
-
- initial_queue->context()->setVerifying( _verifying );
-
- /* Add extra items. */
-
- for (QueueItemList::const_iterator iter = _initial_items.begin(); iter != _initial_items.end(); iter++) {
- initial_queue->addItem (*iter);
- }
-
- for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
- PoolItem_Ref r = *iter;
-
-#warning local items disabled
-#if 0
- /* Add local packages to our dummy channel. */
- if (r->local()) {
- assert (local_channel != NULL);
- ResItem_Ptr r1 = const_pointer_cast<ResItem>(r);
- r1->setChannel (local_channel);
- local_world->addPoolItem_Ref (r);
- }
#endif
- initial_queue->addPoolItemToInstall (r);
- }
-
- for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
- if (!_upgradeMode)
- initial_queue->addPoolItemToRemove (*iter, true /* remove-only mode */);
- else
- // Checking old dependencies for packages which will be updated.
- // E.g. foo provides a dependecy which foo-new does not provides anymore.
- // So check, if there is a packages installed which requires foo.
- // Testcase exercise-bug150844-test.xml
- // Testcase Bug156439-test.xml
- initial_queue->addPoolItemToRemove (*iter, false /* no remove-only mode */);
- }
-
- for (PoolItemList::const_iterator iter = _items_to_verify.begin(); iter != _items_to_verify.end(); iter++) {
- initial_queue->addPoolItemToVerify (*iter);
- }
-
- for (PoolItemList::const_iterator iter = _items_to_establish.begin(); iter != _items_to_establish.end(); iter++) {
- initial_queue->addPoolItemToEstablish (*iter);
- }
-
- for (Capabilities::const_iterator iter = _extra_caps.begin(); iter != _extra_caps.end(); iter++) {
- initial_queue->addExtraCapability (*iter);
- }
-
- // adding "external" requires
- additionalCapabilities = pool().additionalRequire();
- for (ResPool::AdditionalCapabilities::const_iterator it = additionalCapabilities.begin();
- it != additionalCapabilities.end(); it++) {
- Capabilities cset = it->second;
- for (Capabilities::const_iterator cit = cset.begin(); cit != cset.end(); ++cit) {
- initial_queue->addExtraCapability (*cit);
- }
- }
-
- for (Capabilities::const_iterator iter = _extra_conflicts.begin(); iter != _extra_conflicts.end(); iter++) {
- initial_queue->addExtraConflict (*iter);
- }
-
- // adding "external" conflicts
- additionalCapabilities = pool().additionaConflict();
- for (ResPool::AdditionalCapabilities::const_iterator it = additionalCapabilities.begin();
- it != additionalCapabilities.end(); it++) {
- Capabilities cset = it->second;
- for (Capabilities::const_iterator cit = cset.begin(); cit != cset.end(); ++cit) {
- initial_queue->addExtraConflict (*cit);
- }
- }
-
- // Adding System resolvable
- assertSystemResObjectInPool();
-
- _XDEBUG( "Initial Queue: [" << *initial_queue << "]" );
-
- if (initial_queue->isEmpty()) {
- INT << "Empty Queue, nothing to resolve" << endl;
- _best_context = context; // Taking old context
- return true;
- }
-
- _best_context = NULL;
-
- _pending_queues.push_front (initial_queue);
-
- time (&t_start);
-
- while (!_pending_queues.empty()) {
-
- _DEBUG( "Pend " << (long) _pending_queues.size()
- << " / Cmpl " << (long) _complete_queues.size()
- << " / Prun " << (long) _pruned_queues.size()
- << " / Defr " << (long) _deferred_queues.size()
- << " / Invl " << (long) _invalid_queues.size() );
-
- if (_timeout_seconds > 0) {
- time (&t_now);
- if (difftime (t_now, t_start) > _timeout_seconds) {
- _timed_out = true;
- MIL << "Timeout " << _timeout_seconds << " seconds reached"
- << " -> exit" << endl;
- break;
- }
- }
- if (_maxSolverPasses > 0) {
- if (_maxSolverPasses <= _complete_queues.size() +
- _pruned_queues.size() +
- _deferred_queues.size() +
- _invalid_queues.size()) {
- _timed_out = true;
- MIL << "Max solver runs ( " << _maxSolverPasses
- << " ) reached -> exit" << endl;
- break;
- }
- }
-
- if (_best_context != NULL
- && _complete_queues.size() >= MAX_VALID_SOLUTIONS) {
- MIL << "Max VALID solver runs ( " << MAX_VALID_SOLUTIONS
- << " ) reached -> exit" << endl;
- break;
- }
-
- ResolverQueue_Ptr queue = _pending_queues.front();
- _pending_queues.pop_front();
- ResolverContext_Ptr context = queue->context();
-
- queue->process();
-
- if (queue->isInvalid ()) {
-
- _XDEBUG( "Invalid Queue\n" );
- _invalid_queues.push_back(queue);
-
- } else if (queue->isEmpty ()) {
-
- _XDEBUG( "Empty Queue\n" );
-
- _complete_queues.push_back(queue);
-
- ++_valid_solution_count;
-
- /* Compare this solution to our previous favorite. In the case of a tie,
- the first solution wins --- yeah, I know this is lame, but it shouldn't
- be an issue too much of the time. */
-
- if (_best_context == NULL
- || _best_context->compare (context) < 0)
- {
- _best_context = context;
- }
-
- } else if (_best_context != NULL
- && _best_context->partialCompare (context) > 0) {
-
- /* If we aren't currently as good as our previous best complete solution,
- this solution gets pruned. */
-
- _XDEBUG( "PRUNED!" );
-
- _pruned_queues.push_back(queue);
-
- } else {
-
- /* If our queue is isn't empty and isn't invalid, that can only mean
- one thing: we are down to nothing but branches. */
-
- queue->splitFirstBranch (_pending_queues, _deferred_queues);
- }
-
- /* If we have run out of pending queues w/o finding any solutions,
- and if we have deferred queues, make the first deferred queue
- pending. */
-
- if (_pending_queues.empty()
- && _complete_queues.empty()
- && !_deferred_queues.empty()) {
- _pending_queues.push_back(_deferred_queues.front());
- }
- }
- _DEBUG("Pend " << (long) _pending_queues.size()
- << " / Cmpl " << (long) _complete_queues.size()
- << " / Prun " << (long) _pruned_queues.size()
- << " / Defr " << (long) _deferred_queues.size()
- << " / Invl " << (long) _invalid_queues.size() );
-
- return _best_context && _best_context->isValid();
+ return true; // FIXME success
}
return;
}
-//----------------------------------------------------------------------------
-// resolvePool
-
-struct CollectTransact : public resfilter::PoolItemFilterFunctor
-{
- Resolver & resolver;
-
- CollectTransact (Resolver & r)
- : resolver (r)
- { }
-
- bool operator()( PoolItem_Ref item ) // only transacts() items go here
- {
- ResStatus status = item.status();
- _XDEBUG( "CollectTransact(" << item << ")" );
- bool by_solver = (status.isBySolver() || status.isByApplLow());
-
- if (by_solver) {
- _XDEBUG("Resetting " << item );
- item.status().resetTransact( ResStatus::APPL_LOW );// clear any solver/establish transactions
- return true; // back out here, dont re-queue former solver result
- }
-
- if (status.isToBeInstalled()) {
- resolver.addPoolItemToInstall(item); // -> install!
- }
- if (status.isToBeUninstalled()) {
- resolver.addPoolItemToRemove(item); // -> remove !
- }
- if (status.isIncomplete()) { // incomplete (re-install needed)
- PoolItem_Ref reinstall = Helper::findReinstallItem (resolver.pool(), item);
- if (reinstall) {
- MIL << "Reinstall " << reinstall << " for incomplete " << item << endl;
- resolver.addPoolItemToInstall(reinstall); // -> install!
- }
- else {
- WAR << "Can't find " << item << " for re-installation" << endl;
- }
- }
-
- if (status.isLocked()
- && status.isUninstalled()) {
- // This item could be selected by solver in a former run. Now it
- // is locked. So we will have to evaluate a new solver run.
- resolver.addPoolItemToLockUninstalled (item);
- }
-
- if (status.isKept()
- && !by_solver) {
- // collecting all keep states
- resolver.addPoolItemToKepp (item);
- }
-
- return true;
- }
-};
-
-
-static void
-show_pool( ResPool pool )
-{
- int count = 1;
- static bool full_pool_shown = true;
-
- _XDEBUG( "---------------------------------------" );
- for (ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it, ++count) {
-
- if (!full_pool_shown // show item if not shown all before
- || it->status().transacts() // or transacts
- || it->status().isKept()
- || it->status().isLocked()
- || !it->status().isUndetermined()) // or established status
- {
- _XDEBUG( count << ": " << *it );
- }
- }
- _XDEBUG( "---------------------------------------" );
- full_pool_shown = true;
-}
-
-// This function loops over the pool and grabs
-// all item.status().transacts() and item.status().byUser()
-// It clears all previous bySolver() states also
-//
-// Every toBeInstalled is passed to zypp::solver:detail::Resolver.addPoolItemToInstall()
-// Every toBeUninstalled is passed to zypp::solver:detail::Resolver.addPoolItemToRemove()
-//
-// Then zypp::solver:detail::Resolver.resolveDependencies() is called.
-//
-// zypp::solver:detail::Resolver then returns a ResolverContext via bestContext() which
-// describes the best solution. If bestContext() is NULL, no solution was found.
-//
-// ResolverContext has a foreachMarked() iterator function which loops over all
-// items of the solutions. These must be written back to the pool.
-
bool
-Resolver::resolvePool( bool tryAllPossibilities )
+Resolver::resolvePool()
{
// Solving with the satsolver
- if ( getenv("ZYPP_SAT_SOLVER")) {
MIL << "-------------- Calling SAT Solver -------------------" << endl;
- if ( !_satResolver ) {
- // syncing with sat pool
+ if ( !_satResolver ) {
sat::Pool satPool( sat::Pool::instance() );
- _pool.satSync();
_satResolver = new SATResolver(_pool, satPool.get());
}
#if 0
MIL << "------SAT-Pool end------" << endl;
#endif
return _satResolver->resolvePool();
- }
-
- ResolverContext_Ptr saveContext = _best_context;
- CollectTransact info (*this);
-
- // cleanup before next run
- if ( _poolchanged.remember( _pool.serial() ) )
- {
- MIL << "pool has been CHANGED --> resetting solverresults" << endl;
- reset( true, true ); //resetValidResults,keepExtras
- } else {
- reset( false, true ); //resetValidResults,keepExtras
- }
-
- bool saveTryAllPossibilities = _tryAllPossibilities;
-
- if (tryAllPossibilities) {
- _tryAllPossibilities = tryAllPossibilities;
- }
-
- if (_tryAllPossibilities) {
- MIL << "================================================================"
- << endl;
- MIL << "Solver run with ALL possibilities"
- << endl;
- if (_maxSolverPasses <= 0)
- _maxSolverPasses = MAX_SECOND_RUNS;
- if (_timeout_seconds <= 0)
- _timeout_seconds = TIMOUT_SECOND_RUN;
-
- MIL << "But no longer than " << MAX_SECOND_RUNS << " runs or "
- << TIMOUT_SECOND_RUN << " seconds" << endl;
- MIL << "================================================================" << endl;
- }
-
-#if 1
-
- MIL << "Resolver::resolvePool()" << endl;
- _XDEBUG( "Pool before resolve" );
- show_pool( _pool );
-
-#endif
- invokeOnEach ( _pool.begin(), _pool.end(),
- resfilter::ByTransact( ), // collect transacts from Pool to resolver queue
- functor::functorRef<bool,PoolItem>(info) );
-
- invokeOnEach ( _pool.begin(), _pool.end(),
- resfilter::ByLock( ), // collect locks from Pool to resolver queue
- functor::functorRef<bool,PoolItem>(info) );
-
- invokeOnEach ( _pool.begin(), _pool.end(),
- resfilter::ByKeep( ), // collect keeps from Pool to resolver queue
- functor::functorRef<bool,PoolItem>(info) );
-
- // List of installing/removing items of the complete run (not regarding a recycled solver run)
- PoolItemList _completeItems_to_install = _items_to_install;
- PoolItemList _completeItems_to_remove = _items_to_remove;
- PoolItemList _completeItems_to_lockUninstalled = _items_to_lockUninstalled;
- PoolItemList _completeItems_to_keep = _items_to_keep;
-
- // We have to find a valid context in order to recycle it.
- saveContext = contextPool.findContext (_items_to_install, _items_to_remove, _items_to_lockUninstalled, _items_to_keep);
- // _items_to_install, _items_to_remove contains addition items which has been selected but are
- // not solved with that context. They will be solved now.
- // If we have not found any former fitting context, saveContext is NULL. So the solver
- // make a complete run
-
- if (saveContext != NULL) {
- // create a new context in order not overwriting the old
- saveContext = new ResolverContext (saveContext->pool(), saveContext->architecture(), saveContext);
- saveContext->setTryAllPossibilities( true );
- }
-
- bool have_solution = resolveDependencies (saveContext); // resolve !
-
- if (have_solution) { // copy solution back to pool
- MIL << "Have solution, copying back to pool" << endl;
- ResolverContext_Ptr solution = bestContext();
- triggeredSolution.clear();
- solution->foreachMarked (solution_to_pool, NULL);
-#if 1
- _XDEBUG( "Pool after resolve" );
- show_pool( _pool );
-#endif
- // insert best_context in ContextPool for further solver runs
- contextPool.addContext( solution,_completeItems_to_install, _completeItems_to_remove,
- _completeItems_to_lockUninstalled,
- _completeItems_to_keep);
-
- }
- else {
- MIL << "!!! Have NO solution !!!" << endl;
-#if 0 // It takes too much memory for logging. Do not use it !
- MIL << "!!! Have NO solution !!! Additional solver information:" << endl;
- int counter = 0;
- for (ResolverQueueList::iterator iter = _invalid_queues.begin();
- iter != _invalid_queues.end(); iter++) {
- counter++;
- MIL << "-----------------------------------------------------------------" << endl;
- MIL << counter++ << ". failed queue:" << endl;
- ResolverQueue_Ptr invalid = *iter;
- invalid->context()->spewInfo (); No additional information needed here
- MIL << *invalid->context() << endl;
- MIL << "-----------------------------------------------------------------" << endl;
- }
-#endif
- }
-
- if (tryAllPossibilities) {
- _tryAllPossibilities = saveTryAllPossibilities; // reset to old value
- }
-
- return have_solution;
}
-static void
-get_info_foreach_cb (ResolverInfo_Ptr info, void *data)
-{
- list<string> *stringList = (list<string> *)data;
- stringList->push_back (info->message());
-}
-
-
-// returns a string list of ResolverInfo of the LAST not valid solution
-std::list<std::string> Resolver::problemDescription( void ) const
-{
- list<string> retList;
- if (_invalid_queues.empty()) return retList;
- ResolverQueue_Ptr invalid = _invalid_queues.front();
- invalid->context()->foreachInfo (PoolItem_Ref(), -1, get_info_foreach_cb, (void *)&retList);;
- return retList;
-}
-
-
-//
-// transact a single object
-// -> do a 'single step' resolving either installing or removing
-// required and recommended PoolItems
-
-bool
-Resolver::transactResObject( ResObject::constPtr robj, bool install,
- bool recursive)
-{
- MIL << "transactResObject()" << endl;
- MIL << "is obsolete; use resolvePool() instead" << endl;
-
- return true;
-}
-
-
-bool
-Resolver::transactResKind( Resolvable::Kind kind )
-{
- MIL << "transactResKind(" << kind << ")" << endl;
- MIL << "is obsolete; use resolvePool() instead" << endl;
-
- return true;
-}
-
-
-void
-Resolver::transactReset( ResStatus::TransactByValue causer )
-{
- MIL << "transactReset(" << causer << ")" << endl;
- MIL << "is obsolete; use resolvePool() instead" << endl;
-
- return;
-}
-
///////////////////////////////////////////////////////////////////
};// namespace detail
/////////////////////////////////////////////////////////////////////
#include "zypp/base/SerialNumber.h"
#include "zypp/solver/detail/Types.h"
-#include "zypp/solver/detail/ResolverQueue.h"
-#include "zypp/solver/detail/ResolverContext.h"
-#include "zypp/solver/detail/ContextPool.h"
#include "zypp/ProblemTypes.h"
#include "zypp/ResolverProblem.h"
#include "zypp/ProblemSolution.h"
#include "zypp/UpgradeStatistics.h"
#include "zypp/Capabilities.h"
+#include "zypp/sat/Capability.h"
/////////////////////////////////////////////////////////////////////////
class SATResolver;
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : ItemCapKind
- //
- /** */
- struct ItemCapKind
- {
- public:
- Capability cap; //Capability which has triggerd this selection
- Dep capKind; //Kind of that capability
- PoolItem_Ref item; //Item which has triggered this selection
- bool initialInstallation; //This item has triggered the installation
- //Not already fullfilled requierement only.
-
- ItemCapKind() : capKind("FRESHENS") {}
- ItemCapKind( PoolItem i, Capability c, Dep k, bool initial)
- : cap( c )
- , capKind( k )
- , item( i )
- , initialInstallation( initial )
- { }
- };
- typedef std::multimap<PoolItem_Ref,ItemCapKind> ItemCapKindMap;
- typedef std::list<ItemCapKind> ItemCapKindList;
-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Resolver
SATResolver *_satResolver;
SerialNumberWatcher _poolchanged;
- unsigned _timeout_seconds;
- unsigned _maxSolverPasses;
- bool _verifying;
- bool _testing;
-
- // In order reducing solver time we are reducing the branches
- // by skipping resolvables which have worse architecture,edition
- // than a resolvable which provides the same cababilities.
- // BUT if there is no valid solution we will regard the "other"
- // resolvables in a second solver run too.
- bool _tryAllPossibilities; // Try ALL alternatives
// list populated by calls to addPoolItemTo*()
- QueueItemList _initial_items;
- PoolItemList _items_to_install;
- PoolItemList _items_to_establish;
- PoolItemList _items_to_remove;
PoolItemList _items_to_verify;
- PoolItemList _items_to_lockUninstalled;
- PoolItemList _items_to_keep;
-
- // pool of valid contexts which are "recycled" in order to fasten the solver
- ContextPool contextPool;
// list of problematic items after doUpgrade()
PoolItemList _update_items;
- // Additional information about the solverrun
- ItemCapKindMap _isInstalledBy;
- ItemCapKindMap _installs;
-
- Capabilities _extra_caps;
- Capabilities _extra_conflicts;
-
- //typedef std::multimap<PoolItem_Ref,Capability> IgnoreMap;
+ CapabilitySet _extra_requires;
+ CapabilitySet _extra_conflicts;
+
+ typedef std::multimap<PoolItem_Ref,Capability> IgnoreMap;
// These conflict should be ignored of the concering item
IgnoreMap _ignoreConflicts;
// Ignore the vendor of the item
PoolItemList _ignoreVendorItem;
- ResolverQueueList _pending_queues;
- ResolverQueueList _pruned_queues;
- ResolverQueueList _complete_queues;
- ResolverQueueList _deferred_queues;
- ResolverQueueList _invalid_queues;
-
- int _valid_solution_count;
-
- ResolverContext_Ptr _best_context;
- // Context of the last establishing call ( without any transaction )
- ResolverContext_Ptr _establish_context;
- bool _timed_out;
-
- std::set<Repository> _subscribed;
-
- Arch _architecture;
bool _forceResolve; // remove items which are conflicts with others or
// have unfulfilled requirements.
// This behaviour is favourited by ZMD
bool _upgradeMode; // Resolver has been called with doUpgrade
- bool _preferHighestVersion; // Prefer the result with the newest version
//if there are more solver results.
// helpers
bool doesObsoleteCapability (PoolItem_Ref candidate, const Capability & cap);
bool doesObsoleteItem (PoolItem_Ref candidate, PoolItem_Ref installed);
- void collectResolverInfo (void);
-
public:
virtual std::ostream & dumpOn( std::ostream & str ) const;
friend std::ostream& operator<<(std::ostream& str, const Resolver & obj)
{ return obj.dumpOn (str); }
- void dumpTaskList(const PoolItemList &install, const PoolItemList &remove );
-
- // ---------------------------------- accessors
-
- QueueItemList initialItems () const { return _initial_items; }
-
- ResolverQueueList pendingQueues () const { return _pending_queues; }
- ResolverQueueList prunedQueues () const { return _pruned_queues; }
- ResolverQueueList completeQueues () const { return _complete_queues; }
- ResolverQueueList deferredQueues () const { return _deferred_queues; }
- ResolverQueueList invalidQueues () const { return _invalid_queues; }
-
- ResolverContext_Ptr bestContext (void) const { return _best_context; }
-
- /** depending on the last solver result, either return bestContext()
- of the first invalid context */
- ResolverContext_Ptr context (void) const;
// ---------------------------------- methods
- void setTimeout (int seconds) { _timeout_seconds = seconds; }
- void setMaxSolverPasses (int count) { _maxSolverPasses = count; }
- int timeout () const { return _timeout_seconds; }
- int maxSolverPasses () const { return _maxSolverPasses; }
-
ResPool pool (void) const;
void setPool (const ResPool & pool) { _pool = pool; }
- void addSubscribedSource (Repository source);
-
- void addPoolItemToInstall (PoolItem_Ref item);
- void addPoolItemsToInstallFromList (PoolItemList & rl);
-
- void addPoolItemToLockUninstalled (PoolItem_Ref item);
- void addPoolItemToKepp (PoolItem_Ref item);
-
- void addPoolItemToRemove (PoolItem_Ref item);
- void addPoolItemsToRemoveFromList (PoolItemList & rl);
-
- void addPoolItemToEstablish (PoolItem_Ref item);
- void addPoolItemsToEstablishFromList (PoolItemList & rl);
-
void addPoolItemToVerify (PoolItem_Ref item);
- void addExtraCapability (const Capability & capability);
- void removeExtraCapability (const Capability & capability);
+ void addExtraRequires (const Capability & capability);
+ void removeExtraRequires (const Capability & capability);
void addExtraConflict (const Capability & capability);
void removeExtraConflict (const Capability & capability);
- const Capabilities extraCapability () { return _extra_caps; }
- const Capabilities extraConflicts () { return _extra_conflicts; }
+ const CapabilitySet extraRequires () { return _extra_requires; }
+ const CapabilitySet extraConflicts () { return _extra_conflicts; }
void addIgnoreConflict (const PoolItem_Ref item,
const Capability & capability);
void setForceResolve (const bool force) { _forceResolve = force; }
bool forceResolve() { return _forceResolve; }
- void setPreferHighestVersion (const bool highestVersion) { _preferHighestVersion = highestVersion; }
- bool preferHighestVersion() { return _preferHighestVersion; }
-
- void setTryAllPossibilities (const bool tryAllPossibilities) { _tryAllPossibilities = tryAllPossibilities; }
- bool tryAllPossibilities () const { return _tryAllPossibilities; };
-
- bool verifySystem (bool considerNewHardware = false);
- void establishState (ResolverContext_Ptr context = NULL);
- bool establishPool (void);
- void freshenState( ResolverContext_Ptr context = NULL, bool resetAfterSolve = true );
- bool freshenPool( bool resetAfterSolve = true );
- bool resolveDependencies (const ResolverContext_Ptr context = NULL);
- bool resolvePool( bool tryAllPossibilities = false);
- bool transactResObject( ResObject::constPtr robj,
- bool install = true,
- bool recursive = false);
- bool transactResKind( Resolvable::Kind kind );
- void transactReset( ResStatus::TransactByValue causer );
+ bool verifySystem ();
+ bool resolvePool();
- void doUpgrade( zypp::UpgradeStatistics & opt_stats_r );
- PoolItemList problematicUpdateItems( void ) const { return _update_items; }
+ void doUpgrade( zypp::UpgradeStatistics & opt_stats_r ) {return;}; // FIXME
-
- ResolverProblemList problems (const bool ignoreValidSolution = false) const;
+ ResolverProblemList problems () const;
void applySolutions (const ProblemSolutionList &solutions);
- // returns a string list of ResolverInfo of the LAST not valid solution
- std::list<std::string> problemDescription( void ) const;
// reset all SOLVER transaction in pool
void undo(void);
- // Get more information about the solverrun
- // Which item will be installed by another item or triggers an item for
- // installation
- const ItemCapKindList isInstalledBy (const PoolItem_Ref item);
- const ItemCapKindList installs (const PoolItem_Ref item);
-
- void reset (bool resetValidResults = false, bool keepExtras = false );
-
- Arch architecture() const { return _architecture; }
- void setArchitecture( const Arch & arch) { _architecture = arch; }
+ void reset (bool keepExtras = false );
- bool testing(void) const { return _testing; }
- void setTesting( bool testing ) { _testing = testing; }
};
///////////////////////////////////////////////////////////////////
#include "zypp/solver/detail/Resolver.h"
#include "zypp/Resolver.h"
-#include "zypp/solver/detail/ResolverContext.h"
#include "zypp/ResolverProblem.h"
-#include "zypp/solver/detail/ProblemSolutionIgnore.h"
-#include "zypp/solver/detail/ProblemSolutionInstall.h"
-#include "zypp/solver/detail/ProblemSolutionUninstall.h"
-#include "zypp/solver/detail/ProblemSolutionUnlock.h"
-#include "zypp/solver/detail/ProblemSolutionKeep.h"
-#include "zypp/solver/detail/ProblemSolutionAllBranches.h"
-#include "zypp/solver/detail/ProblemSolutionDoubleTimeout.h"
-
-#include "zypp/solver/detail/ResolverInfoChildOf.h"
-#include "zypp/solver/detail/ResolverInfoConflictsWith.h"
-#include "zypp/solver/detail/ResolverInfoContainer.h"
-#include "zypp/solver/detail/ResolverInfoDependsOn.h"
-#include "zypp/solver/detail/ResolverInfoMisc.h"
-#include "zypp/solver/detail/ResolverInfoMissingReq.h"
-#include "zypp/solver/detail/ResolverInfoNeededBy.h"
-#include "zypp/solver/detail/ResolverInfoObsoletes.h"
#include "zypp/sat/SATResolver.h"
#include "zypp/base/String.h"
{ ///////////////////////////////////////////////////////////////////
using namespace std;
-
-
-typedef multimap<PoolItem_Ref, ResolverInfo_Ptr> ProblemMap;
-typedef multimap<PoolItem_Ref, Capability> ItemCapabilityMap;
-typedef multimap<PoolItem_Ref, PoolItem_Ref> ConflictMap;
-
-#define MAXPROBLEMS 20
-#define TAB " "
-
-// match template over ItemCapabilityMap
-template <class K, class V>
-class cap_equals {
- private:
- V value;
-public:
- cap_equals (const V& v)
- : value(v) {
- }
- // comparison
- bool operator() (pair<const K, V> elem) {
- return value.matches (elem.second) == CapMatch::yes;
- }
-};
-
-// match template over ConflictMap
-template <class K, class V>
-class conflict_equals {
- private:
- V value;
-public:
- conflict_equals (const V& v)
- : value(v) {
- }
- // comparison
- bool operator() (pair<const K, V> elem) {
- return value = elem.second;
- }
-};
-
-// set resolvables with errors
-
-typedef struct {
- // Map of errors
- ProblemMap problems;
- // Map of additional information applied to an item
- ProblemMap additionalInfo;
- // A map of PoolItems which provides a capability but are set
- // for uninstallation
- ItemCapabilityMap provideAndDeleteMap;
- // A map of PoolItems which provides a capability but are set
- // to be kept
- ItemCapabilityMap provideAndKeptMap;
- // A map of PoolItems which provides a capability but are locked
- ItemCapabilityMap provideAndLockMap;
- // A map of PoolItems which provides a capability but have another architecture
- ItemCapabilityMap provideAndOtherArchMap;
- // A map of PoolItems which provides a capability but have another vendor
- ItemCapabilityMap provideAndOtherVendorMap;
- // A map of conflicting Items
- ConflictMap conflictMap;
-} ResItemCollector;
-
-
-static void
-collector_cb (ResolverInfo_Ptr info, void *data)
-{
- ResItemCollector *collector = (ResItemCollector *)data;
- PoolItem_Ref item = info->affected();
- if (info->error()) {
- collector->problems.insert (make_pair( item, info));
- } else {
- collector->additionalInfo.insert (make_pair( item, info));
-
- if (info->type()==RESOLVER_INFO_TYPE_NEEDED_BY) { // logging reverse needed by
- ResolverInfoNeededBy_constPtr needed_by = dynamic_pointer_cast<const ResolverInfoNeededBy>(info);
- PoolItemList itemList = needed_by->items();
- for (PoolItemList::const_iterator iter = itemList.begin();
- iter != itemList.end(); ++iter)
- {
- collector->additionalInfo.insert (make_pair( *iter, info));
- }
- }
- }
-
- // Collicting items which are providing requirements but they
- // are set for uninstall
- if (info->type() == RESOLVER_INFO_TYPE_UNINSTALL_PROVIDER) {
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // does entry already exists ?
- ItemCapabilityMap::iterator pos = find_if (collector->provideAndDeleteMap.begin(),
- collector->provideAndDeleteMap.end(),
- cap_equals<PoolItem_Ref, Capability>(misc_info->capability()));
-
- if (pos == collector->provideAndDeleteMap.end()) {
- _XDEBUG ("Inserting " << misc_info->capability() << "/" << misc_info->other()
- << " into provideAndDelete map");
- collector->provideAndDeleteMap.insert (make_pair( misc_info->other(), misc_info->capability()));
- }
- }
- // Collicting items which are providing requirements but they
- // are set to be kept
- if (info->type() == RESOLVER_INFO_TYPE_KEEP_PROVIDER) {
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // does entry already exists ?
- ItemCapabilityMap::iterator pos = find_if (collector->provideAndKeptMap.begin(),
- collector->provideAndKeptMap.end(),
- cap_equals<PoolItem_Ref, Capability>(misc_info->capability()));
-
- if (pos == collector->provideAndKeptMap.end()) {
- _XDEBUG ("Inserting " << misc_info->capability() << "/" << misc_info->other()
- << " into provideAndKeptMap map");
- collector->provideAndKeptMap.insert (make_pair( misc_info->other(), misc_info->capability()));
- }
- }
- // Collecting items which are providing requirements but they
- // are locked
- if (info->type() == RESOLVER_INFO_TYPE_LOCKED_PROVIDER) {
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // does entry already exists ?
- ItemCapabilityMap::iterator pos = find_if (collector->provideAndLockMap.begin(),
- collector->provideAndLockMap.end(),
- cap_equals<PoolItem_Ref, Capability>(misc_info->capability()));
- if (pos == collector->provideAndLockMap.end()) {
- _XDEBUG ("Inserting " << misc_info->capability() << "/" << misc_info->other()
- << " into provideAndLockMap map");
- collector->provideAndLockMap.insert (make_pair( misc_info->other(), misc_info->capability()));
- }
- }
- // Collecting items which are providing requirements but they
- // have another architecture
- if (info->type() == RESOLVER_INFO_TYPE_OTHER_ARCH_PROVIDER) {
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // does entry already exists ?
- ItemCapabilityMap::iterator pos = find_if (collector->provideAndOtherArchMap.begin(),
- collector->provideAndOtherArchMap.end(),
- cap_equals<PoolItem_Ref, Capability>(misc_info->capability()));
-
- if (pos == collector->provideAndOtherArchMap.end()) {
- _XDEBUG ("Inserting " << misc_info->capability() << "/" << misc_info->other()
- << " into provideAndOtherArchMap map");
- collector->provideAndOtherArchMap.insert (make_pair( misc_info->other(), misc_info->capability()));
- }
- }
- // Collecting items which are providing requirements but they
- // have another vendor
- if (info->type() == RESOLVER_INFO_TYPE_OTHER_VENDOR_PROVIDER) {
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // does entry already exists ?
- ItemCapabilityMap::iterator pos = find_if (collector->provideAndOtherVendorMap.begin(),
- collector->provideAndOtherVendorMap.end(),
- cap_equals<PoolItem_Ref, Capability>(misc_info->capability()));
-
- if (pos == collector->provideAndOtherVendorMap.end()) {
- _XDEBUG ("Inserting " << misc_info->capability() << "/" << misc_info->other()
- << " into provideAndOtherVendorMap map");
- collector->provideAndOtherVendorMap.insert (make_pair( misc_info->other(), misc_info->capability()));
- }
- }
- // Collecting all conflicting Items
- if (info->type() == RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE
- || info->type() == RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL) {
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
-
- // does entry already exists ?
- ConflictMap::iterator pos = find_if (collector->conflictMap.lower_bound(misc_info->other()),
- collector->conflictMap.upper_bound(misc_info->other()),
- conflict_equals<PoolItem_Ref, PoolItem_Ref>(misc_info->affected()));
- if (pos == collector->conflictMap.end()) {
- _XDEBUG ("Inserting " << misc_info->affected() << "/" << misc_info->other()
- << " into conflictMap map");
- collector->conflictMap.insert (make_pair(misc_info->affected(), misc_info->other()));
- collector->conflictMap.insert (make_pair(misc_info->other(), misc_info->affected())); // reverse
- }
- }
-
-}
-
-struct AllRequires
-{
- PoolItemList requirers;
-
- bool operator()( const CapAndItem & cai )
- {
- _XDEBUG (cai.item << " requires " << cai.cap);
- requirers.push_back( cai.item );
-
- return true;
- }
-};
-
-std::string logAdditionalInfo ( const ProblemMap &additionalInfo, const PoolItem_Ref item)
-{
- string infoStr = "";
- for (ProblemMap::const_iterator iter = additionalInfo.find(item); iter != additionalInfo.end();) {
- ResolverInfo_Ptr info = iter->second;
- PoolItem_Ref iterItem = iter->first;
-
- if (iter == additionalInfo.find(item)) {
- string who = ResolverInfo::toString( item );
- infoStr = "=== " + who + " ===\n";
-
- ResStatus status = iterItem.status();
- if (status.isToBeUninstalled()) {
- if (status.isByUser())
- // Translator: all.%s = name of package,patch,...
- infoStr += TAB + str::form (_("%s will be deleted by the user.\n"),
- who.c_str());
- if (status.isByApplHigh()
- || status.isByApplLow())
- // Translator: all.%s = name of package,patch,...
- infoStr += TAB + str::form (_("%s will be deleted by another application. (ApplLow/ApplHigh)\n"),
- who.c_str());
- }
- if (status.isToBeInstalled()) {
- if (status.isByUser())
- // Translator: all.%s = name of package,patch,...
- infoStr += TAB + str::form (_("%s will be installed by the user.\n"),
- who.c_str());
- if (status.isByApplHigh()
- || status.isByApplLow())
- // Translator: all.%s = name of package,patch,...
- infoStr += TAB + str::form (_("%s will be installed by another application. (ApplLow/ApplHigh)\n"),
- who.c_str());
- }
- }
- if (iterItem == item) {
- // filter out useless information
- if (info->type() != RESOLVER_INFO_TYPE_INSTALLING
- && info->type() != RESOLVER_INFO_TYPE_ESTABLISHING
- && info->type() != RESOLVER_INFO_TYPE_UPDATING
- && info->type() != RESOLVER_INFO_TYPE_SKIPPING
- && info->type() != RESOLVER_INFO_TYPE_UNINSTALLABLE
- && info->type() != RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE) {
- infoStr += TAB +info->message();
- infoStr += "\n";
- }
- iter++;
- } else {
- // exit
- iter = additionalInfo.end();
- }
- }
- return infoStr;
-}
-
-
-static void
-moreDetailsCb( ResolverInfo_Ptr info, void *data )
-{
- if (info->important()
- && info->priority() >= RESOLVER_INFO_PRIORITY_USER) {
- std::list<std::string> *details = (std::list<std::string> *)data;
- details->push_back( info->message() );
- }
-
-}
-
-static string
-moreDetails( ResolverContext_Ptr context, PoolItem_Ref item )
-{
- MIL << "moreDetails for " << item << endl;
- std::list<std::string> details;
- context->foreachInfo( item, RESOLVER_INFO_PRIORITY_USER, moreDetailsCb, &details, true, true ); //, const bool merge=true, const bool findImportant = true) const;
- string result;
- std::list<std::string>::iterator it;
- for (it = details.begin(); it != details.end(); ++it)
- {
- result += " ";
- result += *it;
- result += "\n";
- }
-
- return result;
-}
-
-
-
ResolverProblemList
-Resolver::problems (const bool ignoreValidSolution) const
+Resolver::problems () const
{
- if ( getenv("ZYPP_SAT_SOLVER") && _satResolver )
- return _satResolver->problems();
-
- ResolverProblemList problems;
-
- MIL << "Resolver::problems(" << (ignoreValidSolution ? "ignoreValidSolution": "") << ")" << endl;
-
- if (_best_context && !ignoreValidSolution) {
- MIL << "Valid solution found, no problems" << endl;
- return problems;
- }
-
- // collect all resolvables with error
- ResolverQueueList invalid = invalidQueues();
- MIL << invalid.size() << " invalid queues" << endl;
-
- if (invalid.empty()) {
- WAR << "No solver problems, but there is also no valid solution." << endl;
- if (!_best_context
- && timeout() > 0) {
- // This can be generated by a timout only
- string what = str::form (_("No valid solution found within %d seconds"), timeout());
- string details = _("The solver has reached a defined timout");
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- problem->addSolution (new ProblemSolutionDoubleTimeout (problem));
- if (tryAllPossibilities())
- problem->addSolution (new ProblemSolutionAllBranches (problem,false));
- problems.push_back (problem);
- }
-
- return problems;
- }
-
- bool skippedPossibilities = false;
-
- for (ResolverQueueList::iterator iter = invalid.begin();
- iter != invalid.end(); iter++) {
- // evaluate if there are other possibilities which have not been regarded
- ResolverQueue_Ptr invalidQ = *iter;
- if (invalidQ->context()->skippedPossibilities()) {
- skippedPossibilities = true;
- break;
- }
- }
-
- if (!_tryAllPossibilities // a second run with ALL possibilities has not been tried
- && skippedPossibilities) { // possible other solutions skipped
- // give the user an additional solution for trying all branches
- string what = _("No valid solution found with just resolvables which suitalbe best suitable for your system.");
- string details = _("With this run only resolvables with the best fit have been regarded.\n");
- details = details + _("Regarding all possible resolvables takes time, but can come to a valid result.");
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- problem->addSolution (new ProblemSolutionAllBranches (problem));
- problems.push_back (problem);
- }
-
- ResolverContext_Ptr context = invalid.front()->context();
- ResItemCollector collector;
- context->foreachInfo (PoolItem(), RESOLVER_INFO_PRIORITY_VERBOSE, collector_cb, &collector);
-
- for (ProblemMap::const_iterator iter = collector.problems.begin(); iter != collector.problems.end(); ++iter) {
- PoolItem_Ref item = iter->first;
- ResolverInfo_Ptr info = iter->second;
-
- bool problem_created = false;
-
- MIL << "Problem: " << *info;
- XXX << "; Evaluate solutions..." << endl;
- string what;
- string details;
-
- if (item) {
- string who = ResolverInfo::toString( item );
- string whoShort = ResolverInfo::toString( item, true ); // short version
- switch (info->type()) {
- case RESOLVER_INFO_TYPE_INVALID: {
- what = _("Invalid information");
- }
- break;
- case RESOLVER_INFO_TYPE_NEEDED_BY: { // no solution; it is only a info
- ResolverInfoNeededBy_constPtr needed_by = dynamic_pointer_cast<const ResolverInfoNeededBy>(info);
- if (needed_by->items().size() >= 1)
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s is needed by other resolvables"), whoShort.c_str());
- else
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s is needed by %s"), whoShort.c_str(), needed_by->itemsToString(true).c_str());
- details = str::form (_("%s is needed by:\n%s"), who.c_str(), needed_by->itemsToString(false).c_str());
- }
- break;
- case RESOLVER_INFO_TYPE_CONFLICTS_WITH: {
- ResolverInfoConflictsWith_constPtr conflicts_with = dynamic_pointer_cast<const ResolverInfoConflictsWith>(info);
- if (conflicts_with->items().size() >= 1)
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s conflicts with other resolvables"), whoShort.c_str() );
- else
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s conflicts with %s"), whoShort.c_str(), conflicts_with->itemsToString(true).c_str());
-
- details = str::form (_("%s conflicts with:\n%s"), who.c_str(), conflicts_with->itemsToString(false).c_str()) + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- PoolItemList item_list = conflicts_with->items();
- for (PoolItemList::const_iterator it = item_list.begin(); it != item_list.end(); ++it) {
- details += logAdditionalInfo(collector.additionalInfo, *it);
- }
-
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // Uninstall p
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
- if (conflicts_with->items().size() == 1) {
- // Uninstall q
- problem->addSolution (new ProblemSolutionUninstall (problem, *(conflicts_with->items().begin())));
- } else {
- // Uninstall all other
- PoolItemList conflict_items = conflicts_with->items();
- problem->addSolution (new ProblemSolutionUninstall (problem, conflict_items));
- }
- // Remove conflict in the resolvable which has to be installed
- problem->addSolution (new ProblemSolutionIgnoreConflicts (problem, item, conflicts_with->capability(),
- conflicts_with->items()));
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_OBSOLETES: { // no solution; it is only a info
- ResolverInfoObsoletes_constPtr obsoletes = dynamic_pointer_cast<const ResolverInfoObsoletes>(info);
- if (obsoletes->items().size() >= 1)
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s obsoletes other resolvables"), whoShort.c_str());
- else
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s obsoletes %s"), whoShort.c_str(), obsoletes->itemsToString(true).c_str());
- // TranslatorExplanation %s = name of package, patch, selection ...
- details = str::form (_("%s obsoletes:%s"), who.c_str(), obsoletes->itemsToString(false).c_str());
- details += _("\nThese resolvables will be deleted from the system.");
- details += "\n" + logAdditionalInfo(collector.additionalInfo, item);
- }
- break;
- case RESOLVER_INFO_TYPE_DEPENDS_ON: { // no solution; it is only a info
- ResolverInfoDependsOn_constPtr depends_on = dynamic_pointer_cast<const ResolverInfoDependsOn>(info);
- if (depends_on->items().size() >= 1)
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s depends on other resolvables"), whoShort.c_str(),
- depends_on->itemsToString(true).c_str());
- else
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s depends on %s"), whoShort.c_str(),
- depends_on->itemsToString(true).c_str());
- // TranslatorExplanation %s = name of package, patch, selection ...
- details = str::form (_("%s depends on:%s"), who.c_str(), depends_on->itemsToString(false).c_str());
- }
- break;
- case RESOLVER_INFO_TYPE_CHILD_OF: { // unused
- ResolverInfoChildOf_constPtr child_of = dynamic_pointer_cast<const ResolverInfoChildOf>(info);
- // TranslatorExplanation: currently it is unused.
- what = _("Child of");
- }
- break;
- case RESOLVER_INFO_TYPE_MISSING_REQ: { // no solution; it is only a info
- ResolverInfoMissingReq_constPtr missing_req = dynamic_pointer_cast<const ResolverInfoMissingReq>(info);
- // TranslatorExplanation %s = dependency
- what = str::form (_("Cannot install %s"), whoShort.c_str());
- // TranslatorExplanation %s = capability
- details = str::form (_("None provides %s"), missing_req->capability().asString().c_str());
- details += _("\nThere is no resource available which supports this requirement.");
- }
- break;
-
- // from ResolverContext
- case RESOLVER_INFO_TYPE_INVALID_SOLUTION: { // Marking this resolution attempt as invalid.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- details = _("Due to the problems described above/below, this resolution will not solve all dependencies");
- // no solution available
- }
- break;
- case RESOLVER_INFO_TYPE_UNINSTALLABLE: { // Marking p as uninstallable
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // Trying to find a concerning conflict
-
- for (ConflictMap::const_iterator it = collector.conflictMap.begin();
- it != collector.conflictMap.end(); ++it) {
- if (it->first == item) {
- what = str::form (_("Cannot install %s, because it is conflicting with %s"),
- whoShort.c_str(),
- it->second->name().c_str()) + "\n";
- details = logAdditionalInfo(collector.additionalInfo, item);
- details += logAdditionalInfo(collector.additionalInfo, it->second);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // Uninstall p
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
- // Uninstall q
- problem->addSolution (new ProblemSolutionUninstall (problem, it->second));
- problems.push_back (problem);
- problem_created = true;
- }
- }
- if (!problem_created) {
- // default
- what = misc_info->message();
- // TranslatorExplanation %s = name of package,patch,...
- details = str::form (_("%s is not installed and has been marked as uninstallable"), who.c_str()) + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- problem->addSolution (new ProblemSolutionUninstall (problem, item)); // Uninstall resolvable
- problems.push_back (problem);
- problem_created = true;
- }
- }
- break;
- case RESOLVER_INFO_TYPE_REJECT_INSTALL: { // p is scheduled to be installed, but this is not possible because of dependency problems.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package,patch,...
- what = str::form (_("Cannot install %s due to dependency problems"), whoShort.c_str());
- details = misc_info->message() + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // Uninstall it;
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
- // currently no solution concerning "ignore" is available
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_INSTALL_TO_BE_UNINSTALLED: { // Can't install p since it is already marked as needing to be uninstalled
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package,patch,...
- what = misc_info->message() + "\n";
- details = logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- problem->addSolution (new ProblemSolutionInstall (problem, item)); // Install resolvable again
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_INSTALL_UNNEEDED: { // Can't install p since it is does not apply to this system.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package,patch,...
- what = misc_info->message();
- // no solution; it is only a info
- }
- break;
- case RESOLVER_INFO_TYPE_INSTALL_PARALLEL: { // Can't install p, since a resolvable of the same name is already marked as needing to be installed.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package,patch,...
- what = str::form (_("Cannot install %s"), whoShort.c_str());
- details = misc_info->message() + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- details += logAdditionalInfo(collector.additionalInfo, misc_info->other());
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // Uninstall the item
- ResStatus status = item.status();
- string description = "";
- if (status.isInstalled())
- // TranslatorExplanation %s = name of package, patch, selection ...
- description = str::form (_("delete %s"), ResolverInfo::toString (item).c_str());
- else
- // TranslatorExplanation %s = name of package, patch, selection ...
- description = str::form (_("do not install %s"), ResolverInfo::toString (item).c_str());
- problem->addSolution (new ProblemSolutionUninstall (problem, item, description, ""));
-
- // Uninstall the other
- status = misc_info->other().status();
- if (status.isInstalled())
- // TranslatorExplanation %s = name of package, patch, selection ...
- description = str::form (_("delete %s"), ResolverInfo::toString (misc_info->other()).c_str());
- else
- // TranslatorExplanation %s = name of package, patch, selection ...
- description = str::form (_("do not install %s"), ResolverInfo::toString (misc_info->other()).c_str());
- problem->addSolution (new ProblemSolutionUninstall (problem, misc_info->other(), description, ""));
-
- // Ignore it
- problem->addSolution (new ProblemSolutionIgnoreInstalled (problem, item, misc_info->other()));
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_INCOMPLETES: { // This would invalidate p
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // TranslatorExplanation %s = name of package, patch, selection ...
- details = str::form (_("%s has unfulfilled requirements"), who.c_str())+ "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // Uninstall
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- // from QueueItemEstablish
- case RESOLVER_INFO_TYPE_ESTABLISHING: { // Establishing p
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // no solution is needed cause it is only a progress indicator
- }
- break;
- // from QueueItemInstall
- case RESOLVER_INFO_TYPE_INSTALLING: { // Installing p
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // no solution is needed cause it is only a progress indicator
- }
- break;
- case RESOLVER_INFO_TYPE_UPDATING: { // Updating p
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // no solution is needed cause it is only a progress indicator
- }
- break;
- case RESOLVER_INFO_TYPE_SKIPPING: { // Skipping p, already installed
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // It is only an info and happens while upgrading
- }
- break;
- // from QueueItemRequire
- case RESOLVER_INFO_TYPE_NO_OTHER_PROVIDER: { // There are no alternative installed providers of c [for p]
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s has missing dependencies"), whoShort.c_str());
- details = misc_info->message() + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
-
- // Searching for another item which provides this requires BUT has been set to uninstall
- for (ItemCapabilityMap::const_iterator it = collector.provideAndDeleteMap.begin();
- it != collector.provideAndDeleteMap.end(); ++it) {
- if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
- // Do not delete
- problem->addSolution (new ProblemSolutionKeep (problem, it->first));
- }
- }
-
- // Searching for another item which provides this requires BUT has been set to be kept
- for (ItemCapabilityMap::const_iterator it = collector.provideAndKeptMap.begin();
- it != collector.provideAndKeptMap.end(); ++it) {
- if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
- // Do install
- problem->addSolution (new ProblemSolutionInstall (problem, it->first));
- }
- }
-
- // uninstall
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
-
- // Unflag require ONLY for this item
- problem->addSolution (new ProblemSolutionIgnoreRequires (problem, item, misc_info->capability()));
-
- // Unflag ALL require
- // Evaluating all require Items
- AllRequires info;
- Dep dep( Dep::REQUIRES );
-
- invokeOnEach( _pool.byCapabilityIndexBegin( misc_info->capability().index(), dep ), // begin()
- _pool.byCapabilityIndexEnd( misc_info->capability().index(), dep ), // end()
- resfilter::ByCapMatch( misc_info->capability() ),
- functor::functorRef<bool,CapAndItem>(info) );
- if (info.requirers.size() > 1)
- problem->addSolution (new ProblemSolutionIgnoreRequires (problem, info.requirers, misc_info->capability()));
-
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_NO_PROVIDER: { // There are no installable providers of c [for p]
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- if (item.status().isInstalled()) {
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s has missing dependencies"), whoShort.c_str());
- } else {
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s cannot be installed due to missing dependencies"), whoShort.c_str());
- }
- details = misc_info->message() + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
-
- // Searching for another item which provides this requires BUT has been locked
- for (ItemCapabilityMap::const_iterator it = collector.provideAndLockMap.begin();
- it != collector.provideAndLockMap.end(); ++it) {
- if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
- // unlock this item
- problem->addSolution (new ProblemSolutionUnlock (problem, it->first));
- // unlock ALL existing resolvables
- problem->addSolution (new ProblemSolutionUnlock (problem, pool()));
- }
- }
- // Searching for another item which provides this requires BUT has another architec
- for (ItemCapabilityMap::const_iterator it = collector.provideAndOtherArchMap.begin();
- it != collector.provideAndOtherArchMap.end(); ++it) {
- if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
- // ignoring architecture
- problem->addSolution (new ProblemSolutionIgnoreArchitecture (problem, it->first));
- }
- }
- // Searching for another item which provides this requires BUT has another vendor
- for (ItemCapabilityMap::const_iterator it = collector.provideAndOtherVendorMap.begin();
- it != collector.provideAndOtherVendorMap.end(); ++it) {
- if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
- // ignoring vendor
- problem->addSolution (new ProblemSolutionIgnoreVendor (problem, it->first));
- }
- }
- // Searching for another item which provides this requires BUT has been set to be kept
- for (ItemCapabilityMap::const_iterator it = collector.provideAndKeptMap.begin();
- it != collector.provideAndKeptMap.end(); ++it) {
- if (it->second.matches (misc_info->capability()) == CapMatch::yes) {
- // Do install
- problem->addSolution (new ProblemSolutionInstall (problem, it->first));
- }
- }
-
- // uninstall
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
- // ignore requirement
- problem->addSolution (new ProblemSolutionIgnoreRequires (problem, item, misc_info->capability()));
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_NO_UPGRADE: { // Upgrade to q to avoid removing p is not possible.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_UNINSTALL_PROVIDER: { // p provides c but is scheduled to be uninstalled
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what =str::form (_("%s fulfills dependencies of %s but will be uninstalled"),
- misc_info->other()->name().c_str(),
- whoShort.c_str());
- details = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_KEEP_PROVIDER: { // p provides c but is scheduled to be kept
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what =str::form (_("%s fulfills dependencies of %s but will be kept on your system"),
- misc_info->other()->name().c_str(),
- whoShort.c_str());
- details = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_PARALLEL_PROVIDER: { // p provides c but another version is already installed
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("No need to install %s"), misc_info->other()->name().c_str());
- details = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_NOT_INSTALLABLE_PROVIDER: { // p provides c but is uninstallable
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("Cannot install %s to fulfill the dependencies of %s"),
- misc_info->other()->name().c_str(),
- whoShort.c_str());
- details = misc_info->message();
- // It is only an info --> no solution is needed
- }
- case RESOLVER_INFO_TYPE_OTHER_ARCH_PROVIDER: { // p provides c but has other architecture
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_LOCKED_PROVIDER: { // p provides c but is locked
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("Cannot install %s to fulfil the dependencies of %s"),
- misc_info->other()->name().c_str(),
- whoShort.c_str());
- what = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_CANT_SATISFY: { // Can't satisfy requirement c
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message() + "\n";
- details = logAdditionalInfo(collector.additionalInfo, item);
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // uninstall
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
-
- // Unflag requirement for this item
- problem->addSolution (new ProblemSolutionIgnoreRequires (problem, item, misc_info->capability()));
-
- // Unflag ALL require
- // Evaluating all require Items
- AllRequires info;
- Dep dep( Dep::REQUIRES );
-
- invokeOnEach( _pool.byCapabilityIndexBegin( misc_info->capability().index(), dep ), // begin()
- _pool.byCapabilityIndexEnd( misc_info->capability().index(), dep ), // end()
- resfilter::ByCapMatch( misc_info->capability() ),
- functor::functorRef<bool,CapAndItem>(info) );
- if (info.requirers.size() > 1)
- problem->addSolution (new ProblemSolutionIgnoreRequires (problem, info.requirers, misc_info->capability()));
-
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- // from QueueItemUninstall
- case RESOLVER_INFO_TYPE_UNINSTALL_TO_BE_INSTALLED: { // p is to-be-installed, so it won't be unlinked.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s will not be uninstalled, because it is still required"), whoShort.c_str());
- details = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- case RESOLVER_INFO_TYPE_UNINSTALL_INSTALLED: { // p is required by installed, so it won't be unlinked.
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s will not be uninstalled, because it is still required"), whoShort.c_str());
- details = misc_info->message() + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
-
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- if (item.status().isInstalled()) {
- // keep installed
- problem->addSolution (new ProblemSolutionKeep (problem, item));
- } else {
- // Do install
- problem->addSolution (new ProblemSolutionInstall (problem, item));
- }
- problems.push_back (problem);
- problem_created = true;
-
- }
- break;
- case RESOLVER_INFO_TYPE_UNINSTALL_LOCKED: { // cant uninstall, its locked
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- what = misc_info->message();
-
- if (misc_info->trigger() == ResolverInfoMisc::OBSOLETE) {
- // TranslatorExplanation %s = name of package, patch, selection ...
- details = str::form (_("%s obsoletes %s. But %s cannot be deleted, because it is locked."),
- misc_info->other()->name().c_str(),
- who.c_str(), who.c_str()) + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- }
-
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- problem->addSolution (new ProblemSolutionUnlock (problem, item)); // Unlocking resItem
- // unlock ALL existing resolvables
- problem->addSolution (new ProblemSolutionUnlock (problem, pool()));
- if (misc_info->trigger() == ResolverInfoMisc::OBSOLETE) {
- // Ignore obsoletes
- problem->addSolution (new ProblemSolutionIgnoreObsoletes (problem, item, misc_info->capability(),
- misc_info->other()));
- } else {
- // This is an "default" soltution
- // keep installed
- problem->addSolution (new ProblemSolutionKeep (problem, item));
- }
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- // from QueueItemConflict
- case RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL: { // to-be-installed p conflicts with q due to c
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- if (misc_info->other())
- what = str::form (_("Cannot install %s, because it is conflicting with %s"),
- whoShort.c_str(),
- misc_info->other()->name().c_str());
- else
- what = str::form (_("Cannot install %s, because it is conflicting"),
- whoShort.c_str());
- details = misc_info->message() + "\n";
- details += logAdditionalInfo(collector.additionalInfo, item);
- if (misc_info->other())
- details += logAdditionalInfo(collector.additionalInfo, misc_info->other());
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // Uninstall p
- problem->addSolution (new ProblemSolutionUninstall (problem, item));
- if (misc_info->other())
- // Uninstall q
- problem->addSolution (new ProblemSolutionUninstall (problem, misc_info->other()));
- // Remove conflict in the resolvable which has to be installed
- problem->addSolution (new ProblemSolutionIgnoreConflicts (problem, item, misc_info->other_capability(),
- misc_info->other()));
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- case RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE: { // uninstalled p is marked uninstallable it conflicts [with q] due to c
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name of package, patch, selection ...
- what = str::form (_("%s is uninstallable due to conflicts with %s"),
- whoShort.c_str(),
- misc_info->other()->name().c_str());
- details = misc_info->message();
- // It is only an info --> no solution is needed
- }
- break;
- }
- } else {
- // No item available
- switch (info->type()) {
- case RESOLVER_INFO_TYPE_NO_PROVIDER: { // There are no installable providers of c [for p]
- ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast<const ResolverInfoMisc>(info);
- // TranslatorExplanation %s = name requirement ...
- what = str::form (_("Requirememt %s cannot be fulfilled."), misc_info->capability().asString().c_str());
- details = misc_info->message() + "\n";
- PoolItem_Ref item = misc_info->affected();
- if (!item)
- {
- // user request, get more details
- string more_details = moreDetails( context, item );
- details += more_details;
- }
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- // ignore requirement
- problem->addSolution (new ProblemSolutionIgnoreRequires (problem, PoolItem_Ref(), misc_info->capability()));
- problems.push_back (problem);
- problem_created = true;
- }
- break;
- default:
- ERR << "No item available for error:" << info << endl;
- // but do not generate a default problem
- problem_created = true;
- }
- }
- if (!problem_created) {
- ResolverProblem_Ptr problem = new ResolverProblem (what, details);
- problems.push_back (problem);
- }
-
- if (problems.size() >= MAXPROBLEMS) {
- MIL << "Max problems reached: " << MAXPROBLEMS << ". Do not regarding the rest." << endl;
- break;
- }
-
- }
- if (problems.empty()) {
- context->spewInfo();
- }
- return problems;
+ MIL << "Resolver::problems()" << endl;
+ return _satResolver->problems();
}
void
case INSTALL: os << "Install"; break;
case REMOVE: os << "Remove"; break;
case UNLOCK: os << "Unlock"; break;
- case ALLBRANCHES_ON: os << "All branches on"; break;
- case ALLBRANCHES_OFF: os << "All branches off"; break;
- case DOUBLETIMEOUT: os << "Double timeout"; break;
}
os << " ";
os << _item;
ret = _item.status().setLock (false, ResStatus::USER);
if (!ret) ERR << "Cannot unlock " << _item << endl;
break;
- case ALLBRANCHES_ON:
- resolver.setTryAllPossibilities (true);
- break;
- case ALLBRANCHES_OFF:
- resolver.setTryAllPossibilities (false);
- break;
- case DOUBLETIMEOUT:
- resolver.setTimeout (resolver.timeout()*2);
- break;
default:
ERR << "Wrong TransactionKind" << endl;
ret = false;
InjectSolutionAction::execute(Resolver & resolver) const
{
Dependencies dependencies;
- Capabilities depList;
+ CapabilitySet depList;
if (_item != PoolItem_Ref()) {
dependencies = _item.resolvable()->deps();
depList = dependencies[Dep::CONFLICTS];
switch (_kind) {
case CONFLICTS:
// removing conflict in both resolvables
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_item, _capability);
}
// Obsoletes are conflicts too
depList = dependencies[Dep::OBSOLETES];
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_otherItem, _capability);
dependencies = _otherItem.resolvable()->deps();
depList = dependencies[Dep::CONFLICTS];
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_otherItem, _capability);
}
// Obsoletes are conflicts too
depList = dependencies[Dep::OBSOLETES];
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_otherItem, _capability);
if (_item == PoolItem_Ref()) {
// this was a requirement via Resolver::addExtraCapability
// so we have to delete it.
- resolver.removeExtraCapability (_capability);
+ resolver.removeExtraRequires (_capability);
} else {
resolver.addIgnoreRequires (_item, _capability);
}
KEEP,
INSTALL,
REMOVE,
- UNLOCK,
- ALLBRANCHES_ON,
- ALLBRANCHES_OFF,
- DOUBLETIMEOUT
+ UNLOCK
} TransactionKind;
DEFINE_PTR_TYPE(Resolver);
-DEFINE_PTR_TYPE(ResolverContext);
-
-DEFINE_PTR_TYPE(ResolverInfo);
-DEFINE_PTR_TYPE(ResolverInfoChildOf);
-DEFINE_PTR_TYPE(ResolverInfoConflictsWith);
-DEFINE_PTR_TYPE(ResolverInfoContainer);
-DEFINE_PTR_TYPE(ResolverInfoDependsOn);
-DEFINE_PTR_TYPE(ResolverInfoMisc);
-DEFINE_PTR_TYPE(ResolverInfoMissingReq);
-DEFINE_PTR_TYPE(ResolverInfoNeededBy);
-DEFINE_PTR_TYPE(ResolverInfoObsoletes);
-
-DEFINE_PTR_TYPE(QueueItem);
-DEFINE_PTR_TYPE(QueueItemBranch);
-DEFINE_PTR_TYPE(QueueItemConflict);
-DEFINE_PTR_TYPE(QueueItemEstablish);
-DEFINE_PTR_TYPE(QueueItemGroup);
-DEFINE_PTR_TYPE(QueueItemInstall);
-DEFINE_PTR_TYPE(QueueItemRequire);
-DEFINE_PTR_TYPE(QueueItemUninstall);
-
-DEFINE_PTR_TYPE(ResolverQueue);
-
-DEFINE_PTR_TYPE(ContextPool);
-
DEFINE_PTR_TYPE(SolutionAction);
typedef std::list<SolutionAction_Ptr> SolutionActionList;
typedef std::list<SolutionAction_constPtr> CSolutionActionList;