namespace detail
{ ///////////////////////////////////////////////////////////////////
-IMPL_PTR_TYPE(ProblemSolutionIgnoreConflicts);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreRequires);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreArchitecture);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreVendor);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreInstalled);
+IMPL_PTR_TYPE(ProblemSolutionIgnore);
//---------------------------------------------------------------------------
-ProblemSolutionIgnoreRequires::ProblemSolutionIgnoreRequires( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability)
+ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent,
+ PoolItem item )
: ProblemSolution (parent, "", "")
{
- _description = _("Ignore this requirement just here");
- addAction ( new InjectSolutionAction (item, capability, REQUIRES));
-}
-
-ProblemSolutionIgnoreRequires::ProblemSolutionIgnoreRequires( ResolverProblem_Ptr parent,
- PoolItemList itemList,
- const Capability & capability)
- : ProblemSolution (parent, "", "")
-{
- _description = _("Generally ignore this requirement");
- for (PoolItemList::const_iterator iter = itemList.begin();
- iter != itemList.end(); iter++) {
- addAction ( new InjectSolutionAction (*iter, capability, REQUIRES));
- }
-}
+ // TranslatorExplanation %s = name of package, patch, selection ...
+ _description = str::form (_("Ignore some dependencies for %s"), item->name().c_str() );
-ProblemSolutionIgnoreArchitecture::ProblemSolutionIgnoreArchitecture( ResolverProblem_Ptr parent,
- PoolItem item)
- : ProblemSolution (parent, "", "")
-{
- // TranslatorExplanation %s = name of package, patch, selection ...
- _description = str::form(_("Install %s although it would change the architecture"),
- 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"),
- Helper::itemToString (item).c_str());
- addAction ( new InjectSolutionAction (item, ARCHITECTURE));
-}
-
-ProblemSolutionIgnoreVendor::ProblemSolutionIgnoreVendor( ResolverProblem_Ptr parent,
- PoolItem item)
- : ProblemSolution (parent, "", "")
-{
- // TranslatorExplanation %s = name of package, patch, selection ...
- _description = str::form(_("Install %s although it would change the vendor"),
- 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"),
- Helper::itemToString (item).c_str());
- addAction ( new InjectSolutionAction (item, VENDOR));
-}
+// addAction ( new InjectSolutionAction (item, capability, REQUIRES));
+}
-ProblemSolutionIgnoreConflicts::ProblemSolutionIgnoreConflicts( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability,
- PoolItem otherItem)
+ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent,
+ PoolItemList itemList )
: ProblemSolution (parent, "", "")
{
- // TranslatorExplanation %s = name of package, patch, selection ...
- _description = str::form (_("Ignore this conflict of %s"),
- item->name().c_str());
- addAction (new InjectSolutionAction (item, capability, CONFLICTS, otherItem));
-}
-
-ProblemSolutionIgnoreConflicts::ProblemSolutionIgnoreConflicts( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability,
- PoolItemList itemList)
- : ProblemSolution (parent, "", "")
-{
- // TranslatorExplanation %s = name of package, patch, selection ...
- _description = str::form (_("Ignore this conflict of %s"),
- item->name().c_str());
+ _description = _("Generally ignore of some dependecies");
for (PoolItemList::const_iterator iter = itemList.begin();
iter != itemList.end(); iter++) {
- addAction (new InjectSolutionAction (item, capability, CONFLICTS, *iter));
+// addAction ( new InjectSolutionAction (*iter, capability, REQUIRES));
}
}
-
-ProblemSolutionIgnoreObsoletes::ProblemSolutionIgnoreObsoletes( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability,
- PoolItem otherItem)
- : ProblemSolution (parent, "", "")
-{
- // TranslatorExplanation %s = name of package, patch, selection ...
- _description = str::form (_("Ignore the obsolete %s in %s"),
- Helper::capToString (capability).c_str(),
- otherItem->name().c_str());
- addAction (new InjectSolutionAction (item, capability, OBSOLETES, otherItem));
-}
-
-
-ProblemSolutionIgnoreInstalled::ProblemSolutionIgnoreInstalled( ResolverProblem_Ptr parent,
- PoolItem item,
- PoolItem otherItem)
- : ProblemSolution (parent, "", "")
-{
- // TranslatorExplanation %s = name of package, patch, selection ...
- _description = str::form (_("Ignore that %s is already set to install"),
- item->name().c_str());
- addAction (new InjectSolutionAction (item, Capability(), INSTALLED, otherItem));
-}
///////////////////////////////////////////////////////////////////
};// namespace detail
/**
* Class representing one possible solution to one problem found during resolving
- * This problem solution ignores one or more items
- *
+ * This problem solution ignores one or more items by setting his dependencies
+ * to weak
**/
- class ProblemSolutionIgnoreConflicts : public ProblemSolution
+ class ProblemSolutionIgnore : public ProblemSolution
{
public:
/**
* Constructor.
**/
- ProblemSolutionIgnoreConflicts( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability,
- PoolItem otherItem);
- ProblemSolutionIgnoreConflicts( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability,
- PoolItemList itemList);
+ ProblemSolutionIgnore( ResolverProblem_Ptr parent,
+ PoolItem item );
+ ProblemSolutionIgnore( ResolverProblem_Ptr parent,
+ PoolItemList itemList);
};
- class ProblemSolutionIgnoreRequires : public ProblemSolution
- {
- public:
-
- /**
- * Constructor.
- **/
- ProblemSolutionIgnoreRequires( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability);
- ProblemSolutionIgnoreRequires( ResolverProblem_Ptr parent,
- PoolItemList itemList,
- const Capability & capability);
- };
-
- class ProblemSolutionIgnoreArchitecture : public ProblemSolution
- {
- public:
-
- /**
- * Constructor.
- **/
- ProblemSolutionIgnoreArchitecture( ResolverProblem_Ptr parent,
- PoolItem item);
- };
-
- class ProblemSolutionIgnoreVendor : public ProblemSolution
- {
- public:
-
- /**
- * Constructor.
- **/
- ProblemSolutionIgnoreVendor( ResolverProblem_Ptr parent,
- PoolItem item);
- };
-
- class ProblemSolutionIgnoreObsoletes : public ProblemSolution
- {
- public:
-
- /**
- * Constructor.
- **/
- ProblemSolutionIgnoreObsoletes( ResolverProblem_Ptr parent,
- PoolItem item,
- const Capability & capability,
- PoolItem otherItem);
- };
-
- class ProblemSolutionIgnoreInstalled : public ProblemSolution
- {
- public:
-
- /**
- * Constructor.
- **/
- ProblemSolutionIgnoreInstalled( ResolverProblem_Ptr parent,
- PoolItem item,
- PoolItem otherItem);
- };
///////////////////////////////////////////////////////////////////
}
void
-Resolver::addIgnoreConflict (const PoolItem item,
- const Capability & capability)
+Resolver::addWeak (const PoolItem item)
{
- _ignoreConflicts.insert(make_pair(item, capability));
-}
-
-void
-Resolver::addIgnoreRequires (const PoolItem item,
- const Capability & capability)
-{
- _ignoreRequires.insert(make_pair(item, capability));
-}
-
-void
-Resolver::addIgnoreObsoletes (const PoolItem item,
- const Capability & capability)
-{
- _ignoreObsoletes.insert(make_pair(item, capability));
-}
-
-void
-Resolver::addIgnoreInstalledItem (const PoolItem item)
-{
- _ignoreInstalledItem.push_back (item);
-}
-
-void
-Resolver::addIgnoreArchitectureItem (const PoolItem item)
-{
- _ignoreArchitectureItem.push_back (item);
-}
-
-void
-Resolver::addIgnoreVendorItem (const PoolItem item)
-{
- _ignoreVendorItem.push_back (item);
+ _addWeak.push_back (item);
}
//---------------------------------------------------------------------------
invokeOnEach ( _pool.begin(), _pool.end(),
resfilter::ByTransact( ), // collect transacts from Pool to resolver queue
functor::functorRef<bool,PoolItem>(info) );
- // These conflict should be ignored of the concering item
- _ignoreConflicts.clear();
- // These requires should be ignored of the concering item
- _ignoreRequires.clear();
- // These obsoletes should be ignored of the concering item
- _ignoreObsoletes.clear();
- // Ignore architecture of the item
- _ignoreArchitecture.clear();
- // Ignore the status "installed" of the item
- _ignoreInstalledItem.clear();
- // Ignore the architecture of the item
- _ignoreArchitectureItem.clear();
- // Ignore the vendor of the item
- _ignoreVendorItem.clear();
-
+ // Regard dependencies of the item weak onl
+ _addWeak.clear();
return;
}
CapabilitySet _extra_requires;
CapabilitySet _extra_conflicts;
- typedef std::multimap<PoolItem,Capability> IgnoreMap;
-
- // These conflict should be ignored of the concering item
- IgnoreMap _ignoreConflicts;
- // These requires should be ignored of the concering item
- IgnoreMap _ignoreRequires;
- // These obsoletes should be ignored of the concering item
- IgnoreMap _ignoreObsoletes;
- // Ignore architecture of the item
- PoolItemList _ignoreArchitecture;
- // Ignore the status "installed" of the item
- PoolItemList _ignoreInstalledItem;
- // Ignore the architecture of the item
- PoolItemList _ignoreArchitectureItem;
- // Ignore the vendor of the item
- PoolItemList _ignoreVendorItem;
-
+ // Regard dependencies of the item weak onl
+ PoolItemList _addWeak;
bool _forceResolve; // remove items which are conflicts with others or
// have unfulfilled requirements.
const CapabilitySet extraRequires () { return _extra_requires; }
const CapabilitySet extraConflicts () { return _extra_conflicts; }
- void addIgnoreConflict (const PoolItem item,
- const Capability & capability);
- void addIgnoreRequires (const PoolItem item,
- const Capability & capability);
- void addIgnoreObsoletes (const PoolItem item,
- const Capability & capability);
- void addIgnoreInstalledItem (const PoolItem item);
- void addIgnoreArchitectureItem (const PoolItem item);
- void addIgnoreVendorItem (const PoolItem item);
+ void addWeak (const PoolItem item);
void setForceResolve (const bool force) { _forceResolve = force; }
bool forceResolve() { return _forceResolve; }
InjectSolutionAction::dumpOn( ostream& os ) const
{
os << "InjectSolutionAction: ";
- os << _capability;
- os << ", ";
switch (_kind) {
- case REQUIRES: os << "Requires"; break;
- case CONFLICTS: os << "Conflicts"; break;
- case OBSOLETES: os << "Obsoletes"; break;
- case INSTALLED: os << "Installed"; break;
- case ARCHITECTURE: os << "Architecture"; break;
- case VENDOR: os << "Vendor"; break;
+ case WEAK: os << "Weak"; break;
default: os << "Wrong kind"; break;
}
os << " ";
bool ret = true;
switch (action()) {
case KEEP:
- resolver.addIgnoreInstalledItem( _item );
/*FALLTHRU*/
case INSTALL:
if (_item.status().isToBeUninstalled())
bool
InjectSolutionAction::execute(Resolver & resolver) const
{
- Capabilities depList;
- if (_item != PoolItem()) {
- depList = _item.resolvable()->dep(Dep::CONFLICTS);
- }
switch (_kind) {
- case CONFLICTS:
- // removing conflict in both resolvables
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
- if (iter->matches (_capability) == CapMatch::yes )
- {
- resolver.addIgnoreConflict (_item, _capability);
- }
- }
- // Obsoletes are conflicts too
- depList = _item.resolvable()->dep(Dep::OBSOLETES);
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
- if (iter->matches (_capability) == CapMatch::yes )
- {
- resolver.addIgnoreConflict (_otherItem, _capability);
- }
- }
-
- depList = _otherItem.resolvable()->dep(Dep::CONFLICTS);
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
- if (iter->matches (_capability) == CapMatch::yes )
- {
- resolver.addIgnoreConflict (_otherItem, _capability);
- }
- }
- // Obsoletes are conflicts too
- depList = _otherItem.resolvable()->dep(Dep::OBSOLETES);
- for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
- if (iter->matches (_capability) == CapMatch::yes )
- {
- resolver.addIgnoreConflict (_otherItem, _capability);
- }
- }
-
- break;
- case REQUIRES:
- // removing the requires dependency from the item
- if (_item == PoolItem()) {
- // this was a requirement via Resolver::addExtraCapability
- // so we have to delete it.
- resolver.removeExtraRequire (_capability);
- } else {
- resolver.addIgnoreRequires (_item, _capability);
- }
- break;
- case ARCHITECTURE:
- // This item is for ALL architectures available
- resolver.addIgnoreArchitectureItem (_item);
- break;
- case VENDOR:
- // This item is for ALL vendor available
- resolver.addIgnoreVendorItem (_item);
- break;
- case OBSOLETES:
- // removing the obsoletes dependency from the item
- resolver.addIgnoreObsoletes (_otherItem, _capability);
- break;
- case INSTALLED:
- // ignoring already installed items
- resolver.addIgnoreInstalledItem (_item);
- resolver.addIgnoreInstalledItem (_otherItem);
- break;
+ case WEAK:
+ // set item dependencies to weak
+ resolver.addWeak (_item);
+ break;
default:
ERR << "No valid InjectSolutionAction kind found" << endl;
return false;
/**
- * Type of ignoring dependencies, architectures and vendor
+ * Type of ignoring; currently only WEAK
**/
typedef enum
{
- REQUIRES,
- CONFLICTS,
- OBSOLETES,
- INSTALLED,
- ARCHITECTURE,
- VENDOR
+ WEAK
} InjectSolutionKind;
public:
InjectSolutionAction( PoolItem item,
- const Capability & capability,
const InjectSolutionKind & kind)
: SolutionAction(),
- _item( item ), _capability( capability ),
- _kind( kind ), _otherItem() {}
-
- InjectSolutionAction( PoolItem item,
- const InjectSolutionKind & kind)
- : SolutionAction(),
- _item( item ), _capability(),
- _kind( kind ), _otherItem() {}
-
- InjectSolutionAction( PoolItem item,
- const Capability & capability,
- const InjectSolutionKind & kind,
- PoolItem otherItem)
- : SolutionAction(),
- _item( item ), _capability( capability ),
- _kind( kind ), _otherItem( otherItem ) {}
+ _item( item ),
+ _kind( kind ) {}
// ---------------------------------- I/O
virtual std::ostream & dumpOn( std::ostream & str ) const;
{ return action.dumpOn (str); }
// ---------------------------------- accessors
- const Capability & capability() const { return _capability; };
const PoolItem item() const { return _item; }
// ---------------------------------- methods
protected:
PoolItem _item;
- const Capability _capability;
const InjectSolutionKind _kind;
- PoolItem _otherItem;
};