Author: schubi2 Date: Fri Nov 30 12:34:15 2007 New Revision: 7987 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7987&view=rev Log: improved output of the SAT solver Modified: trunk/libzypp/zypp/sat/SATResolver.cc trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.h Modified: trunk/libzypp/zypp/sat/SATResolver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?r... ============================================================================== --- trunk/libzypp/zypp/sat/SATResolver.cc (original) +++ trunk/libzypp/zypp/sat/SATResolver.cc Fri Nov 30 12:34:15 2007 @@ -477,40 +477,40 @@ { case SOLVER_PROBLEM_UPDATE_RULE: s = pool_id2solvable(pool, source); - ret = str::form ("problem with installed package %s\n", solvable2str(pool, s)); + ret = str::form (_("problem with installed package %s"), solvable2str(pool, s)); break; case SOLVER_PROBLEM_JOB_RULE: - ret = str::form ("conflicting requests\n"); + ret = str::form (_("conflicting requests")); break; case SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP: - ret = str::form ("nothing provides requested %s\n", dep2str(pool, dep)); + ret = str::form (_("nothing provides requested %s"), dep2str(pool, dep)); break; case SOLVER_PROBLEM_NOT_INSTALLABLE: s = pool_id2solvable(pool, source); - ret = str::form ("package %s is not installable\n", solvable2str(pool, s)); + ret = str::form (_("package %s is not installable"), solvable2str(pool, s)); break; case SOLVER_PROBLEM_NOTHING_PROVIDES_DEP: s = pool_id2solvable(pool, source); - ret = str::form ("nothing provides %s needed by %s\n", dep2str(pool, dep), solvable2str(pool, s)); + ret = str::form (_("nothing provides %s needed by %s"), dep2str(pool, dep), solvable2str(pool, s)); break; case SOLVER_PROBLEM_SAME_NAME: s = pool_id2solvable(pool, source); s2 = pool_id2solvable(pool, target); - ret = str::form ("cannot install both %s and %s\n", solvable2str(pool, s), solvable2str(pool, s2)); + ret = str::form (_("cannot install both %s and %s"), solvable2str(pool, s), solvable2str(pool, s2)); break; case SOLVER_PROBLEM_PACKAGE_CONFLICT: s = pool_id2solvable(pool, source); s2 = pool_id2solvable(pool, target); - ret = str::form ("package %s conflicts with %s provided by %s\n", solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); + ret = str::form (_("package %s conflicts with %s provided by %s"), solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); break; case SOLVER_PROBLEM_PACKAGE_OBSOLETES: s = pool_id2solvable(pool, source); s2 = pool_id2solvable(pool, target); - ret = str::form ("package %s obsoletes %s provided by %s\n", solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); + ret = str::form (_("package %s obsoletes %s provided by %s"), solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); break; case SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE: s = pool_id2solvable(pool, source); - ret = str::form ("package %s requires %s, but none of the providers can be installed\n", solvable2str(pool, s), dep2str(pool, dep)); + ret = str::form (_("package %s requires %s, but none of the providers can be installed"), solvable2str(pool, s), dep2str(pool, dep)); break; } @@ -552,12 +552,14 @@ if (poolItem) { if (what >= solv->installed->start && what < solv->installed->start + solv->installed->nsolvables) { problemSolution->addSingleAction (poolItem, REMOVE); - MIL << "- do not keep " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) << - " installed" << endl; + string description = str::form (_("do not keep %s installed"), solvable2str(pool, s) ); + MIL << description << endl; + problemSolution->setDescription (description); } else { problemSolution->addSingleAction (poolItem, KEEP); - MIL << "- do not install " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) << - endl; + string description = str::form (_("do not install %s"), solvable2str(pool, s)); + MIL << description << endl; + problemSolution->setDescription (description); } } else { ERR << "SOLVER_INSTALL_SOLVABLE: No item found for " << id2str(pool, s->name) << "-" @@ -571,12 +573,14 @@ if (poolItem) { if (what >= solv->installed->start && what < solv->installed->start + solv->installed->nsolvables) { problemSolution->addSingleAction (poolItem, KEEP); - MIL << "- do not deinstall " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) << - endl; + string description = str::form (_("do not deinstall %s"), solvable2str(pool, s)); + MIL << description << endl; + problemSolution->setDescription (description); } else { problemSolution->addSingleAction (poolItem, INSTALL); - MIL << "- do not forbid installation of " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." - << id2str(pool, s->arch) << endl; + string description = str::form (_("do not forbid installation of %s"), solvable2str(pool, s)); + MIL << description << endl; + problemSolution->setDescription (description); } } else { ERR << "SOLVER_ERASE_SOLVABLE: No item found for " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << @@ -628,25 +632,31 @@ if (evrcmp(pool, sd->evr, s->evr) < 0) { - MIL << "- allow downgrade of " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) - << " to " << id2str(pool, sd->name) << "-" << id2str(pool, sd->evr) << "." << id2str(pool, sd->arch) << endl; + string description = str::form (_("allow downgrade of %s to %s"), solvable2str(pool, s), solvable2str(pool, sd)); + MIL << description << endl; + problemSolution->setDescription (description); gotone = 1; } if (!solv->allowarchchange && s->name == sd->name )//&& archchanges(pool, sd, s)) { - MIL << "- allow architecture change of " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) - << " to " << id2str(pool, sd->name) << "-" << id2str(pool, sd->evr) << "." << id2str(pool, sd->arch) << endl; + string description = str::form (_("allow architecture change of %s to %s"), solvable2str(pool, s), solvable2str(pool, sd)); + MIL << description << endl; + problemSolution->setDescription (description); gotone = 1; } - if (!solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && pool_vendor2mask(pool, s->vendor) && (pool_vendor2mask(pool, s->vendor) & pool_vendor2mask(pool, sd->vendor)) == 0) + if (!solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && pool_vendor2mask(pool, s->vendor) + && (pool_vendor2mask(pool, s->vendor) & pool_vendor2mask(pool, sd->vendor)) == 0) { - MIL << "- allow vendor change of " << id2str(pool, s->vendor) << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) - << " to " << string(sd->vendor ? id2str(pool, sd->vendor) : " (no vendor) ") << id2str(pool, sd->name) << "-" << id2str(pool, sd->evr) << "." << id2str(pool, sd->arch) << endl; + string description = str::form (_("allow vendor change of [%s]%s to [%s]%s") , id2str(pool, s->vendor) , solvable2str(pool, s), + string(sd->vendor ? id2str(pool, sd->vendor) : " (no vendor) ").c_str(), solvable2str(pool, sd)); + MIL << description << endl; + problemSolution->setDescription (description); gotone = 1; } if (!gotone) { - MIL << "- allow replacement of " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) - << " to " << id2str(pool, sd->name) << "-" << id2str(pool, sd->evr) << "." << id2str(pool, sd->arch) << endl; + string description = str::form (_("allow replacement of %s to %s"), solvable2str(pool, s), solvable2str(pool, sd)); + MIL << description << endl; + problemSolution->setDescription (description); } } else { ERR << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) @@ -656,8 +666,10 @@ else { if (itemFrom) { + string description = str::form (_("allow replacement of %s"), solvable2str(pool, s)); + MIL << description << endl; + problemSolution->setDescription (description); problemSolution->addSingleAction (itemFrom, REMOVE); - MIL << "- allow replacement of " << id2str(pool, s->name) << "-" << id2str(pool, s->evr) << "." << id2str(pool, s->arch) << endl; } } } Modified: trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Proble... ============================================================================== --- trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc (original) +++ trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc Fri Nov 30 12:34:15 2007 @@ -53,13 +53,19 @@ _details = ""; } -void ProblemSolutionCombi::addSingleAction( PoolItem_Ref item, const TransactionKind action) +void ProblemSolutionCombi::addSingleAction( PoolItem_Ref item, const TransactionKind action, + const std::string description) { - addAction ( new TransactionSolutionAction (item, REMOVE)); + TransactionSolutionAction *actionTransact = new TransactionSolutionAction(item, action); + addAction (actionTransact); - ostringstream details; - details << _actions; - _description += details.str(); + if (description.size() == 0) { + ostringstream details; + details << *actionTransact; + _details += details.str(); + } else { + _details += description; + } } /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Proble... ============================================================================== --- trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.h (original) +++ trunk/libzypp/zypp/solver/detail/ProblemSolutionCombi.h Fri Nov 30 12:34:15 2007 @@ -22,6 +22,7 @@ #ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H #define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H +#include <string> #include "zypp/ProblemSolution.h" #include "zypp/solver/detail/Types.h" @@ -52,7 +53,11 @@ /** * Add a single action */ - void addSingleAction( PoolItem_Ref item, const TransactionKind action); + void addSingleAction( PoolItem_Ref item, const TransactionKind action, const std::string description = ""); + /** + * Set description text + */ + void setDescription( const std::string description) { _description = description; }; }; /////////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org