[yum-cvs] yum-utils yumdownloader.py,1.10,1.11
Jeremy Katz
katzj at linux.duke.edu
Mon Sep 18 15:40:53 UTC 2006
Update of /home/groups/yum/cvs/yum-utils
In directory login1.linux.duke.edu:/tmp/cvs-serv30245
Modified Files:
yumdownloader.py
Log Message:
api fixes from tim
Index: yumdownloader.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/yumdownloader.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- yumdownloader.py 14 May 2006 14:08:27 -0000 1.10
+++ yumdownloader.py 18 Sep 2006 15:40:51 -0000 1.11
@@ -24,26 +24,25 @@
import output
import rpmUtils.arch
from urlgrabber.progress import TextMeter
-from yum.logger import Logger
+import logging
from yum.packages import parsePackages
from yum.misc import getCacheDir
from optparse import OptionParser
from urlparse import urljoin
def initYum():
+ global logger
my = yum.YumBase()
- my.doConfigSetup()
+ my.doConfigSetup(init_plugins=False) # init yum, without plugins
my.conf.uid = os.geteuid()
if my.conf.uid != 0:
cachedir = getCacheDir()
if cachedir is None:
- print "Error: Could not make cachedir, exiting"
+ logger.error("Error: Could not make cachedir, exiting")
sys.exit(50)
my.repos.setCacheDir(cachedir)
my.repos.setProgressBar(TextMeter(fo=sys.stdout))
- my.log = Logger(threshold=my.conf.debuglevel, file_object =sys.stdout)
- my.repos.callback = output.CacheProgressCallback(my.log,
- my.errorlog, my.filelog)
+ my.repos.callback = output.CacheProgressCallback()
return my
@@ -68,6 +67,8 @@
return (opts, args)
def main():
+ global logger
+ logger = logging.getLogger("yum.verbose.yumdownloader")
(opts, args) = parseArgs()
my = initYum()
@@ -168,11 +169,12 @@
local = os.path.join(opts.destdir, local)
if (os.path.exists(local) and
str(os.path.getsize(local)) == download.returnSimple('packagesize')):
- my.errorlog(0,"%s already exists and appears to be complete" % local)
+ logger.error("%s already exists and appears to be complete" % local)
continue
# Disable cache otherwise things won't download
repo.cache = 0
- repo.get(relative=remote, local=local)
+ download.localpath = local # Hack: to set the localpath we want.
+ repo.getPackage(download)
if __name__ == '__main__':
main()
More information about the Yum-cvs-commits
mailing list