[Rpm-maint] Some inconsistencies in the rpm-python fpm.fi interface.

Mike Brady mike.brady at devnull.net.nz
Tue Feb 27 20:36:41 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Continuing on my effort to write some rpm --verify functionality in
Python I have come across few things that I need help with.  I will send
each one in separate emails rather than writing one big one. Hopefully
that will make things easier to digest.

The first question, well more of an observation really,  is around the
rpm.fi interface.  I perceive it to be s little inconsistent, but may be
I am missing something.

First of all I was doing.

fi = header.fiFromHeader()
for fileinfo in fi:
    do_stuff(fileinfo)

In my case the do_stuff() is actually doing the rpm --verify file
checks.  All was going well until I went to code the symlink test.  The
header[RPMTAG_LINKTOS] data isn't in the tuple returned by fi.next().

Scatching my head I turned to the rpm-python source to find that the
data can also be accessed by a series of functions calls.  So I can do

linktos = fi.FLink()

to get the data. Looking more closely I noticed that some fi data can
only be got at via the tuple and some that can only be got via the
function calls.  Hence my comment about it being inconsistent.

Performance wise using the tuple should be better, being a single call
to fi.next() returning a tuple, as compared to a call to fi.next() and
then how ever many calls are needed to get the data required.

At the moment I am doing

fi = header.fiFromHeader()
for fileinfo in fi:
    linktos = fi.FLink()
    file_stat = verifyFile(ts, fileinfo, linktos)

I will recode it as while loop later to see what the performance is like.

Regards

Mike
- --

Mike Brady
GPG Key ID: 0x9C777DA4

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF5JZZ6xLAi5x3faQRAhASAJ9juiVvl8R3gAhUIHikROSiXreZ6QCfSPg9
f9zMbZRQiUgOPNr62jHW2FU=
=zs0v
-----END PGP SIGNATURE-----



More information about the Rpm-maint mailing list