示例#1
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.name = element.getAttribute('name').encode()
     self.machine = Machine(self.name)
     for attr in ['parent', 'diskconfig', 'kernel', 'profile']:
         setattr(self, attr, None)
         if element.hasAttribute(attr):
             setattr(self, attr, element.getAttribute(attr).encode())
         setattr(self.machine, attr, getattr(self, attr))
     mods = element.getElementsByTagName('module')
     fams = element.getElementsByTagName('family')
     scripts = element.getElementsByTagName('script')
     vars_ = element.getElementsByTagName('machine_variable')
     
     for f in fams:
         family = get_child(f)
         self.machine.append_family(family)
     for s in scripts:
         name = s.getAttribute('name').encode()
         self.machine.append_script(name)
     for v in vars_:
         trait = v.getAttribute('trait').encode()
         name = v.getAttribute('name').encode()
         value = get_child(v)
         self.machine.append_variable(trait, name, value)
示例#2
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.name = element.getAttribute('name')
     devs = element.getElementsByTagName('machine_disk')
     mods = element.getElementsByTagName('module')
     fams = element.getElementsByTagName('family')
     scripts = element.getElementsByTagName('script')
     vars_ = element.getElementsByTagName('machine_type_variable')
     
     self.mtype = MachineType(self.name)
     for d in devs:
         device = d.getAttribute('device')
         diskname = d.getAttribute('diskname')
         self.mtype.append_disk(MachineDisk(diskname, device))
     moddict = dict(map(parse_module, mods))
     modorder = moddict.keys()
     modorder.sort()
     modules = []
     for i in modorder:
         modules.append(moddict[i])
     self.mtype.append_modules(modules)
     for f in fams:
         family = get_child(f)
         self.mtype.append_family(family)
     for s in scripts:
         name = s.getAttribute('name')
         self.mtype.append_script(name, name)
     for v in vars_:
         trait = v.getAttribute('trait')
         name = v.getAttribute('name')
         value = get_child(v)
         self.mtype.append_variable(trait, name, value)
示例#3
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.apt_id = self.get_attribute(element, 'apt_id')
     self.uri = self.get_attribute(element, 'uri')
     self.dist = self.get_attribute(element, 'dist')
     self.sections = self.get_attribute(element, 'sections')
     self.local_path = self.get_attribute(element, 'local_path')
示例#4
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     if name != 'family':
         raise Error, 'bad tag: %s' % name
     self.name = element.getAttribute('name').encode()
     self.parents = self._parse_parents(element)
     self.environ = self._parse_environ(element)
示例#5
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     if name != 'family':
         raise Error, 'bad tag: %s' % name
     self.name = element.getAttribute('name').encode()
     self.parents = self._parse_parents(element)
     self.environ = self._parse_environ(element)
示例#6
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     if name != 'traits':
         raise Error, 'bad tag for TraitsParser'
     self.suite = element.getAttribute('suite').encode()
     self.trait_elements = element.getElementsByTagName('trait')
     self.traits = [e.getAttribute('name').encode() for e in self.trait_elements]
示例#7
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.__desc__ = ['suite', 'nonus', 'updates', 'local', 'common']
     name = element.tagName.encode()
     if name != 'suite':
         raise Error, 'bad tag fro SuiteParser'
     for att in self.__desc__:
         if att == 'suite':
             setattr(self, 'name', self.get_attribute(element, 'name'))
             setattr(self, 'suite', self.get_attribute(element, 'name'))
         else:
             setattr(self, att, self.get_attribute(element, att))
示例#8
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     get_em = self.get_elements_from_section
     self.kernels = map(get_child, get_em(element, 'kernels', 'kernel'))
     self.mounts = map(parse_mount, get_em(element, 'mounts', 'mount'))
     self.filesystems = map(self._parse_filesystem,
                            get_em(element, 'filesystems', 'filesystem'))
     self.disks = map(self._parse_disk, get_em(element, 'disks', 'diskname'))
     self.mtypes = map(self._parse_mtype, get_em(element, 'machine_types',
                                                 'machine_type'))
     self.machines = map(parse_machine, get_em(element, 'machines', 'machine'))
示例#9
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.__desc__ = ['suite', 'nonus', 'updates', 'local', 'common']
     name = element.tagName.encode()
     if name != 'suite':
         raise Error, 'bad tag fro SuiteParser'
     for att in self.__desc__:
         if att == 'suite':
             setattr(self, 'name', self.get_attribute(element, 'name'))
             setattr(self, 'suite', self.get_attribute(element, 'name'))
         else:
             setattr(self, att, self.get_attribute(element, att))
示例#10
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     if name != 'profile':
         raise Error, 'bad tag for profileparser'
     self.name = element.getAttribute('name').encode()
     self.suite = element.getAttribute('suite').encode()
     self.traits = []
     self._get_traits(element)
     self.families = []
     self._get_families(element)
     self.vars = []
     self._get_variables(element)
示例#11
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     if name != 'profile':
         raise Error, 'bad tag for profileparser'
     self.name = element.getAttribute('name').encode()
     self.suite = element.getAttribute('suite').encode()
     self.traits = []
     self._get_traits(element)
     self.families = []
     self._get_families(element)
     self.vars = []
     self._get_variables(element)
示例#12
0
 def __init__(self, path):
     ParserHelper.__init__(self)
     f = file(path)
     self.xml = parse_file(f)
     f.close()
     
     name = self.xml.firstChild.tagName
     if name != 'profiles':
         raise Error, 'bad tag for ProfilesParser'
     element = self.xml.firstChild
     self.profile_elements = self.get_elements_from_section(self.xml, 'profiles',
                                                            'profile')
     self.profiles = [ProfileParser(element) for element in self.profile_elements]
示例#13
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.__desc__ = ['suite', 'nonus', 'updates', 'local', 'common']
     name = element.tagName.encode()
     if name != 'suite':
         raise Error, 'bad tag for SuiteParser'
     for att in self.__desc__:
         if att == 'suite':
             setattr(self, 'name', self.get_attribute(element, 'name'))
             setattr(self, 'suite', self.get_attribute(element, 'name'))
         else:
             setattr(self, att, self.get_attribute(element, att))
     aptlist = element.getElementsByTagName('suiteapt')
     self.aptsources = [SuiteAptParser(e) for e in aptlist]
示例#14
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     get_em = self.get_elements_from_section
     self.kernels = map(get_child, get_em(element, 'kernels', 'kernel'))
     self.mounts = map(parse_mount, get_em(element, 'mounts', 'mount'))
     self.filesystems = map(self._parse_filesystem,
                            get_em(element, 'filesystems', 'filesystem'))
     self.disks = map(self._parse_disk, get_em(element, 'disks',
                                               'diskname'))
     self.mtypes = map(self._parse_mtype,
                       get_em(element, 'machine_types', 'machine_type'))
     self.machines = map(parse_machine,
                         get_em(element, 'machines', 'machine'))
示例#15
0
    def __init__(self, path):
        ParserHelper.__init__(self)
        f = file(path)
        self.xml = parse_file(f)
        f.close()

        name = self.xml.firstChild.tagName
        if name != 'profiles':
            raise Error, 'bad tag for ProfilesParser'
        element = self.xml.firstChild
        self.profile_elements = self.get_elements_from_section(
            self.xml, 'profiles', 'profile')
        self.profiles = [
            ProfileParser(element) for element in self.profile_elements
        ]
示例#16
0
 def __init__(self, dirname, element):
     ParserHelper.__init__(self)
     self.dirname = path(dirname)
     name = element.tagName.encode()
     if name != 'machine_database':
         msg = "This doesn't seem to be the proper xml file.\n"
         msg += "The main tag is %s instead of machine_database.\n" % name
         raise RuntimeError , msg
     self.machines_dir = dirname / 'machines'
     get_em = self.get_elements_from_section
     self.kernels = map(get_child, get_em(element, 'kernels', 'kernel'))
     self.machines = []
     for machine_name_element in get_em(element, 'machines', 'machine'):
         name = machine_name_element.getAttribute('name').encode()
         self.machines.append(name)
示例#17
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     name = element.tagName.encode()
     if name != 'trait':
         raise Error, 'bad tag'
     self.name = element.getAttribute('name').encode()
     self.suite = element.getAttribute('suite').encode()
     self.packages = []
     self._get_packages(element)
     self.parents = []
     self._get_parents(element)
     self.environ = {}
     self._get_environ(element)
     self.templates = []
     self._get_templates(element)
     self.scripts = []
     self._get_scripts(element)
示例#18
0
 def __init__(self, filename):
     ParserHelper.__init__(self)
     f = file(filename)
     self.xml = parse_file(f)
     f.close()
     if self.xml.firstChild.tagName != 'paelladatabase':
         raise Error, 'bad type of xmlfile for PaellaParser'
     self.db_element = self.xml.firstChild
     self.suite_elements = self.get_elements_from_section(self.db_element, 'suites',
                                                          'suite')
     self.suites = [SuiteParser(element) for element in self.suite_elements]
     children = [node for node in self.db_element.childNodes]
     traits_elements = []
     for node in children:
         if hasattr(node, 'tagName') and node.tagName not in ['profiles', 'suites']:
             traits_elements.append(node)
     self.traits = [TraitsParser(element) for element in traits_elements]
示例#19
0
 def __init__(self, filename):
     ParserHelper.__init__(self)
     f = file(filename)
     self.xml = parse_file(f)
     f.close()
     if self.xml.firstChild.tagName != 'paelladatabase':
         raise Error, 'bad type of xmlfile for PaellaParser'
     self.db_element = self.xml.firstChild
     self.suite_elements = self.get_elements_from_section(
         self.db_element, 'suites', 'suite')
     self.suites = [SuiteParser(element) for element in self.suite_elements]
     children = [node for node in self.db_element.childNodes]
     traits_elements = []
     for node in children:
         if hasattr(node, 'tagName') and node.tagName not in [
                 'profiles', 'suites'
         ]:
             traits_elements.append(node)
     self.traits = [TraitsParser(element) for element in traits_elements]
示例#20
0
 def __init__(self, element):
     ParserHelper.__init__(self)
     self.suite = self.get_attribute(element, 'suite')
     self.apt_id = self.get_attribute(element, 'apt_id')
     self.order = self.get_attribute(element, 'order')