[Yum-devel] [PATCH] checkEnabledRepo: run prereposetup if necessary. BZ 826096

James Antill james at fedoraproject.org
Wed Jun 5 14:37:21 UTC 2013


On Wed, 2013-06-05 at 15:47 +0200, Zdenek Pavlas wrote:
> ---
>  yumcommands.py | 5 +++++
>  1 file changed, 5 insertions(+)

 We really need a new plugin entry point to add a repo. but hacking it
is easier, however:

> diff --git a/yumcommands.py b/yumcommands.py
> index 700e76c..c6cc4d9 100644
> --- a/yumcommands.py
> +++ b/yumcommands.py
> @@ -248,6 +248,11 @@ def checkEnabledRepo(base, possible_local_files=[]):
>          if lfile.endswith(".rpm") and os.path.exists(lfile):
>              return
>  
> +    if not base.repos._setup:
> +        base.repos.doSetup() # runs prereposetup
> +        if base.repos.listEnabled():
> +            return

 This should just be the much more obvious:

# runs prereposetup (which "most" plugins currently use to add repos.)
base.pkgSack
if base.repos.listEnabled():
    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>')




More information about the Yum-devel mailing list