#!/usr/bin/python

import rpm
import sys
import gtk
from _gtk import gtk_set_locale

gtk_set_locale ()

import time
#time.sleep(10)

def printlist(h, tag):
    print "####### %s tag contains:" % tag
    i = 0
    list = h[tag]
    if not list:
        print "NO SUCH TAG"
        return
    
    for file in list:
        print file
        i = i + 1
    print "******** %d files" % i
    

db = rpm.opendb(0)
rc = db.findbyname('kernel')
h = db[rc[0]]

rpm.addMacro("_i18ndomains", "redhat-dist");

print h['summary']
print h['description']
print h['group']
print h['version']
print h['release']
#print h['filenames']

print h[rpm.RPMTAG_SUMMARY]
print h[rpm.RPMTAG_DESCRIPTION]
print h[rpm.RPMTAG_GROUP]
#print h[rpm.RPMTAG_FILENAMES]

sys.exit(0)

printlist (h, 'filenames')
printlist (h, 'oldfilenames')

print "-------------- expand --------------------"
h.expandFilelist()
printlist (h, 'oldfilenames')
printlist (h, 'filenames')

print "-------------- compress --------------------"
h.compressFilelist()
printlist (h, 'oldfilenames')
printlist (h, 'filenames')

print "-------------- expand --------------------"
h.expandFilelist()
printlist (h, 'oldfilenames')
printlist (h, 'filenames')

print "-------------- full --------------------"
h.fullFilelist()
printlist (h, 'oldfilenames')
printlist (h, 'filenames')

