diff options
author | Jonathan Dieter <jdieter@gmail.com> | 2007-04-04 17:35:37 +0300 |
---|---|---|
committer | Jonathan Dieter <jdieter@gmail.com> | 2007-04-04 17:35:37 +0300 |
commit | 1942f8d44c679fc612c97202727ce362c3acb130 (patch) | |
tree | 4af5637766d4e44e1b4bc451861a9281f839e123 /yum-presto/presto.py | |
parent | bdfb4037667c6af7d0537f9bc36b33d55d86e059 (diff) | |
download | presto-1942f8d44c679fc612c97202727ce362c3acb130.tar.gz presto-1942f8d44c679fc612c97202727ce362c3acb130.tar.xz presto-1942f8d44c679fc612c97202727ce362c3acb130.zip |
Add improved logging. Many bug fixes.
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
Diffstat (limited to 'yum-presto/presto.py')
-rw-r--r-- | yum-presto/presto.py | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/yum-presto/presto.py b/yum-presto/presto.py index e9908ee..a5bd77e 100644 --- a/yum-presto/presto.py +++ b/yum-presto/presto.py @@ -17,6 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Copyright 2005 Duke University +# Copyright 2007 Jonathan Dieter from yum.plugins import TYPE_INTERACTIVE, PluginYumExit from yum import config @@ -39,9 +40,12 @@ plugin_type = (TYPE_INTERACTIVE,) rpm_size = 0 drpm_size = 0 drpm_count = 0 +log = None # Configuration stuff -def config_hook(conduit): +def config_hook(conduit): + global log + # Set up repository specific deltarpm url and mirrorlist config.RepoConf.deltaurl = config.UrlListOption() config.RepoConf.deltamirrorlist = config.UrlOption() @@ -51,6 +55,9 @@ def config_hook(conduit): parser.add_option('', '--disablepresto', dest='disablepresto', action='store_true', default=False, help="disable Presto plugin and don't download any deltarpms") + + # Set up logging + log = prestoLog.PrestoLog(conduit, LOG_FILE) # Set up Presto repositories def postreposetup_hook(conduit): @@ -117,33 +124,40 @@ def postresolve_hook(conduit): def predownload_hook(conduit): global drpm_count + global log pkglist = conduit.getDownloadPackages() opts, commands = conduit.getCmdLine() if not opts.disablepresto and drpm_count > 0: + conduit.info(2, "Downloading DeltaRPMs:") + # Download deltarpms - problems = prestoDownload.downloadPkgs(conduit, pkglist) + problems = prestoDownload.downloadPkgs(conduit, pkglist, log) # If 'exitondownloaderror' is on, exit if conduit.confBool('main', 'exitondownloaderror') and len(problems.keys()) > 0: - errstring = '' - errstring += 'Error Downloading Packages:\n' + errstring = 'Error Downloading Packages:\n' for key in problems.keys(): errors = misc.unique(problems[key]) for error in errors: errstring += ' %s: %s\n' % (key, error) raise PluginYumExit(errstring) + else: + conduit.info(2, "Downloading RPMs:") def posttrans_hook(conduit): global rpm_size global drpm_size - global LOG_FILE + global log + + log.close() if rpm_size > 0: - prestoLog.log(conduit, LOG_FILE, rpm_size, drpm_size) - - conduit.info(2, "Size of all updates downloaded from Presto-enabled repositories: %i bytes" % drpm_size) - conduit.info(2, "Size of updates that would have been downloaded if Presto wasn't enabled: %i bytes" % rpm_size) + drpm_string = prestoTransaction.format_number(drpm_size) + rpm_string = prestoTransaction.format_number(rpm_size) + + conduit.info(2, "Size of all updates downloaded from Presto-enabled repositories: %s" % drpm_string) + conduit.info(2, "Size of updates that would have been downloaded if Presto wasn't enabled: %s" % rpm_string) conduit.info(2, "This is a savings of %i percent" % (100 - ((drpm_size * 100) / rpm_size))) |