Commit fbf69558 authored by Tim Lauridisen's avatar Tim Lauridisen

make it work with new Yum API (2.9.x) and replaced print statements with

python logging.
parent b3c69bea
......@@ -23,6 +23,7 @@
import sys
import os
import logging
import yum
import yum.Errors
from yum.misc import getCacheDir
......@@ -31,7 +32,6 @@ import rpmUtils.arch
from yum.constants import *
from yum.packageSack import ListPackageSack
def parseArgs():
usage = "usage: %s [-c <config file>] [-a <arch>] [-r <repoid>] [-r <repoid2>]" % sys.argv[0]
parser = OptionParser(usage=usage)
......@@ -53,9 +53,9 @@ def parseArgs():
class RepoClosure(yum.YumBase):
def __init__(self, arch = None, config = "/etc/yum.conf"):
self.logger = logging.getLogger("yum.verbose.repoclosure")
self.arch = arch
self.doConfigSetup(fn = config)
self.doConfigSetup(fn = config,init_plugins=False)
if hasattr(self.repos, 'sqlite'):
self.repos.sqlite = False
......@@ -129,9 +129,6 @@ class RepoClosure(yum.YumBase):
return unresolved
def log(self, value, msg):
def main():
(opts, cruft) = parseArgs()
......@@ -147,23 +144,23 @@ def main():
if os.geteuid() != 0 or opts.tempcache:
cachedir = getCacheDir()
if cachedir is None:
print "Error: Could not make cachedir, exiting"
my.logger.error("Error: Could not make cachedir, exiting")
if not opts.quiet:
print 'Reading in repository metadata - please wait....''Reading in repository metadata - please wait....')
except yum.Errors.RepoError, e:
print 'Filelists not available for repo: %s' % repo
print 'Some dependencies may not be complete for this repository'
print 'Run as root to get all dependencies or use -t to enable a user temp cache''Filelists not available for repo: %s' % repo)'Some dependencies may not be complete for this repository')'Run as root to get all dependencies or use -t to enable a user temp cache')
if not opts.quiet:
print 'Checking Dependencies''Checking Dependencies')
baddeps = my.getBrokenDeps(opts.newest)
if opts.newest:
......@@ -174,15 +171,15 @@ def main():
repos = my.repos.listEnabled()
if not opts.quiet:
print 'Repos looked at: %s' % len(repos)'Repos looked at: %s' % len(repos))
for repo in repos:
print ' %s' % repo
print 'Num Packages in Repos: %s' % num' %s' % repo)'Num Packages in Repos: %s' % num)
pkgs = baddeps.keys()
for pkg in pkgs:
print 'package: %s from %s\n unresolved deps: ' % (pkg, pkg.repoid)'package: %s from %s\n unresolved deps: ' % (pkg, pkg.repoid))
for (n, f, v) in baddeps[pkg]:
req = '%s' % n
if f:
......@@ -191,7 +188,7 @@ def main():
if v:
req = '%s %s' % (req, v)
print ' %s' % req' %s' % req)
if __name__ == "__main__":
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment