|
|
bb45c0 |
commit d875b67997356e7e1b4509607fec81ca8220c597
|
|
|
bb45c0 |
Author: James Antill <james@and.org>
|
|
|
bb45c0 |
Date: Tue Mar 3 01:54:02 2015 -0500
|
|
|
bb45c0 |
|
|
|
bb45c0 |
Add query_install_excludes conf./docs and use it for list/info/search/provides.
|
|
|
bb45c0 |
|
|
|
bb45c0 |
diff --git a/cli.py b/cli.py
|
|
|
bb45c0 |
index f04fe63..cefc67e 100755
|
|
|
bb45c0 |
--- a/cli.py
|
|
|
bb45c0 |
+++ b/cli.py
|
|
|
bb45c0 |
@@ -2299,7 +2299,8 @@ class YumOptionParser(OptionParser):
|
|
|
bb45c0 |
self.base.conf.disable_excludes = self._splitArg(opts.disableexcludes)
|
|
|
bb45c0 |
self.base.conf.disable_includes = self._splitArg(opts.disableincludes)
|
|
|
bb45c0 |
|
|
|
bb45c0 |
- for exclude in self._splitArg(opts.exclude):
|
|
|
bb45c0 |
+ self.base.cmdline_excludes = self._splitArg(opts.exclude)
|
|
|
bb45c0 |
+ for exclude in self.base.cmdline_excludes:
|
|
|
bb45c0 |
try:
|
|
|
bb45c0 |
excludelist = self.base.conf.exclude
|
|
|
bb45c0 |
excludelist.append(exclude)
|
|
|
bb45c0 |
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
|
|
|
bb45c0 |
index e0f4c8b..62aa78e 100644
|
|
|
bb45c0 |
--- a/docs/yum.conf.5
|
|
|
bb45c0 |
+++ b/docs/yum.conf.5
|
|
|
bb45c0 |
@@ -156,10 +156,20 @@ This is commonly used so a package isn't upgraded or installed accidentally, but
|
|
|
bb45c0 |
can be used to remove packages in any way that "yum list" will show packages.
|
|
|
bb45c0 |
Shell globs using wildcards (eg. * and ?) are allowed.
|
|
|
bb45c0 |
|
|
|
bb45c0 |
-Can be disabled using --disableexcludes.
|
|
|
bb45c0 |
+Can be disabled using disable_excludes or --disableexcludes.
|
|
|
bb45c0 |
Command-line option: \fB\-x\fP
|
|
|
bb45c0 |
|
|
|
bb45c0 |
.IP
|
|
|
bb45c0 |
+\fBdisable_excludes\fR
|
|
|
bb45c0 |
+A way to permanently set the --disableexcludes command line option.
|
|
|
bb45c0 |
+
|
|
|
bb45c0 |
+.IP
|
|
|
bb45c0 |
+\fBquery_install_excludes\fR
|
|
|
bb45c0 |
+This applies the command line exclude option (only, not the configuration
|
|
|
bb45c0 |
+exclude above) to installed packages being shown in some query commands
|
|
|
bb45c0 |
+(currently: list/info/search/provides).
|
|
|
bb45c0 |
+
|
|
|
bb45c0 |
+.IP
|
|
|
bb45c0 |
\fBinstallonlypkgs \fR
|
|
|
bb45c0 |
List of package provides that should only ever be installed, never updated.
|
|
|
bb45c0 |
Kernels in particular fall into this category. Defaults to kernel,
|
|
|
bb45c0 |
diff --git a/output.py b/output.py
|
|
|
bb45c0 |
index 2787d86..091b58e 100755
|
|
|
bb45c0 |
--- a/output.py
|
|
|
bb45c0 |
+++ b/output.py
|
|
|
bb45c0 |
@@ -1330,6 +1330,13 @@ class YumOutput:
|
|
|
bb45c0 |
:param verbose: whether to output extra verbose information
|
|
|
bb45c0 |
:param highlight: highlighting options for the highlighted matches
|
|
|
bb45c0 |
"""
|
|
|
bb45c0 |
+ if (po.repo.id == "installed" and
|
|
|
bb45c0 |
+ self.conf.query_install_excludes and self.cmdline_excludes):
|
|
|
bb45c0 |
+ # Very similar to _cmdline_exclude from yumcommands
|
|
|
bb45c0 |
+ e,m,u = yum.packages.parsePackages([po], self.cmdline_excludes)
|
|
|
bb45c0 |
+ if e or m:
|
|
|
bb45c0 |
+ return
|
|
|
bb45c0 |
+
|
|
|
bb45c0 |
if self.conf.showdupesfromrepos:
|
|
|
bb45c0 |
msg = '%s : ' % po
|
|
|
bb45c0 |
else:
|
|
|
bb45c0 |
diff --git a/yum/config.py b/yum/config.py
|
|
|
bb45c0 |
index 02061ba..efe7be9 100644
|
|
|
bb45c0 |
--- a/yum/config.py
|
|
|
bb45c0 |
+++ b/yum/config.py
|
|
|
bb45c0 |
@@ -821,6 +821,7 @@ class YumConf(StartupConf):
|
|
|
bb45c0 |
# XXX rpm_check_debug is unused, left around for API compatibility for now
|
|
|
bb45c0 |
rpm_check_debug = BoolOption(True)
|
|
|
bb45c0 |
disable_excludes = ListOption()
|
|
|
bb45c0 |
+ query_install_excludes = BoolOption(True)
|
|
|
bb45c0 |
skip_broken = BoolOption(False)
|
|
|
bb45c0 |
# Note that "instant" is the old behaviour, but group:primary is very
|
|
|
bb45c0 |
# similar but better :).
|
|
|
bb45c0 |
diff --git a/yumcommands.py b/yumcommands.py
|
|
|
bb45c0 |
index e77d209..6fa11fa 100644
|
|
|
bb45c0 |
--- a/yumcommands.py
|
|
|
bb45c0 |
+++ b/yumcommands.py
|
|
|
bb45c0 |
@@ -41,6 +41,7 @@ import errno
|
|
|
bb45c0 |
|
|
|
bb45c0 |
import yum.config
|
|
|
bb45c0 |
from yum import updateinfo
|
|
|
bb45c0 |
+from yum.packages import parsePackages
|
|
|
bb45c0 |
|
|
|
bb45c0 |
def _err_mini_usage(base, basecmd):
|
|
|
bb45c0 |
if basecmd not in base.yum_cli_commands:
|
|
|
bb45c0 |
@@ -584,6 +585,14 @@ def _list_cmd_calc_columns(base, ypl):
|
|
|
bb45c0 |
columns = base.calcColumns(data, remainder_column=1)
|
|
|
bb45c0 |
return (-columns[0], -columns[1], -columns[2])
|
|
|
bb45c0 |
|
|
|
bb45c0 |
+def _cmdline_exclude(pkgs, cmdline_excludes):
|
|
|
bb45c0 |
+ """ Do an extra exclude for installed packages that match the cmd line. """
|
|
|
bb45c0 |
+ if not cmdline_excludes:
|
|
|
bb45c0 |
+ return pkgs
|
|
|
bb45c0 |
+ e,m,u = parsePackages(pkgs, cmdline_excludes)
|
|
|
bb45c0 |
+ excluded = set(e + m)
|
|
|
bb45c0 |
+ return [po for po in pkgs if po not in excluded]
|
|
|
bb45c0 |
+
|
|
|
bb45c0 |
class InfoCommand(YumCommand):
|
|
|
bb45c0 |
"""A class containing methods needed by the cli to execute the
|
|
|
bb45c0 |
info command.
|
|
|
bb45c0 |
@@ -682,6 +691,9 @@ class InfoCommand(YumCommand):
|
|
|
bb45c0 |
clin = base.conf.color_list_installed_newer
|
|
|
bb45c0 |
clir = base.conf.color_list_installed_reinstall
|
|
|
bb45c0 |
clie = base.conf.color_list_installed_extra
|
|
|
bb45c0 |
+ if base.conf.query_install_excludes:
|
|
|
bb45c0 |
+ ypl.installed = _cmdline_exclude(ypl.installed,
|
|
|
bb45c0 |
+ base.cmdline_excludes)
|
|
|
bb45c0 |
rip = base.listPkgs(ypl.installed, _('Installed Packages'), basecmd,
|
|
|
bb45c0 |
highlight_na=update_pkgs, columns=columns,
|
|
|
bb45c0 |
highlight_modes={'>' : clio, '<' : clin,
|