- logging "reverse" NEEDED_BY in the detail description of solver
authorStefan Schubert <schubi@suse.de>
Wed, 5 Sep 2007 15:52:16 +0000 (15:52 +0000)
committerStefan Schubert <schubi@suse.de>
Wed, 5 Sep 2007 15:52:16 +0000 (15:52 +0000)
  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
zypp/solver/detail/Resolver.cc
zypp/solver/detail/Resolver.h
zypp/solver/detail/Resolver_problems.cc
zypp/solver/detail/SolutionAction.cc

index 646fadd..32fb15a 100644 (file)
@@ -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() ))
                {
index 840f4ab..132fe9a 100644 (file)
@@ -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)
index 7c13e76..11a46d0 100644 (file)
@@ -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; }
index 0dd5579..8755cd8 100644 (file)
@@ -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<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
@@ -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<const ResolverInfoMisc>(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;             
                }
index b00161d..e21a250 100644 (file)
@@ -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