[Yum-devel] [PATCH] Check there is an enabled repo. before running "repo. cmds", BZ 620802.
seth vidal
skvidal at fedoraproject.org
Tue Aug 3 15:42:32 UTC 2010
On Tue, 2010-08-03 at 11:23 -0400, James Antill wrote:
> ---
> yumcommands.py | 37 ++++++++++++++++++++++++++++++++++++-
> 1 files changed, 36 insertions(+), 1 deletions(-)
>
> diff --git a/yumcommands.py b/yumcommands.py
> index a7f5d9e..9c6fc75 100644
> --- a/yumcommands.py
> +++ b/yumcommands.py
> @@ -122,6 +122,25 @@ def checkShellArg(base, basecmd, extcmds):
> base.usage()
> raise cli.CliError
>
> +def checkEnabledRepo(base, possible_local_files=[]):
> + """
> + Verify that there is at least one enabled repo.
> +
> + @param base: a YumBase object.
> + """
> + if base.repos.listEnabled():
> + return
> +
> + for lfile in possible_local_files:
> + if lfile.endswith(".rpm") and os.path.exists(lfile):
> + return
> +
> + msg = _('There are no enabled repos.\n'
> + ' Run "yum repolist all" to see the repos you have.\n'
> + ' You can enable repos with yum-config-manager --enable <repo>')
> + base.logger.critical(msg)
> + raise cli.CliError
> +
ACK.
-sv
More information about the Yum-devel
mailing list