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 <on|off>
+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> ...
.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 <on|off>
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
.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 <on|off>
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
.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 <on|off>
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
#include <sstream>
#include <ctype.h>
#include <boost/format.hpp>
+#include <boost/logic/tribool.hpp>
#include <boost/logic/tribool_io.hpp>
#include "zypp/ZYppFactory.h"
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();
}
// 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}
};
"-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 <on|off> Force the solver to find a solution (even agressive)\n"
)) % "package, patch, pattern, product" % "package");
break;
}
// 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}
};
" 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 <on|off> Force the solver to find a solution (even agressive)\n"
)) % "package, patch, pattern, product" % "package");
break;
}
{"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}
};
" 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 <on|off> Force the solver to find a solution (even agressive)\n"
);
break;
}