Author: jkupec
Date: Mon Dec 3 18:19:04 2007
New Revision: 8011
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8011&view=rev
Log:
- --force-resolve defaults change: 'true' by default in the interactive
mode, 'false' by default in the non-interactive. 'true' is the default
for rug-compatible mode. And finally, if the --force-resolve is
specified, it takes preference.
Modified:
trunk/zypper/doc/zypper.8
trunk/zypper/src/zypper-misc.cc
trunk/zypper/src/zypper.cc
Modified: trunk/zypper/doc/zypper.8
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/doc/zypper.8?rev=8011&r1=8010&r2=8011&view=diff
==============================================================================
--- trunk/zypper/doc/zypper.8 (original)
+++ trunk/zypper/doc/zypper.8 Mon Dec 3 18:19:04 2007
@@ -96,9 +96,13 @@
directory to your bug report. To use this option, simply add it to the problematic
install or remove command.
.TP
-.I \-R, \-\-force\-resolution
-Force the solver to find a solution, even if it would mean removing all packages
-with unfulfilled requirements.
+.I \-R, \-\-force\-resolution
+If 'on' is specified the solver is forced to find a solution, even if it would
+mean removing all packages with unfulfilled requirements. Otherwise it reports
+a dependency problem and prompt the user to resolve it manually.
+
+The default value is 'on' in the interactive mode and 'off' in the
+non-interactive mode. If this option is specified, it takes the preference.
.TP
.B source-install (si) <name> ...
@@ -570,9 +574,11 @@
.I \-\-agree\-to\-third\-party\-licenses
This option is an alias to zypper's \-\-auto-agree\-with\-licenses option.
.TP
-.I \-R, \-\-force\-resolution
+.I \-R, \-\-force\-resolution
This option is not available in rug and zypper uses the 'force-resolution'
-solver mode by default when running rug in compatible mode.
+solver mode by default when running rug in compatible mode. However, it is
+possible to turn the forcing of resolution off using this option even in
+rug-compatible mode.
.RE
.TP
@@ -583,9 +589,11 @@
.I \-y, \-\-no\-confirm
Don't require user interaction. This option is implemented using zypper's non-interactive mode.
.TP
-.I \-R, \-\-force\-resolution
+.I \-R, \-\-force\-resolution
This option is not available in rug and zypper uses the 'force-resolution'
-solver mode by default when running rug in compatible mode.
+solver mode by default when running rug in compatible mode. However, it is
+possible to turn the forcing of resolution off using this option even in
+rug-compatible mode.
.RE
.TP
@@ -599,9 +607,11 @@
.I \-\-agree\-to\-third\-party\-licenses
This option is an alias to zypper's \-\-auto-agree\-with\-licenses option.
.TP
-.I \-R, \-\-force\-resolution
+.I \-R, \-\-force\-resolution
This option is not available in rug and zypper uses the 'force-resolution'
-solver mode by default when running rug in compatible mode.
+solver mode by default when running rug in compatible mode. However, it is
+possible to turn the forcing of resolution off using this option even in
+rug-compatible mode.
.RE
.TP
Modified: trunk/zypper/src/zypper-misc.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=8011&r1=8010&r2=8011&view=diff
==============================================================================
--- trunk/zypper/src/zypper-misc.cc (original)
+++ trunk/zypper/src/zypper-misc.cc Mon Dec 3 18:19:04 2007
@@ -2,6 +2,7 @@
#include <sstream>
#include
#include
+#include
#include
#include "zypp/ZYppFactory.h"
@@ -848,10 +849,49 @@
bool resolve(const Zypper & zypper)
{
- establish ();
+ establish();
+
+ // --force-resolution command line parameter value
+ tribool force_resolution = indeterminate;
+ vector<string>::size_type count = copts.count("force-resolution");
+ if (count)
+ {
+ string value = copts["force-resolution"].front();
+ if (value == "on" || value == "true" || value == "1" || value == "yes")
+ force_resolution = true;
+ else if (value == "off" || value == "false" || value == "0" || value == "no")
+ force_resolution = false;
+ else
+ {
+ cerr << format(_("Invalid value '%s' of the %s parameter"))
+ % value % "force-resolution" << endl;
+ cerr << format(_("Valid values are '%s' and '%s'")) % "on" % "off" << endl;
+ }
+
+ if (count > 1)
+ cout << format(_("Considering only the first value of the %s parameter, ignoring the rest"))
+ % "force-resolution" << endl;
+ }
+
+ // if --force-resolution was not specified on the command line, force
+ // the resolution by default, don't force it only in non-interactive mode
+ // and not rug_compatible mode
+ if (indeterminate(force_resolution))
+ {
+ if (zypper.globalOpts().non_interactive &&
+ !zypper.globalOpts().is_rug_compatible)
+ force_resolution = false;
+ else
+ force_resolution = true;
+ }
+
+ DBG << "force resolution: " << force_resolution << endl;
+ cout_v << _("Force resolution:") << " " <<
+ (force_resolution ? _("Yes") : _("No")) << endl;
+ God->resolver()->setForceResolve( force_resolution );
+
cout_v << _("Resolving dependencies...") << endl;
- God->resolver()->setForceResolve(
- zypper.globalOpts().is_rug_compatible ? true : copts.count("force-resolution") );
+ DBG << "Calling the solver..." << endl;
return God->resolver()->resolvePool();
}
Modified: trunk/zypper/src/zypper.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=8011&r1=8010&r2=8011&view=diff
==============================================================================
--- trunk/zypper/src/zypper.cc (original)
+++ trunk/zypper/src/zypper.cc Mon Dec 3 18:19:04 2007
@@ -593,7 +593,7 @@
// rug compatibility, we have --auto-agree-with-licenses
{"agree-to-third-party-licenses", no_argument, 0, 0},
{"debug-solver", no_argument, 0, 0},
- {"force-resolution", no_argument, 0, 'R'},
+ {"force-resolution", required_argument, 0, 'R'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
@@ -616,7 +616,7 @@
"-l, --auto-agree-with-licenses Automatically say 'yes' to third party license confirmation prompt.\n"
" See 'man zypper' for more details.\n"
" --debug-solver Create solver test case for debugging\n"
- "-R, --force-resolution Force the solver to find a solution (even agressive)\n"
+ "-R, --force-resolution Force the solver to find a solution (even agressive)\n"
)) % "package, patch, pattern, product" % "package");
break;
}
@@ -634,7 +634,7 @@
// rug compatibility, we have global --non-interactive
{"no-confirm", no_argument, 0, 'y'},
{"debug-solver", no_argument, 0, 0},
- {"force-resolution", no_argument, 0, 'R'},
+ {"force-resolution", required_argument, 0, 'R'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
@@ -648,13 +648,13 @@
" NAME[OP<VERSION>], where OP is one of <, <=, =, >=, >.\n"
"\n"
" Command options:\n"
- "-r, --repo <alias> Operate only with resolvables from repository specified by alias.\n"
- "-t, --type <type> Type of resolvable (%s)\n"
- " Default: %s\n"
- "-n, --name Select resolvables by plain name, not by capability\n"
- "-C, --capability Select resolvables by capability\n"
- " --debug-solver Create solver test case for debugging\n"
- "-R, --force-resolution Force the solver to find a solution (even agressive)\n"
+ "-r, --repo <alias> Operate only with resolvables from repository specified by alias.\n"
+ "-t, --type <type> Type of resolvable (%s)\n"
+ " Default: %s\n"
+ "-n, --name Select resolvables by plain name, not by capability\n"
+ "-C, --capability Select resolvables by capability\n"
+ " --debug-solver Create solver test case for debugging\n"
+ "-R, --force-resolution Force the solver to find a solution (even agressive)\n"
)) % "package, patch, pattern, product" % "package");
break;
}
@@ -856,7 +856,7 @@
{"agree-to-third-party-licenses", no_argument, 0, 0},
{"best-effort", no_argument, 0, 0},
{"debug-solver", no_argument, 0, 0},
- {"force-resolution", no_argument, 0, 'R'},
+ {"force-resolution", required_argument, 0, 'R'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
@@ -877,7 +877,7 @@
" See man zypper for more details.\n"
" --best-effort Do a 'best effort' approach to update, updates to a lower than latest-and-greatest version are also acceptable\n"
" --debug-solver Create solver test case for debugging\n"
- "-R, --force-resolution Force the solver to find a solution (even agressive)\n"
+ "-R, --force-resolution Force the solver to find a solution (even agressive)\n"
);
break;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org