#!/usr/bin/python

import rpm
import os

## fd = os.open('/mnt/redhat/comps/dist/6.0/i386/util-linux-2.9o-13.i386.rpm', 0)
## (hdr1, foo) = rpm.headerFromPackage (fd)
## os.close (fd)
## fd = os.open ('/mnt/redhat/comps/dist/6.1/i386/util-linux-2.9v-20.i386.rpm', 0)
## (hdr2, foo) = rpm.headerFromPackage (fd)
## os.close (fd)

## print rpm.versionCompare (hdr1, hdr1)

## print rpm.labelCompare ((None, "2.9j", "14"), (None, "2.9j", "15"))

db = rpm.opendb ()

rc = db.findbyname ("XFree86")
    
print len(rc)
for rec in rc:
    print db[rec]
    print db[rec]['name']
