summaryrefslogtreecommitdiffstats
path: root/presto.py
diff options
context:
space:
mode:
authorJonathan Dieter <jdieter@gmail.com>2007-03-26 09:29:05 +0300
committerJonathan Dieter <jdieter@gmail.com>2007-03-26 09:29:05 +0300
commitfefaa0389539e4433d6ae4d0c85a459304bbbbe6 (patch)
treef1e2e8b58ae4930596d6d6d330291436636d711c /presto.py
parentfff4696a43faa32f41d5c1726847b51c68db8d60 (diff)
downloadpresto-fefaa0389539e4433d6ae4d0c85a459304bbbbe6.tar.gz
presto-fefaa0389539e4433d6ae4d0c85a459304bbbbe6.tar.xz
presto-fefaa0389539e4433d6ae4d0c85a459304bbbbe6.zip
Added logging to /var/log/presto.log
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
Diffstat (limited to 'presto.py')
-rw-r--r--presto.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/presto.py b/presto.py
index 1427a90..3db6e93 100644
--- a/presto.py
+++ b/presto.py
@@ -29,12 +29,15 @@ import deltarpm
from prestoRepo import PrestoRepository
from prestomdparser import PrestoMDParser
import prestoTransaction
+import prestoLog
requires_api_version = '2.1'
+LOG_FILE = "/var/log/presto.log"
plugin_type = (TYPE_INTERACTIVE,)
rpm_size = 0
drpm_size = 0
+was_drpm = False
# Configuration stuff
def config_hook(conduit):
@@ -74,6 +77,7 @@ def prereposetup_hook(conduit):
def postresolve_hook(conduit):
global rpm_size
global drpm_size
+ global was_drpm
opts, commands = conduit.getCmdLine()
if not opts.disablepresto:
@@ -85,6 +89,7 @@ def postresolve_hook(conduit):
# If a drpm was found, change certain package information so it reflects
# the drpm, not the rpm.
if chosen_drpm != None:
+ was_drpm = True
rpm_size += int(newpkg.po.simple['packagesize'])
drpm_size += int(chosen_drpm['size'])
newpkg.po.hasdrpm = True
@@ -123,8 +128,10 @@ def postresolve_hook(conduit):
del active_repo.p_repo
def postdownload_hook(conduit):
+ global was_drpm
+
opts, commands = conduit.getCmdLine()
- if not opts.disablepresto:
+ if not opts.disablepresto and was_drpm:
failure = False
# Cycle through packages to see if we've downloaded a deltarpm
conduit.info(2, "Rebuilding full packages from deltas")
@@ -171,8 +178,11 @@ def postdownload_hook(conduit):
def posttrans_hook(conduit):
global rpm_size
global drpm_size
+ global LOG_FILE
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 updates would have been downloaded if Presto wasn't enabled: %i bytes" % rpm_size)
conduit.info(2, "This is a savings of %i percent" % (100 - ((drpm_size * 100) / rpm_size)))