[yum-commits] Branch 'yum-3_2_X' - 3 commits - cli.py docs/yum.8 output.py yum/packages.py

James Antill james at osuosl.org
Wed Dec 23 14:17:59 UTC 2009


 cli.py          |    7 +++++--
 docs/yum.8      |    2 +-
 output.py       |   16 +++++++++++++++-
 yum/packages.py |    5 ++++-
 4 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 0e9665b9a1d315e70056b5ddf9e811f66943054d
Author: James Antill <james at and.org>
Date:   Tue Dec 22 17:33:08 2009 -0500

    Remove the copy and paste -e from the man page

diff --git a/docs/yum.8 b/docs/yum.8
index 487f5d5..257157d 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -307,7 +307,7 @@ Configuration Option: \fBdebuglevel\fP
 Sets the error level to [number] Practical range 0 \- 10. 0 means print only critical errors about which you must be told. 1 means print all errors, even ones that are not overly important. 1+ means print more errors (if any) \-e 0 is good for cron jobs.
 .br
 Configuration Option: \fBerrorlevel\fP
-.IP "\fB\-e, \-\-rpmverbosity=[name]\fP" 
+.IP "\fB\-\-rpmverbosity=[name]\fP" 
 Sets the debug level to [name] for rpm scriplets. 'info' is the default, other
 options are: 'critical', 'emergency', 'error', 'warn' and 'debug'.
 .br
commit 4b4410bb278e55da158612c98a3fc0c38ad1e68f
Author: James Antill <james at and.org>
Date:   Tue Dec 22 16:13:13 2009 -0500

    If we are only installing, display the amount of disk space used. BZ 487623

diff --git a/cli.py b/cli.py
index f787968..c563e63 100644
--- a/cli.py
+++ b/cli.py
@@ -375,8 +375,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         # Check which packages have to be downloaded
         downloadpkgs = []
         stuff_to_download = False
+        install_only = True
         for txmbr in self.tsInfo.getMembers():
-            if txmbr.ts_state in ['i', 'u']:
+            if txmbr.ts_state not in ('i', 'u'):
+                install_only = False
+            else:
                 stuff_to_download = True
                 po = txmbr.po
                 if po:
@@ -390,7 +393,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         # Report the total download size to the user, so he/she can base
         # the answer on this info
         if stuff_to_download:
-            self.reportDownloadSize(downloadpkgs)
+            self.reportDownloadSize(downloadpkgs, install_only)
         
         # confirm with user
         if self._promptWanted():
diff --git a/output.py b/output.py
index 7f92701..e1062d7 100755
--- a/output.py
+++ b/output.py
@@ -864,10 +864,11 @@ class YumOutput:
     def matchcallback_verbose(self, po, values, matchfor=None):
         return self.matchcallback(po, values, matchfor, verbose=True)
         
-    def reportDownloadSize(self, packages):
+    def reportDownloadSize(self, packages, installonly=False):
         """Report the total download size for a set of packages"""
         totsize = 0
         locsize = 0
+        insize  = 0
         error = False
         for pkg in packages:
             # Just to be on the safe side, if for some reason getting
@@ -881,6 +882,15 @@ class YumOutput:
                         locsize += size
                 except:
                     pass
+
+                if not installonly:
+                    continue
+
+                try:
+                    size = int(pkg.installedsize)
+                except:
+                    pass
+                insize += size
             except:
                 error = True
                 self.logger.error(_('There was an error calculating total download size'))
@@ -893,6 +903,10 @@ class YumOutput:
             if locsize != totsize:
                 self.verbose_logger.log(logginglevels.INFO_1, _("Total download size: %s"), 
                                         self.format_number(totsize - locsize))
+            if installonly:
+                self.verbose_logger.log(logginglevels.INFO_1,
+                                        _("Installed size: %s"),
+                                        self.format_number(insize))
             
     def listTransaction(self):
         """returns a string rep of the  transaction in an easy-to-read way."""
commit 4d2a8494e9aa34f2f51fac9d9000792ae34ad94b
Author: James Antill <james at and.org>
Date:   Tue Dec 22 16:10:07 2009 -0500

     Store downloaded packages in a temp. dir. (non-root is happy, and
    clenaup is done for us).

diff --git a/yum/packages.py b/yum/packages.py
index 2ed09c8..3455fab 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1755,7 +1755,10 @@ class YumUrlPackage(YumLocalPackage):
                     pd = repo.proxy_dict
                     break
             fname = os.path.basename(url)
-            local = "%s/%s" % (yb.conf.cachedir, fname)
+            local = misc.getCacheDir()
+            if local is None: # bugger...
+                local = "%s/../" % repo.cachedir
+            local = "%s/%s" % (local, fname)
             try:
                 ug = URLGrabber(bandwidth = yb.conf.bandwidth,
                                 retry = yb.conf.retries,


More information about the Yum-commits mailing list