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

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