From d096c8e8b1c3baa8f38960da371f9308ee551922 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Mon, 14 Apr 2008 21:41:38 +0000 Subject: [PATCH] - use --force-resolution and --no-force-resolution instead of --force-resolution --- src/zypper-misc.cc | 29 ++++++++++------------------- src/zypper.cc | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index 9212c92..7a1536d 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -1307,26 +1307,17 @@ static void set_force_resolution(Zypper & zypper) { // --force-resolution command line parameter value tribool force_resolution = indeterminate; - unsigned int count = zypper.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 - { - zypper.out().error( - boost::str(format(_("Invalid value '%s' of the %s parameter")) - % value % "force-resolution"), - boost::str(format(_("Valid values are '%s' and '%s'")) % "on" % "off")); - } - if (count > 1) - zypper.out().warning(boost::str(format( - _("Considering only the first value of the %s parameter, ignoring the rest")) - % "force-resolution")); + if (zypper.cOpts().count("force-resolution")) + force_resolution = true; + if (zypper.cOpts().count("no-force-resolution")) + { + if (force_resolution) + zypper.out().warning(str::form( + // translators: meaning --force-resolution and --no-force-resolution + _("%s conflicts with %s, will use the less aggressive %s"), + "--force-resolution", "--no-force-resolution", "--no-force-resolution")); + force_resolution = false; } // if --force-resolution was not specified on the command line, force diff --git a/src/zypper.cc b/src/zypper.cc index cf5047b..23b24a7 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -747,7 +747,8 @@ void Zypper::processCommandOptions() // 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", required_argument, 0, 'R'}, + {"no-force-resolution", no_argument, 0, 'R'}, + {"force-resolution", no_argument, 0, 0 }, {"dry-run", no_argument, 0, 'D'}, // rug uses -N shorthand {"dry-run", no_argument, 0, 'N'}, @@ -776,7 +777,8 @@ void Zypper::processCommandOptions() " See 'man zypper' for more details.\n" " --debug-solver Create solver test case for debugging\n" " --no-recommends Do not install recommended packages, only required.\n" - "-R, --force-resolution Force the solver to find a solution (even agressive)\n" + "-R, --no-force-resolution Do not force the solver to find solution, let it ask.\n" + " --force-resolution Force the solver to find a solution (even an agressive).\n" "-D, --dry-run Test the installation, do not actually install\n" )) % "package, patch, pattern, product" % "package"); break; @@ -795,7 +797,8 @@ void Zypper::processCommandOptions() // rug compatibility, we have global --non-interactive {"no-confirm", no_argument, 0, 'y'}, {"debug-solver", no_argument, 0, 0}, - {"force-resolution", required_argument, 0, 'R'}, + {"no-force-resolution", no_argument, 0, 'R'}, + {"force-resolution", no_argument, 0, 0 }, {"dry-run", no_argument, 0, 'D'}, // rug uses -N shorthand {"dry-run", no_argument, 0, 'N'}, @@ -818,7 +821,8 @@ void Zypper::processCommandOptions() "-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, --no-force-resolution Do not force the solver to find solution, let it ask.\n" + " --force-resolution Force the solver to find a solution (even an agressive).\n" "-D, --dry-run Test the removal, do not actually remove\n" )) % "package, patch, pattern, product" % "package"); break; @@ -1090,7 +1094,8 @@ void Zypper::processCommandOptions() {"agree-to-third-party-licenses", no_argument, 0, 0}, {"best-effort", no_argument, 0, 0}, {"debug-solver", no_argument, 0, 0}, - {"force-resolution", required_argument, 0, 'R'}, + {"no-force-resolution", no_argument, 0, 'R'}, + {"force-resolution", no_argument, 0, 0 }, {"no-recommends", no_argument, 0, 0 }, {"dry-run", no_argument, 0, 'D'}, // rug uses -N shorthand @@ -1121,7 +1126,8 @@ void Zypper::processCommandOptions() " --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" " --no-recommends Do not install recommended packages, only required.\n" - "-R, --force-resolution Force the solver to find a solution (even agressive)\n" + "-R, --no-force-resolution Do not force the solver to find solution, let it ask.\n" + " --force-resolution Force the solver to find a solution (even an agressive).\n" "-D, --dry-run Test the update, do not actually update\n" )) % "package, patch, pattern, product" % "patch"); break; -- 2.7.4