예제 #1
0
def othermetadata_from_sqlite_factory(sqlitepath, archpath):
    oth_obj = OtherMetadata(sqlitepath, archpath)

    con = sqlite.Connection(sqlitepath)
    oth_cur = con.cursor()
    oth_cur.execute('SELECT * FROM packages')
    for row in oth_cur:
        op = OtherPackage()
        pkgkey = row[0]

        op.checksum = row[1]

        cur = con.cursor()
        cur.execute('SELECT author, date, changelog FROM changelog WHERE pkgKey=? ORDER BY date ASC',
                                                                    (pkgkey,))

        for author, date, changelog in cur:
            op.changelogs.append((author, date, changelog))

        oth_obj.append(op.checksum, op)
    return oth_obj
예제 #2
0
def othermetadata_from_sqlite_factory(sqlitepath, archpath):
    oth_obj = OtherMetadata(sqlitepath, archpath)

    con = sqlite.Connection(sqlitepath)
    oth_cur = con.cursor()
    oth_cur.execute('SELECT * FROM packages')
    for row in oth_cur:
        op = OtherPackage()
        pkgkey = row[0]

        op.checksum = row[1]

        cur = con.cursor()
        cur.execute(
            'SELECT author, date, changelog FROM changelog WHERE pkgKey=? ORDER BY date ASC',
            (pkgkey, ))

        for author, date, changelog in cur:
            op.changelogs.append((author, date, changelog))

        oth_obj.append(op.checksum, op)
    return oth_obj
예제 #3
0
def othermetadata_from_xml_factory(xmlpath, archpath):
    oth_obj = OtherMetadata(xmlpath, archpath)
    for _, elements in etree.iterparse(xmlpath, tag="%spackage" % OTH_NS):
        elements = MyElement(elements)
        op = OtherPackage()
        op.checksum = elements.get("pkgid")
        op.arch = elements.get("arch")
        op.name = elements.get("name")
        for elem in elements:
            elem = MyElement(elem)
            if elem.tag.endswith("version"):
                op.epoch = elem.get("epoch")
                op.version = elem.get("ver")
                op.release = elem.get("rel")
            elif elem.tag.endswith("changelog"):
                op.changelogs.append(
                    (elem.get("author"), int(elem.get("date")), elem.text))
        elements.clear()
        oth_obj.append(op.checksum, op)
    return oth_obj
예제 #4
0
def othermetadata_from_xml_factory(xmlpath, archpath):
    oth_obj = OtherMetadata(xmlpath, archpath)
    for _, elements in etree.iterparse(xmlpath, tag="%spackage" % OTH_NS):
        elements = MyElement(elements)
        op = OtherPackage()
        op.checksum = elements.get("pkgid")
        op.arch = elements.get("arch")
        op.name = elements.get("name")
        for elem in elements:
            elem = MyElement(elem)
            if elem.tag.endswith("version"):
                op.epoch = elem.get("epoch")
                op.version = elem.get("ver")
                op.release = elem.get("rel")
            elif elem.tag.endswith("changelog"):
                op.changelogs.append((elem.get("author"), int(elem.get("date")), elem.text))
        elements.clear()
        oth_obj.append(op.checksum, op)
    return oth_obj