[Yum-devel] [PATCH] Only search through non-locale group names, if we didn't match anything

Seth Vidal skvidal at fedoraproject.org
Mon Nov 2 19:37:44 UTC 2009



On Mon, 2 Nov 2009, James Antill wrote:

> ---
> yum/comps.py |   21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/yum/comps.py b/yum/comps.py
> index 8d3e171..f53b4f4 100755
> --- a/yum/comps.py
> +++ b/yum/comps.py
> @@ -434,9 +434,20 @@ class Comps(object):
>             else:
>                 match = re.compile(fnmatch.translate(item), flags=re.I).match
>
> +            done = False
>             for group in self.groups:
>                 for name in group.name, group.groupid, group.ui_name:
>                     if match(name):
> +                        done = True
> +                        returns[group.groupid] = group
> +                        break
> +            if done:
> +                continue
> +
> +            # If we didn't match to anything in the current locale, try others
> +            for group in self.groups:
> +                for name in group.translated_name.values():
> +                    if match(name):
>                         returns[group.groupid] = group
>                         break
>
> @@ -460,9 +471,19 @@ class Comps(object):
>             else:
>                 match = re.compile(fnmatch.translate(item), flags=re.I).match
>
> +            done = False
>             for cat in self.categories:
>                 for name in cat.name, cat.categoryid, cat.ui_name:
>                     if match(name):
> +                        done = True
> +                        returns[cat.categoryid] = cat
> +                        break
> +            if done:
> +                continue
> +
> +            for cat in self.categories:
> +                for name in cat.translated_name.values():
> +                    if match(name):
>                         returns[cat.categoryid] = cat
>                         break
>

ACK - good compromise position.

-sv



More information about the Yum-devel mailing list