: ProblemSolution (parent, "", "")
{
if (kind == Dep::CONFLICTS) {
+ ERR << "Need BOTH resolvalbes; use the other constructor of ProblemSolutionIgnore" << endl;
+ } else if (kind == Dep::REQUIRES) {
+ _description = _("Ignoring this requirement");
+ addAction ( new InjectSolutionAction (item, capability, kind));
+ } else {
+ ERR << "Wrong kind of capability: " << kind << endl;
+ }
+}
+
+ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent,
+ const Dep &kind,
+ PoolItem_Ref item,
+ const Capability & capability,
+ PoolItem_Ref otherItem)
+ : ProblemSolution (parent, "", "")
+{
+ if (kind == Dep::CONFLICTS) {
// TranslatorExplanation %s = name of package, patch, selection ...
_description = str::form (_("Ignoring conflict of %s"),
item->name().c_str());
- addAction (new InjectSolutionAction (item, capability, kind));
- } else if (kind == Dep::PROVIDES) {
+ addAction (new InjectSolutionAction (item, capability, kind, otherItem));
+ } else if (kind == Dep::REQUIRES) {
_description = _("Ignoring this requirement");
addAction ( new InjectSolutionAction (item, capability, kind));
} else {
ERR << "Wrong kind of capability: " << kind << endl;
}
}
-
+
///////////////////////////////////////////////////////////////////
};// namespace detail
/////////////////////////////////////////////////////////////////////
const Dep &dep,
PoolItem_Ref item,
const Capability & capability);
+ ProblemSolutionIgnore( ResolverProblem_Ptr parent,
+ const Dep &dep,
+ PoolItem_Ref item,
+ const Capability & capability,
+ PoolItem_Ref otherItem);
};
///////////////////////////////////////////////////////////////////
_extra_conflicts.insert (capability);
}
+void
+Resolver::addIgnoreConflict (const PoolItem_Ref item,
+ const Capability & capability)
+{
+ _ignoreConflicts[item] = capability;
+}
+void
+Resolver::addIgnoreRequires (const PoolItem_Ref item,
+ const Capability & capability)
+{
+ _ignoreRequires[item] = capability;
+}
+
+
//---------------------------------------------------------------------------
#include <iosfwd>
#include <list>
+#include <map>
#include <string>
#include "zypp/base/ReferenceCounted.h"
CapSet _extra_caps;
CapSet _extra_conflicts;
+ IgnoreMap _ignoreConflicts;
+ IgnoreMap _ignoreRequires;
+
ResolverQueueList _pending_queues;
ResolverQueueList _pruned_queues;
ResolverQueueList _complete_queues;
void addExtraCapability (const Capability & capability);
void addExtraConflict (const Capability & capability);
+ void addIgnoreConflict (const PoolItem_Ref item,
+ const Capability & capability);
+ void addIgnoreRequires (const PoolItem_Ref item,
+ const Capability & capability);
+
void verifySystem (void);
void establishState (const ResolverContext_Ptr context = NULL);
void establishPool (void);
{ ///////////////////////////////////////////////////////////////////
typedef std::list <ResolverQueue_Ptr> ResolverQueueList;
+typedef std::map<PoolItem_Ref,Capability> IgnoreMap;
+
///////////////////////////////////////////////////////////////////
//
ResolverContext_Ptr _context;
QueueItemList _qitems;
+ IgnoreMap _ignoreConflicts;
+ IgnoreMap _ignoreRequires;
public:
ResolverQueue (const ResPool & pool, ResolverContext_Ptr context = NULL);
void addExtraConflict (const Capability & cap);
void addItem (QueueItem_Ptr qtem);
+ void setIgnoreConflicts(const IgnoreMap & ignoreMap)
+ { _ignoreConflicts = ignoreMap; }
+
+ void setIgnoreRequires(const IgnoreMap & ignoreMap)
+ { _ignoreRequires = ignoreMap; }
+
bool isEmpty () const { return _qitems.empty(); }
bool isInvalid ();
bool containsOnlyBranches ();
details = misc_info->message();
ResolverProblem_Ptr problem = new ResolverProblem (what, details);
// Add dummy provides
- problem->addSolution (new ProblemSolutionIgnore (problem, Dep::PROVIDES, item, misc_info->capability()));
+ problem->addSolution (new ProblemSolutionIgnore (problem, Dep::REQUIRES, item, misc_info->capability()));
problems.push_back (problem);
problem_created = true;
}
details = misc_info->message();
ResolverProblem_Ptr problem = new ResolverProblem (what, details);
// Add dummy provides
- problem->addSolution (new ProblemSolutionIgnore (problem, Dep::PROVIDES, item, misc_info->capability()));
+ problem->addSolution (new ProblemSolutionIgnore (problem, Dep::REQUIRES, item, misc_info->capability()));
problems.push_back (problem);
problem_created = true;
}
what = misc_info->message();
ResolverProblem_Ptr problem = new ResolverProblem (what, details);
// Add dummy provides
- problem->addSolution (new ProblemSolutionIgnore (problem, Dep::PROVIDES, item, misc_info->capability()));
+ problem->addSolution (new ProblemSolutionIgnore (problem, Dep::REQUIRES, item, misc_info->capability()));
problems.push_back (problem);
problem_created = true;
}
// Uninstall p
problem->addSolution (new ProblemSolutionUninstall (problem, resItem));
// Remove conflict in the resolvable which has to be installed
- problem->addSolution (new ProblemSolutionIgnore (problem, Dep::CONFLICTS, resItem, misc_info->capability()));
+ problem->addSolution (new ProblemSolutionIgnore (problem, Dep::CONFLICTS, resItem, misc_info->capability(),
+ misc_info->other()));
problems.push_back (problem);
problem_created = true;
#endif
// Uninstall p
problem->addSolution (new ProblemSolutionUninstall (problem, resItem));
// Remove conflict in the resolvable which has to be installed
- problem->addSolution (new ProblemSolutionIgnore (problem, Dep::CONFLICTS, resItem, misc_info->capability()));
+ problem->addSolution (new ProblemSolutionIgnore (problem, Dep::CONFLICTS, resItem, misc_info->capability(),
+ misc_info->other()));
problems.push_back (problem);
problem_created = true;
#endif
bool
InjectSolutionAction::execute(Resolver & resolver) const
{
- ResObject::constPtr resolvable = _item.resolvable();
- CapSet dep;
-
- dep.insert(_capability);
- Dependencies dependencies;
-
if (_kind == Dep::CONFLICTS) {
- // removing provide, it the other resolvable has the conflict
- dependencies[Dep::PROVIDES] = dep;
- // removing conflict
- dependencies[Dep::CONFLICTS] = dep;
+ // removing conflict in both resolvables
+ Dependencies dependencies = _item.resolvable()->deps();
+ CapSet depList = dependencies[Dep::CONFLICTS];
+ if (depList.find(_capability) != depList.end())
+ {
+ resolver.addIgnoreConflict (_item, _capability);
+ }
+ dependencies = _otherItem.resolvable()->deps();
+ depList = dependencies[Dep::CONFLICTS];
+ if (depList.find(_capability) != depList.end())
+ {
+ resolver.addIgnoreConflict (_otherItem, _capability);
+ }
} else if (_kind == Dep::PROVIDES) {
// removing the requires dependency from the item
- dependencies[Dep::REQUIRES] = dep;
+ resolver.addIgnoreRequires (_item, _capability);
} else {
ERR << "No valid InjectSolutionAction kind found" << endl;
return false;
class InjectSolutionAction: public SolutionAction
{
public:
+
+ InjectSolutionAction( PoolItem_Ref item,
+ const Capability & capability,
+ const Dep & kind)
+ : SolutionAction(),
+ _capability( capability ), _kind( kind ),
+ _otherItem() {}
- InjectSolutionAction( PoolItem_Ref item, const Capability & capability, const Dep & kind )
+ InjectSolutionAction( PoolItem_Ref item,
+ const Capability & capability,
+ const Dep & kind,
+ PoolItem_Ref otherItem)
: SolutionAction(),
- _capability( capability ), _kind( kind ) {}
+ _capability( capability ), _kind( kind ), _otherItem( otherItem ) {}
// ---------------------------------- I/O
protected:
const Capability & _capability;
- PoolItem_Ref _item;
const Dep & _kind;
+ PoolItem_Ref _item, _otherItem;
};