Need an example program that implements rpm -pql via import rpm

Discussion in 'Python' started by Steven W. Orr, Mar 4, 2011.

  1. I look everywhere but I couldn't find anything. Could someone please point me to
    a small example program that does an import rpm, takes an rpm file as an
    argument and gets the list of files contained in the file, the same as if I had
    used the commandline

    rpm -pql foo-1.23-4.i586.rpm

    Much appreciated.

    TIA

    --
    Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
    happened but none stranger than this. Does your driver's license say Organ ..0
    Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
    individuals! What if this weren't a hypothetical question?
    steveo at syslang.net
    Steven W. Orr, Mar 4, 2011
    #1
    1. Advertising

  2. On 3/4/2011 10:24 AM, Daniel Mahoney wrote:
    > On Thu, 03 Mar 2011 22:24:24 -0500, Steven W. Orr wrote:
    >
    >> I look everywhere but I couldn't find anything. Could someone please
    >> point me to a small example program that does an import rpm, takes an
    >> rpm file as an argument and gets the list of files contained in the
    >> file, the same as if I had used the commandline
    >>
    >> rpm -pql foo-1.23-4.i586.rpm
    >>
    >> Much appreciated.
    >>
    >> TIA

    >
    > This is just a quick and dirty script, but how about:
    >
    > import os
    > import rpm
    > import sys


    I am at peace with the universe.

    Thanks :)

    >
    > ts = rpm.TransactionSet()
    > fd = os.open(sys.argv[1], os.O_RDONLY)
    > h = ts.hdrFromFdno(fd)
    > os.close(fd)
    >
    > flist = h.fiFromHeader()
    > for file in flist:
    > print file[0]
    >
    >
    >
    > Dan



    --
    Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
    happened but none stranger than this. Does your driver's license say Organ ..0
    Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
    individuals! What if this weren't a hypothetical question?
    steveo at syslang.net
    Steven W. Orr, Mar 4, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Chapman
    Replies:
    0
    Views:
    352
    Scott Chapman
    Oct 3, 2003
  2. Cliff Wells
    Replies:
    1
    Views:
    342
    Paul Boddie
    Oct 13, 2003
  3. Choo Zhi Min

    Cannot import Python 2.3.3 RPM GPG key

    Choo Zhi Min, May 11, 2004, in forum: Python
    Replies:
    1
    Views:
    518
    Paul Rubin
    May 11, 2004
  4. Zhi Min
    Replies:
    0
    Views:
    402
    Zhi Min
    Jun 11, 2004
  5. Joe Van Dyk

    Ruby program installed via RPM

    Joe Van Dyk, Aug 31, 2006, in forum: Ruby
    Replies:
    5
    Views:
    117
    Trans
    Aug 31, 2006
Loading...

Share This Page