From fd935bb941c0ce0df3aa628fc10f43699ee50c66 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 4 Feb 2019 10:04:49 +0100
Subject: [PATCH] Add --nobest option
---
dnf/cli/main.py | 24 +++++++++++++++++++-----
dnf/cli/option_parser.py | 9 +++++----
doc/command_ref.rst | 3 +++
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/dnf/cli/main.py b/dnf/cli/main.py
index 519c553..d534da9 100644
--- a/dnf/cli/main.py
+++ b/dnf/cli/main.py
@@ -123,13 +123,27 @@ def cli_run(cli, base):
ret = resolving(cli, base)
except dnf.exceptions.DepsolveError as e:
ex_Error(e)
+ msg = ""
if not cli.demands.allow_erasing and base._goal.problem_conflicts(available=True):
- msg = _("(try to add '%s' to command line to replace conflicting "
- "packages") % "--allowerasing"
- if cli.base.conf.strict:
- msg += _(" or '%s' to skip uninstallable packages)") % "--skip-broken"
+ msg += _("(try to add '%s' to command line to replace conflicting "
+ "packages") % "--allowerasing"
+ if cli.base.conf.strict:
+ if not msg:
+ msg += "(try to add "
else:
- msg += ")"
+ msg += " or "
+ msg += _("'%s' to skip uninstallable packages") % "--skip-broken"
+ if cli.base.conf.best:
+ opt = cli.base.conf._get_option("best")
+ prio = opt._get_priority()
+ if prio <= dnf.conf.PRIO_MAINCONFIG:
+ if not msg:
+ msg += "(try to add "
+ else:
+ msg += " or "
+ msg += _("'%s' to use not only best candidate packages") % "--nobest"
+ if msg:
+ msg += ")"
logger.info(msg)
raise
if ret:
diff --git a/dnf/cli/option_parser.py b/dnf/cli/option_parser.py
index e60179c..e158d16 100644
--- a/dnf/cli/option_parser.py
+++ b/dnf/cli/option_parser.py
@@ -197,10 +197,11 @@ class OptionParser(argparse.ArgumentParser):
default=None,
help=_('allow erasing of installed packages to '
'resolve dependencies'))
- main_parser.add_argument("-b", "--best", action="store_true",
- default=None,
- help=_("try the best available package "
- "versions in transactions."))
+ best_group = main_parser.add_mutually_exclusive_group()
+ best_group.add_argument("-b", "--best", action="store_true", dest='best', default=None,
+ help=_("try the best available package versions in transactions."))
+ best_group.add_argument("--nobest", action="store_false", dest='best',
+ help=_("not narrow transaction to best candidate"))
main_parser.add_argument("-C", "--cacheonly", dest="cacheonly",
action="store_true", default=None,
help=_("run entirely from system cache, "
diff --git a/doc/command_ref.rst b/doc/command_ref.rst
index 6ba31ff..99f2fbd 100644
--- a/doc/command_ref.rst
+++ b/doc/command_ref.rst
@@ -271,6 +271,9 @@ Options
disable removal of dependencies that are no longer used. It sets
:ref:`clean_requirements_on_remove <clean_requirements_on_remove-label>` conf option to ``False``.
+``--nobest``
+ Set best option as false, therefore transactions are not limited to only best candidates.
+
``--nodocs``
do not install documentation by using rpm flag 'RPMTRANS_FLAG_NODOCS'
--
libgit2 0.27.7