[Yum-devel] [PATCH] Allow environment options to have a 'default=true' option, for use in the anaconda UI.

James Antill james at fedoraproject.org
Tue Apr 30 21:14:26 UTC 2013


On Tue, 2013-04-30 at 15:42 -0400, Bill Nottingham wrote:
> ---
>  yum/comps.py | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)

 It looks mostly fine, except:

> diff --git a/yum/comps.py b/yum/comps.py
> index fe5649d..04e002a 100755
> --- a/yum/comps.py
> +++ b/yum/comps.py
> @@ -366,6 +372,9 @@ class Environment(CompsObj):
>              if child.tag == 'groupid':
>                  optionid = child.text
>                  self._options[optionid] = 1
> +                default = child.attrib.get('default')
> +                if default:
> +                    self._defaultoptions[optionid] = 1
[...]
>      def add(self, obj):
>          """Add another category object to this object"""
> @@ -406,7 +418,10 @@ class Environment(CompsObj):
>          msg += """    </grouplist>\n"""
>          msg += """    <optionlist>\n"""
>          for grp in self.options:
> -            msg += """     <groupid>%s</groupid>\n""" % grp
> +            if grp in self.defaultoptions:
> +                msg += """     <groupid default="true">%s</groupid>\n""" % grp
> +            else:
> +                msg += """     <groupid>%s</groupid>\n""" % grp

...it'd be better to have no argument on the attribute, or also parse
out default="false" ... or someone is going to get confused at some
point.



More information about the Yum-devel mailing list