Improve problem report on broken systemCheck rule (bnc #475144)
authorMichael Andres <ma@suse.de>
Mon, 4 May 2009 14:02:59 +0000 (16:02 +0200)
committerMichael Andres <ma@suse.de>
Mon, 4 May 2009 14:18:35 +0000 (16:18 +0200)
zypp/solver/detail/ProblemSolutionCombi.cc
zypp/solver/detail/ProblemSolutionCombi.h
zypp/solver/detail/SATResolver.cc

index 11b5ce8..5b9880c 100644 (file)
@@ -58,7 +58,7 @@ void ProblemSolutionCombi::addSingleAction( Capability capability, const Transac
     addAction (new TransactionSolutionAction(capability, action));
     actNumber++;
 }
-       
+
 void ProblemSolutionCombi::addSingleAction( PoolItem item, const TransactionKind action)
 {
     addAction (new TransactionSolutionAction(item, action));
@@ -86,7 +86,28 @@ void ProblemSolutionCombi::addDescription( const std::string description)
        }
        // all other
        _details += "\n";
-       _details += description;        
+       _details += description;
+    }
+}
+
+void ProblemSolutionCombi::addFrontDescription( const std::string & description )
+{
+    if ( _description.size() == 0
+        && _details.size() == 0) {
+        // first entry
+       _description = description;
+    } else {
+       if ( _description.size() > 0
+            && _details.size() == 0) {
+           // second entry
+           _details = _description;
+           _description = _("Following actions will be done:");
+       }
+       // all other
+        std::string tmp( _details );
+       _details = description;
+       _details += "\n";
+        _details += tmp;
     }
 }
 
index 96be552..1e9875e 100644 (file)
@@ -41,7 +41,7 @@ namespace zypp
         * Class representing one possible solution to one problem found during resolving
         * This problem solution is a combination of different actions.
         * e.G. install, delete, keep different resolvables.
-        * 
+        *
         **/
        class ProblemSolutionCombi : public ProblemSolution
        {
@@ -66,18 +66,22 @@ namespace zypp
            /**
             * Add a single action of a SolverQueueItem
             */
-           void addSingleAction( SolverQueueItem_Ptr item, const TransactionKind action);          
+           void addSingleAction( SolverQueueItem_Ptr item, const TransactionKind action);
 
            /**
             * returns the number of actions
             */
            int actionCount() { return actNumber;}
-           
+
            /**
-            * Set description text
+            * Set description text (append)
             */
            void addDescription( const std::string description);
 
+           /**
+            * Set description text (prepend)
+            */
+           void addFrontDescription( const std::string & description );
        };
 
       ///////////////////////////////////////////////////////////////////
index d812f48..e7d3524 100644 (file)
@@ -1156,11 +1156,14 @@ SATResolver::problems ()
                                    resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
                                    resolverProblem->setDescription(_("This request will break your system!"));
                                    description = _("ignore the warning of a broken system");
+                                    description += string(" (requires:")+dep2str(pool, what)+")";
+                                    MIL << description << endl;
+                                    problemSolution->addFrontDescription (description);
                                } else {
                                    description = str::form (_("do not ask to install a solvable providing %s"), dep2str(pool, what));
+                                    MIL << description << endl;
+                                    problemSolution->addDescription (description);
                                }
-                               MIL << description << endl;
-                               problemSolution->addDescription (description);
                                }
                                break;
                            case SOLVER_ERASE_SOLVABLE_PROVIDES:
@@ -1174,11 +1177,15 @@ SATResolver::problems ()
                                    resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
                                    resolverProblem->setDescription(_("This request will break your system!"));
                                    description = _("ignore the warning of a broken system");
+                                    description += string(" (conflicts:")+dep2str(pool, what)+")";
+                                    MIL << description << endl;
+                                    problemSolution->addFrontDescription (description);
+
                                } else {
                                    description = str::form (_("do not ask to delete all solvables providing %s"), dep2str(pool, what));
+                                    MIL << description << endl;
+                                    problemSolution->addDescription (description);
                                }
-                               MIL << description << endl;
-                               problemSolution->addDescription (description);
                                }
                                break;
                            case SOLVER_INSTALL_SOLVABLE_UPDATE: