Mailinglist Archive: zypp-commit (223 mails)

< Previous Next >
[zypp-commit] r10584 - in /trunk/libzypp/zypp: ResolverProblem.h solver/detail/SATResolver.cc
  • From: schubi2@xxxxxxxxxxxxxxxx
  • Date: Tue, 15 Jul 2008 12:00:50 -0000
  • Message-id: <20080715120050.72D7B3451D@xxxxxxxxxxxxxxxx>
Author: schubi2
Date: Tue Jul 15 14:00:50 2008
New Revision: 10584

URL: http://svn.opensuse.org/viewcvs/zypp?rev=10584&view=rev
Log:
showing proper error messages when the user breaks the system

Modified:
trunk/libzypp/zypp/ResolverProblem.h
trunk/libzypp/zypp/solver/detail/SATResolver.cc

Modified: trunk/libzypp/zypp/ResolverProblem.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResolverProblem.h?rev=10584&r1=10583&r2=10584&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResolverProblem.h (original)
+++ trunk/libzypp/zypp/ResolverProblem.h Tue Jul 15 14:00:50 2008
@@ -71,6 +71,18 @@
std::string details() const { return _details; }

/**
+ * Set description of the problem.
+ **/
+ void setDescription(const std::string & description)
+ { _description=description; }
+
+ /**
+ * Set detail description of the problem.
+ **/
+ void setDetails(const std::string & detail)
+ { _details=detail; }
+
+ /**
* Return the possible solutions to this problem.
* All problems should have at least 2-3 (mutually exclusive) solutions:
*

Modified: trunk/libzypp/zypp/solver/detail/SATResolver.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SATResolver.cc?rev=10584&r1=10583&r2=10584&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SATResolver.cc (original)
+++ trunk/libzypp/zypp/solver/detail/SATResolver.cc Tue Jul 15 14:00:50 2008
@@ -1003,6 +1003,9 @@
Id problem, solution, element;
Solvable *s, *sd;

+ CapabilitySet system_requires =
SystemCheck::instance().requiredSystemCap();
+ CapabilitySet system_conflicts =
SystemCheck::instance().conflictSystemCap();
+
MIL << "Encountered problems! Here are the solutions:\n" << endl;
pcnt = 1;
problem = 0;
@@ -1104,17 +1107,37 @@
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
{
problemSolution->addSingleAction
(Capability(what), REMOVE_EXTRA_REQUIRE);
- string description = str::form (_("do not ask
to install a solvable providing %s"), dep2str(pool, what));
+ string description = "";
+
+ // Checking if this problem solution would
break your system
+ if (system_requires.find(Capability(what)) !=
system_requires.end()) {
+ // Show a better warning
+ resolverProblem->setDetails(
resolverProblem->description() + "\n" + resolverProblem->details() );
+ resolverProblem->setDescription(_("This
request will break your system!"));
+ description = _("ignore the warning of a
broken system");
+ } else {
+ description = str::form (_("do not ask to
install a solvable providing %s"), dep2str(pool, what));
+ }
MIL << description << endl;
- problemSolution->addDescription (description);
+ problemSolution->addDescription (description);

}
break;
case SOLVER_ERASE_SOLVABLE_PROVIDES:
{
- problemSolution->addSingleAction
(Capability(what), REMOVE_EXTRA_CONFLICT);
- string description = str::form (_("do not ask
to delete all solvables providing %s"), dep2str(pool, what));
+ problemSolution->addSingleAction
(Capability(what), REMOVE_EXTRA_CONFLICT);
+ string description = "";
+
+ // Checking if this problem solution would
break your system
+ if (system_conflicts.find(Capability(what)) !=
system_conflicts.end()) {
+ // Show a better warning
+ resolverProblem->setDetails(
resolverProblem->description() + "\n" + resolverProblem->details() );
+ resolverProblem->setDescription(_("This
request will break your system!"));
+ description = _("ignore the warning of a
broken system");
+ } else {
+ description = str::form (_("do not ask to
delete all solvables providing %s"), dep2str(pool, what));
+ }
MIL << description << endl;
- problemSolution->addDescription (description);
+ problemSolution->addDescription (description);

}
break;
case SOLVER_INSTALL_SOLVABLE_UPDATE:

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages