[Yum-devel] Yum API Question

James Antill james at fedoraproject.org
Mon Jan 21 20:49:41 UTC 2013


On Sun, 2013-01-20 at 12:14 -0500, Keith Robertson wrote:
> Hi,
> 
> I've been trying to write some code which uses the Yum API to download 
> some packages based on an example in[1].  I have written a very simple 
> program[2] which is successfully downloading packages to an 
> 'installroot' of my choosing.  Unfortunately, I am getting some odd 
> exceptions that I am not quite sure how to fix.  I feel like there is an 
> initialization function(s) that I might be neglecting to call on YumBase 
> but I can't figure out what it is.  Importantly, the files do get 
> downloaded and unpacked into my 'installroot'.
> 
> Questions:
> 1) Should I just ignore/eat the error since the files do seem to get 
> downloaded?

 Eating all exceptions is generally a bad idea, but it depends on your
requirements.

> 2) Is there some initialization function I am neglecting to call or is 
> there a debug option I can use to squelch all output from yum (see 
> stacktrace in [3])?

 Two things:

1. You need to loop on yb.repos.listEnabled() and set that
repos. .gpgcheck = False ... by the time yb.conf is setup all the repos.
are loaded and so changing yb.conf.gpgcheck doesn't do much (when
packages are downloaded they just look at pkg.repo.gpgcheck to see if
they should check).
 As a hack (which the cli uses) you could also just set
yb._override_sigchecks=True.

2. If you are just downloading call downloadPkgs() instead of
processTransaction().



More information about the Yum-devel mailing list