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

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