[yum-git] output.py

James Antill james at linux.duke.edu
Tue Jan 22 18:47:52 UTC 2008


 output.py |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 37ccb3fdbe5368c14d972e0979823f139ea79aa8
Author: James Antill <james at and.org>
Date:   Tue Jan 22 13:47:48 2008 -0500

    Calculate already downloaded package sizes, to make download size correct.

diff --git a/output.py b/output.py
index 76adbcd..89e4360 100644
--- a/output.py
+++ b/output.py
@@ -434,6 +434,7 @@ class YumOutput:
     def reportDownloadSize(self, packages):
         """Report the total download size for a set of packages"""
         totsize = 0
+        locsize = 0
         error = False
         for pkg in packages:
             # Just to be on the safe side, if for some reason getting
@@ -442,14 +443,23 @@ class YumOutput:
             try:
                 size = int(pkg.size)
                 totsize += size
+                try:
+                   if pkg.verifyLocalPkg():
+                       locsize += size
+                except:
+                   pass
             except:
                  error = True
                  self.logger.error('There was an error calculating total download size')
                  break
 
         if (not error):
-            self.verbose_logger.log(logginglevels.INFO_1, "Total download size: %s", 
-                self.format_number(totsize))
+            if locsize:
+                self.verbose_logger.log(logginglevels.INFO_1, "Total size: %s", 
+                                        self.format_number(totsize))
+            if locsize != totsize:
+                self.verbose_logger.log(logginglevels.INFO_1, "Total download size: %s", 
+                                        self.format_number(totsize - locsize))
             
     def listTransaction(self):
         """returns a string rep of the  transaction in an easy-to-read way."""



More information about the Yum-cvs-commits mailing list