* report total size for install and upgrade ops correctly

This commit is contained in:
Eray Özkural
2006-05-08 09:22:21 +00:00
parent 3a6946623f
commit 46472e47cb
2 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ class CLI(UI):
return False
def display_progress(self, **ka):
totalsize = '%4.1f %s' % pisi.util.human_readable_size(ka['total_size'])
totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size'])
out = '\r%-30.30s (%s)%3d%% %9.2f %s [%s]' % \
(ka['filename'], totalsize, ka['percent'],
ka['rate'], ka['symbol'], ka['eta'])
+8 -10
View File
@@ -285,19 +285,13 @@ def install_pkg_names(A, reinstall = False, bypass_safety = False):
G_f = None
order = A
ctx.ui.info(_("""The following minimal list of packages will be installed
ctx.ui.info(_("""Following packages will be installed
in the respective order to satisfy dependencies:
""") + util.strlist(order))
#this silly try/except block will be removed soon..
try:
total_size = sum([packagedb.get_package(p).packageSize for p in order])
except:
total_size = 0
if total_size:
total_size, symbol = util.human_readable_size(total_size)
ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))
total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
total_size, symbol = util.human_readable_size(total_size)
ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))
if ctx.get_option('dry_run'):
return
@@ -400,6 +394,10 @@ def upgrade_pkg_names(A = [], bypass_safety = False):
ctx.ui.info(_('The following packages will be upgraded: ') +
util.strlist(order))
total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
total_size, symbol = util.human_readable_size(total_size)
ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))
if ctx.get_option('dry_run'):
return