From e9e0a1880c0233deeb9b88a08d9e58a680cf4fb9 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 5 Aug 2008 15:36:08 -0400 Subject: [PATCH] Move the yum object initialization to it's own function. This is necessary so that we can get a pypungi object without having to init the repositories. --- src/bin/pungi.py | 2 ++ src/pypungi/__init__.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bin/pungi.py b/src/bin/pungi.py index 2f9944ea..4c25ce76 100755 --- a/src/bin/pungi.py +++ b/src/bin/pungi.py @@ -82,6 +82,8 @@ def main(): mypungi = pypungi.Pungi(config, ksparser) if not opts.sourceisos: + if opts.do_all or opts.do_gather or opts.do_buildinstall: + mypungi._inityum() # initialize the yum object for things that need it if opts.do_all or opts.do_gather: mypungi.getPackageObjects() mypungi.downloadPackages() diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py index 6dcdc1d8..78e7c8fc 100644 --- a/src/pypungi/__init__.py +++ b/src/pypungi/__init__.py @@ -129,10 +129,13 @@ class Pungi(pypungi.PungiBase): self.srpmlist = [] self.debuginfolist = [] self.resolved_deps = {} # list the deps we've already resolved, short circuit. - self.repos = [] - self.mirrorlists = [] + + def _inityum(self): + """Initialize the yum object. Only needed for certain actions.""" # Create a yum object to use + self.repos = [] + self.mirrorlists = [] self.ayum = PungiYum(config) self.ayum.doLoggingSetup(6, 6) yumconf = yum.config.YumConf()