From e7606ce95bba14ee5aa3683e2dae214c67bbcd09 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 5 Sep 2007 15:52:16 +0000 Subject: [PATCH] - logging "reverse" NEEDED_BY in the detail description of solver problems. - improved error message if a requiremnt is not fulfilled Bug 307743 - Add "ignore" option to the solution if a requirement is not fulfilled Bug 304276 --- zypp/solver/detail/QueueItemRequire.cc | 1 - zypp/solver/detail/Resolver.cc | 7 +++++++ zypp/solver/detail/Resolver.h | 1 + zypp/solver/detail/Resolver_problems.cc | 21 +++++++++++++++++++-- zypp/solver/detail/SolutionAction.cc | 16 +++++++++++++--- 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/zypp/solver/detail/QueueItemRequire.cc b/zypp/solver/detail/QueueItemRequire.cc index 646fadd..32fb15a 100644 --- a/zypp/solver/detail/QueueItemRequire.cc +++ b/zypp/solver/detail/QueueItemRequire.cc @@ -615,7 +615,6 @@ QueueItemRequire::process (ResolverContext_Ptr context, QueueItemList & new_item } // now check if a provider supplements or enhances an installed or to-be-installed resolvable - if (hint_match( item->dep( Dep::SUPPLEMENTS ), pool() ) || hint_match( item->dep( Dep::ENHANCES ), pool() )) { diff --git a/zypp/solver/detail/Resolver.cc b/zypp/solver/detail/Resolver.cc index 840f4ab..132fe9a 100644 --- a/zypp/solver/detail/Resolver.cc +++ b/zypp/solver/detail/Resolver.cc @@ -422,6 +422,13 @@ Resolver::addExtraCapability (const Capability & capability) _extra_caps.insert (capability); } +void +Resolver::removeExtraCapability (const Capability & capability) +{ + _extra_caps.erase (capability); +} + + void Resolver::addExtraConflict (const Capability & capability) diff --git a/zypp/solver/detail/Resolver.h b/zypp/solver/detail/Resolver.h index 7c13e76..11a46d0 100644 --- a/zypp/solver/detail/Resolver.h +++ b/zypp/solver/detail/Resolver.h @@ -225,6 +225,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable { void addPoolItemToVerify (PoolItem_Ref item); void addExtraCapability (const Capability & capability); + void removeExtraCapability (const Capability & capability); void addExtraConflict (const Capability & capability); const CapSet extraCapability () { return _extra_caps; } diff --git a/zypp/solver/detail/Resolver_problems.cc b/zypp/solver/detail/Resolver_problems.cc index 0dd5579..8755cd8 100644 --- a/zypp/solver/detail/Resolver_problems.cc +++ b/zypp/solver/detail/Resolver_problems.cc @@ -136,6 +136,16 @@ collector_cb (ResolverInfo_Ptr info, void *data) 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(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 @@ -699,8 +709,13 @@ Resolver::problems (const bool ignoreValidSolution) const break; case RESOLVER_INFO_TYPE_NO_PROVIDER: { // There are no installable providers of c [for p] ResolverInfoMisc_constPtr misc_info = dynamic_pointer_cast(info); - // TranslatorExplanation %s = name of package, patch, selection ... - what = str::form (_("%s cannot be installed due to missing dependencies"), whoShort.c_str()); + 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); @@ -947,6 +962,8 @@ Resolver::problems (const bool ignoreValidSolution) const 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; } diff --git a/zypp/solver/detail/SolutionAction.cc b/zypp/solver/detail/SolutionAction.cc index b00161d..e21a250 100644 --- a/zypp/solver/detail/SolutionAction.cc +++ b/zypp/solver/detail/SolutionAction.cc @@ -181,8 +181,12 @@ TransactionSolutionAction::execute(Resolver & resolver) const bool InjectSolutionAction::execute(Resolver & resolver) const { - Dependencies dependencies = _item.resolvable()->deps(); - CapSet depList = dependencies[Dep::CONFLICTS]; + Dependencies dependencies; + CapSet depList; + if (_item != PoolItem_Ref()) { + dependencies = _item.resolvable()->deps(); + depList = dependencies[Dep::CONFLICTS]; + } switch (_kind) { case CONFLICTS: // removing conflict in both resolvables @@ -221,7 +225,13 @@ InjectSolutionAction::execute(Resolver & resolver) const break; case REQUIRES: // removing the requires dependency from the item - resolver.addIgnoreRequires (_item, _capability); + if (_item == PoolItem_Ref()) { + // this was a requirement via Resolver::addExtraCapability + // so we have to delete it. + resolver.removeExtraCapability (_capability); + } else { + resolver.addIgnoreRequires (_item, _capability); + } break; case ARCHITECTURE: // This item is for ALL architectures available -- 2.7.4