Re: Command Line

Panu Matilainen <[email protected]> Wed, 24 Mar 2004 09:20:05 +0200 (EET)
Newsgroups gmane.linux.redhat.rpm.python
Message-ID <[email protected]>
On Tue, 23 Mar 2004, Rick Kornfeld wrote:
> 
> Are the command line options of RPM available to the programmer in
> rpm-python? For instance, can I use options like -force -nodeps etc..
> Programmatically in python. I know they are available in C/C++.

The API is available in python as well, but very little to do with command 
line options of rpm :)

> If so, can someone provide an example program?

You just set the same transaction/problemfilter flags as you would in 
C/C++. For example the equivalent of --force would be 

ts = rpm.TransactionSet()
ts.setProbFilter(rpm.RPMPROB_FILTER_REPLACEPKG | 
                 rpm.RPMPROB_FILTER_REPLACEOLDFILES | 
                 rpm.RPMPROB_FILTER_REPLACENEWFILES)
...
ts.run(...)

	- Panu -