Blame SOURCES/BZ-1403015-yum-config-manager-select-disabled-repoid-setopts.patch

47f05a
diff -up yum-utils-1.1.31/docs/yum-config-manager.1.orig yum-utils-1.1.31/docs/yum-config-manager.1
47f05a
--- yum-utils-1.1.31/docs/yum-config-manager.1.orig	2017-02-27 18:04:05.377037276 +0100
47f05a
+++ yum-utils-1.1.31/docs/yum-config-manager.1	2017-02-27 18:04:06.648030205 +0100
47f05a
@@ -3,20 +3,38 @@
47f05a
 .SH "NAME"
47f05a
 yum-config-manager \- manage yum configuration options and yum repositories
47f05a
 .SH "SYNOPSIS"
47f05a
-\fByum-config-manager\fP [options]
47f05a
+\fByum-config-manager\fP [options] [section ...]
47f05a
 .SH "DESCRIPTION"
47f05a
 .PP
47f05a
 \fByum-config-manager\fP is a program that can manage main yum configuration
47f05a
 options, toggle which repositories are enabled or disabled, and add new
47f05a
 repositories.
47f05a
 .PP
47f05a
+Unless \-\-add-repo is used, the program will output the current configuration
47f05a
+of the selected sections, and optionally save it back to the corresponding
47f05a
+files.
47f05a
+.PP
47f05a
+By default, if no positional arguments are specified, the program will select
47f05a
+the [main] section and each enabled repository.
47f05a
+You can override this by specifying your own list of sections as arguments
47f05a
+(these may also include disabled repositories).
47f05a
+A section can either be main or a repoid.
47f05a
+.PP
47f05a
 .SH "OPTIONS"
47f05a
 .IP "\fB\-h, \-\-help\fP"
47f05a
 Display a help message, and then quit.
47f05a
+.IP "\fB\-\-setopt=option=value\fP"
47f05a
+Set any config option in yum config or repo files. For options in the global
47f05a
+config just use: \-\-setopt=option=value for repo options use: \-\-setopt=repoid.option=value.
47f05a
+The latter form accepts wildcards in repoid that will be expanded to the
47f05a
+selected sections.
47f05a
+If repoid contains no wildcard, it will automatically be selected; this is
47f05a
+useful if you are addressing a disabled repo, in which case you don't have to
47f05a
+additionally pass it as an argument.
47f05a
 .IP "\fB\-\-save\fP"
47f05a
 Save the current options (useful with \-\-setopt).
47f05a
 .IP "\fB\-\-enable\fP"
47f05a
-Enable the specified repos (automatically saves). To enable all repositories run 'yum-config-manager --enable \\*".
47f05a
+Enable the specified repos (automatically saves). To enable all repositories run "yum-config-manager --enable \\*".
47f05a
 .IP "\fB\-\-disable\fP"
47f05a
 Disable the specified repos (automatically saves). To disable all repositories run "yum-config-manager --disable \\*".
47f05a
 .IP "\fB\-\-add\-repo=ADDREPO\fP"
47f05a
@@ -25,6 +43,36 @@ Add (and enable) the repo from the speci
47f05a
 Yum-config-manager inherits all other options from yum. See the yum(8)
47f05a
 man page for more information.
47f05a
 
47f05a
+.SH "EXAMPLES"
47f05a
+Show the configuration of [main] and the repos foo and bar:
47f05a
+.IP
47f05a
+\fByum-config-manager main foo bar\fP
47f05a
+.PP
47f05a
+Enable the repos foo and bar:
47f05a
+.IP
47f05a
+\fByum-config-manager --enable foo bar\fP
47f05a
+.PP
47f05a
+Change a global option:
47f05a
+.IP
47f05a
+\fByum-config-manager --setopt=installonly_limit=5 --save\fP
47f05a
+.PP
47f05a
+Change a repo option of the repo foo (works even if foo is disabled):
47f05a
+.IP
47f05a
+\fByum-config-manager --setopt=foo.skip_if_unavailable=1 --save\fP
47f05a
+.PP
47f05a
+Change a repo option of more repos at once:
47f05a
+.IP
47f05a
+\fByum-config-manager --setopt=\\*.skip_if_unavailable=1 --save foo bar baz\fP
47f05a
+.PP
47f05a
+Change a repo option of all the enabled repos:
47f05a
+.IP
47f05a
+\fByum-config-manager --setopt=\\*.skip_if_unavailable=1 --save\fP
47f05a
+.PP
47f05a
+Change a repo option of all the configured (that is, enabled and disabled)
47f05a
+repos:
47f05a
+.IP
47f05a
+\fByum-config-manager --setopt=\\*.skip_if_unavailable=1 --save \\*\fP
47f05a
+
47f05a
 .PP
47f05a
 .SH "SEE ALSO"
47f05a
 .nf
47f05a
diff -up yum-utils-1.1.31/yum-config-manager.py.orig yum-utils-1.1.31/yum-config-manager.py
47f05a
--- yum-utils-1.1.31/yum-config-manager.py.orig	2017-02-27 18:04:05.367037332 +0100
47f05a
+++ yum-utils-1.1.31/yum-config-manager.py	2017-02-27 18:04:40.143843850 +0100
47f05a
@@ -107,7 +107,7 @@ def match_repoid(repoid, repo_setopts):
47f05a
 
47f05a
 NAME = 'yum-config-manager'
47f05a
 VERSION = '1.0'
47f05a
-USAGE = '"yum-config-manager [options] [section]'
47f05a
+USAGE = 'yum-config-manager [options] [section ...]'
47f05a
 
47f05a
 yum.misc.setup_locale()
47f05a
 
47f05a
@@ -180,6 +180,15 @@ if args:
47f05a
 else:
47f05a
     repos = yb.repos.listEnabled()
47f05a
 
47f05a
+# Automatically select repos specified within --setopt (but only for exact
47f05a
+# matches without wildcards).  This way users don't have to specify disabled
47f05a
+# repos twice on the cmdline.
47f05a
+if hasattr(yb, 'repo_setopts') and yb.repo_setopts:
47f05a
+    ids = set(yb.repo_setopts.keys()) & set(yb.repos.repos.keys())
47f05a
+    ids -= set([r.id for r in repos])
47f05a
+    repos += yb.repos.findRepos(','.join(ids),
47f05a
+                                name_match=True, ignore_case=True)
47f05a
+
47f05a
 if not opts.addrepo:
47f05a
     for repo in sorted(repos):
47f05a
         print yb.fmtSection('repo: ' + repo.id)