[PATCH] Filter the comps file we write on our media based on the package set. (#878985)

Mike McLean mikem at redhat.com
Mon Dec 17 22:38:02 UTC 2012


On 12/17/2012 03:14 PM, Bill Nottingham wrote:
> Bill Nottingham (notting at redhat.com) said:
>> Only include groups that are specified in the kickstart. Remove any environments that use groups not on the media.
>
> Anyone? Bueller?

I'm not really familiar with the pungi code, but it looks sane enough to 
me. Just one comment...

If the kickstart references groups that do not exist in comps, it looks 
like this will silently ignore them. I don't know what the old behavior 
was, but it might be worth reporting, e.g.

if g:
     ourgroups.append(g.groupid)
else:
     self.logger.info('Ignoring unknown group %s from kickstart file', 
item.name)


> Bill
>
>> ---
>>   src/pypungi/__init__.py | 23 +++++++++++++++++++++--
>>   1 file changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
>> index 45689c5..9eb24d0 100644
>> --- a/src/pypungi/__init__.py
>> +++ b/src/pypungi/__init__.py
>> @@ -724,10 +724,29 @@ class Pungi(pypungi.PungiBase):
>>
>>           ourcompspath = os.path.join(self.workdir, '%s-%s-comps.xml' % (self.config.get('pungi', 'name'), self.config.get('pungi', 'version')))
>>
>> -        ourcomps = open(ourcompspath, 'w')
>> +        # Filter out things we don't include
>> +        ourgroups = []
>> +        for item in self.ksparser.handler.packages.groupList:
>> +            g = self.ayum.comps.return_group(item.name)
>> +            if g:
>> +                ourgroups.append(g.groupid)
>> +        allgroups = [g.groupid for g in self.ayum.comps.get_groups()]
>> +        for group in allgroups:
>> +            if group not in ourgroups:
>> +                self.logger.info('Removing extra group %s from comps file' % (group,))
>> +                del self.ayum.comps._groups[group]
>> +
>> +        groups = [g.groupid for g in self.ayum.comps.get_groups()]
>> +        envs = self.ayum.comps.get_environments()
>> +        for env in envs:
>> +            for group in env.groups:
>> +                if group not in groups:
>> +                    self.logger.info('Removing incomplete environment %s from comps file' % (env,))
>> +                    del self.ayum.comps._environments[env.environmentid]
>> +                    break
>>
>> +        ourcomps = open(ourcompspath, 'w')
>>           ourcomps.write(self.ayum.comps.xml())
>> -
>>           ourcomps.close()
>>
>>           # Disable this until https://bugzilla.redhat.com/show_bug.cgi?id=442097 is fixed.
>> --
>> 1.8.0.1
>>
>> --
>> buildsys mailing list
>> buildsys at lists.fedoraproject.org
>> https://admin.fedoraproject.org/mailman/listinfo/buildsys
>>
> --
> buildsys mailing list
> buildsys at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/buildsys
>



More information about the buildsys mailing list