[Yum-devel] Yum API: logging level, configuration, non-root questions

seth vidal skvidal at gmail.com
Mon Dec 6 01:36:18 UTC 2010


On Sun, 2010-12-05 at 17:19 +0000, Richard W.M. Jones wrote:
> I'm using the snippet of code below in order to resolve dependencies
> from a list of packages, and it works fine.
> 
> However there are some problems I can't work out how to fix:
> 
> (1) How do I emulate the '--quiet' command line option, ie. make it so
> that the yum libraries don't send lots of messages to stdout (which
> conflicts with the list that I want to write to stdout).


you probably want to use preconf so:

yb = yum.YumBase()
yb.preconf.debuglevel=0
yb.preconf.errorlevel=0



> (2) When I run this as non-root, it works, *unless* the yum repo is
> not up to date.  If the yum repo is not up to date then it fails
> because it tries to download and overwrite package lists in a
> root-owned directory.  Now obviously other tools eg. yumdownloader
> work fine as non-root.  How can I fix that?

yb.setCacheDir() 

will do all you want

> 
> (3) How can I make it use a non-default location for the yum
> configuration (instead of /etc/yum.conf /etc/yum.repos.d/*)?
> Alternately emulate --disablerepo/--enablerepo on the command line?

Do you want a different set of config files or a different set of repos
entirely?

like above
yb.preconf.fn = '/path/to/my/conf/file'

and then specifiy the .repos.d path in the conf file you made.


-sv







More information about the Yum-devel mailing list