On Wed, Mar 19, 2014 at 09:16:24PM -0400, Michael K. Johnson wrote:
> I've been looking at comps. It has multiple things all of which
> we would represent via conary groups: groups, categories, and
> environments.
>
> I think langpacks might also show up as groups somehow but I'm a
> bit fuzzier on that. Conary doesn't have a concept to directly
> map them into.
OK, included is my attempt to turn comps into data to drive building
Conary groups. Try running it against comps and compare to the comps
to see what you think.
#!/usr/bin/python
import sys
from lxml import etree
fn = sys.argv[1]
r = etree.parse(fn).getroot()
groups = r.xpath('group')
environments = r.xpath('environment')
categories = r.xpath('category')
langpacks = r.find('langpacks')
pkgMap = {} # groupname: [(packagename, byDefault), ...]
grpMap = {} # groupname: [(trovename, byDefault), ...]
byDefault = {
# True => "installed"
'mandatory': True,
'default': True,
# False => "optional"
'optional': False,
'conditional': False,
}
for group in groups:
grpName = 'group-' + group.find('id').text
pkgList = []
for packagelist in group.findall('packagelist'):
for pkg in packagelist.findall('packagereq'):
pkgList.append((pkg.text, byDefault[pkg.get('type')]))
pkgMap[grpName] = pkgList
for env in environments + categories:
envName = 'group-' + env.find('id').text
grpList = []
for grouplist in env.findall('grouplist'):
for grp in grouplist.findall('groupid'):
grpList.append(('group-' + grp.text, True))
for optionlist in env.findall('optionlist'):
for grp in optionlist.findall('groupid'):
grpList.append(('group-' + grp.text, False))
grpMap[envName] = grpList
import epdb;epdb.st()
_______________________________________________
Foresight-devel mailing list
[email protected]
https://lists.foresightlinux.org/mailman/listinfo/foresight-devel