fiFromHeader()

seth vidal <skvidal-c/MNwgJ9CEH2fBVCVOL8/[email protected]> Thu, 15 Jan 2004 21:24:43 -0500
Newsgroups gmane.linux.redhat.rpm.python
Message-ID <1074219882.10709.100.camel@binkley>
Hi,
 looking at fiFromHeader()

it returns a file iterator.


ok, let's look at this object a bit.

if I do:
print fi[0] 
I get the first file in the header file list
print type(fi[0]) 
type 'str'

now, if I do:
for file in fi[0]:
   print type(file)

I get type is tuples
so I print the file and I get a tuple like:
('/usr/lib/GConf/2/libgconfbackend-xml.a', 53266, -32348, 1015902950, 0,
0, 50392, 1, 0, -1, 'root', 'root', '9b4d7ce38da018a67fd36b2a3ff597a7')

according to rpmfi-py.c in the python bindings this is:
Filename, size, mode, mtime, flags, rdev?, file inode, FNlink, Fstate,
vflags, user, group, md5sum
so to match these up:
filename = '/usr/lib/GConf/2/libgconfbackend-xml.a'
size = 53266
mode = -32348
mtime = 1015902950
flags = 0
rdev = 0
inode = 50932
link = 1
state = 0
vflags = -1 (I presume this is transaction set vflags?)
user = root
group = root
md5sum = '9b4d7ce38da018a67fd36b2a3ff597a7'


a few more items:

dir() of this fi object:
['BN', 'DC', 'DN', 'DX', 'Debug', 'FC', 'FClass', 'FColor', 'FFlags',
'FGroup', 'FLink', 'FMode', 'FMtime', 'FN', 'FRdev', 'FSize', 'FState',
'FUser', 'FX', 'MD5', 'VFlags', 'next']

if I attempt to run fi.MD5(), fi.FGroup() or fi.FUser()  when a dir is
the file selected in the iterator I get a segfault. Maybe it should just
throw an exception?

Thoughts?

Is the fiFromHeader() method going to continue to be around?

I'm trying to make a reliable way to get all the file information from
an rpm.

thanks
-sv