示例#1
0
    def addChild(self, child):
        """
        Update child attributes.
        """

        if child.getName() != 'package':
            raise UnknownElementError(child)

        child.name = None
        child.arch = None
        child.version = None
        child.release = None

        child.location = ''

        for attr, value in child.iterAttributes():
            if attr == 'name':
                child.name = value
            elif attr == 'arch':
                child.arch = value
            elif attr == 'version':
                child.version = value
            elif attr == 'release':
                child.release = value
            else:
                raise UnknownAttributeError(child, attr)

        SlotNode.addChild(self, child)
示例#2
0
    def addChild(self, child):
        """
        Parse rpm:entry and suse:entry nodes.
        """

        if child.getName() in ("rpm:entry", "suse:entry"):
            for attr, value in child.iterAttributes():
                if attr == "kind":
                    child.kind = value
                elif attr == "name":
                    child.name = value
                elif attr == "epoch":
                    child.epoch = value
                elif attr == "ver":
                    child.version = value
                elif attr == "rel":
                    child.release = value
                elif attr == "flags":
                    child.flags = value
                elif attr == "pre":
                    child.pre = value
                else:
                    raise UnknownAttributeError(child, attr)
            SlotNode.addChild(self, child)
        else:
            raise UnknownElementError(child)
示例#3
0
    def addChild(self, child):
        """
        Parse children of atoms element.
        """

        n = child.getName()
        if n == 'package':
            child.type = child.getAttribute('type')
            SlotNode.addChild(self, child)
        elif n == 'message':
            pass
        elif n == 'script':
            pass
        else:
            raise UnknownElementError(child)
示例#4
0
    def addChild(self, child):
        if child.getName() != 'reference':
            raise UnknownElementError(child)

        child.href = None
        child.id = None
        child.title = None
        child.type = None

        for attr, value in child.iterAttributes():
            if attr == 'href':
                child.href = value
            elif attr == 'id':
                child.id = value
            elif attr == 'title':
                child.title = value
            elif attr == 'type':
                child.type = value
            else:
                raise UnknownAttributeError(child, attr)

        SlotNode.addChild(self, child)
示例#5
0
    def addChild(self, child):
        """
        Parse children of repomd element.
        """

        # W0212 - Access to a protected member _parser of a client class
        # pylint: disable-msg=W0212

        name = child.getName()
        if name == 'revision':
            self.revision = child.finalize()
        elif name == 'data':
            child.type = child.getAttribute('type')
            if child.type == 'patches':
                child._parser = PatchesXml(None, child.location)
                child.iterSubnodes = child._parser.parse
            elif child.type == 'primary':
                child._parser = PrimaryXml(None, child.location)
                child._parser.PackageFactory = self.PackageFactory
                child._parser._registerTypes()
                child.iterSubnodes = child._parser.parse
            elif child.type == 'filelists':
                child._parser = FileListsXml(None, child.location)
                child._parser.PackageFactory = self.PackageFactory
                child._parser._registerTypes()
                child.iterSubnodes = child._parser.parse
            elif child.type == 'updateinfo':
                child._parser = UpdateInfoXml(None, child.location)
                child.iterSubnodes = child._parser.parse
            SlotNode.addChild(self, child)
        elif name == 'tags':
            # I know this tag exists, but don't care about it for now. - AG
            pass
        else:
            # raise UnknownElementError(child)
            # I don't want this to fail. - AG
            pass