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

Steven W. Orr steveo at syslang.net
Fri Mar 4 08:18:23 EST 2011


On 3/3/2011 11:11 PM, geremy condra wrote:
> On Thu, Mar 3, 2011 at 7:24 PM, Steven W. Orr<steveo at syslang.net>  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.

Thank you, but this is not what I was looking for. What I want is the same 
thing but uses the rpm module. After I get this piece of it working I'll be 
able to do the rest of what I want, but the important thing is that it happens 
in the context of import rpm.

Anyone?

>
> #! /usr/bin/env python
>
> import sys
> import commands
>
> if __name__ == "__main__":
>      rpm = sys.argv[1]
>      print commands.getoutput("rpm -pql %s" % rpm)
>
>
> Input validation and help text left as an exercise for the reader.
>
> Geremy Condra


-- 
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



More information about the Python-list mailing list