#
# hdrlist.py: header list and group set management.
# Parts from old anaconda/comps.py
#
# Erik Troan <ewt@redhat.com>
# Matt Wilson <msw@redhat.com>
# Michael Fulbright <msf@redhat.com>
# Jeremy Katz <katzj@redhat.com>
#
# Copyright 2001-2003 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import rpm
import os,sys,time

if os.environ.has_key('TREE'):
    tree=os.environ['TREE']   
if os.environ.has_key('DEFAULT'):
    default=os.environ['DEFAULT']   
if os.environ.has_key('SITE'):
    site=os.environ['SITE']   
    fd = os.open(tree + "/sites/%s/base/hdlist" %site, os.O_RDONLY)
else :
    fd = os.open(tree + "/%s/base/hdlist" %default, os.O_RDONLY)
hdrs = rpm.readHeaderListFromFD(fd)
os.close(fd)

for h in hdrs: 
#   if h[1000005] is None :
      print ("%s/RPMS/%s-%s-%s.%s.rpm ordertag is %i" %(default,h['name'], h['version'], h['release'], h['arch'], h[1000003]))
#   else :
#      print ("sites/%s/Updates/%s-%s-%s.%s.rpm" %(site,h['name'], h['version'], h['release'], h['arch']))
