FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-01-2011, 10:13 PM
Dan McGee
 
Default Show net upgrade size on -U/-S operations

If it is different than the raw installed size metric we already show,
compute the net upgrade size. For some sync operations, this can even be
negative if newer packages are smaller than the ones they replace
locally. Implements FS#12566.

Example:

Targets (1): telepathy-glib-0.14.7-1

Total Download Size: 1.07 MiB
Total Installed Size: 15.72 MiB
Net Upgrade Size: -0.29 MiB

Signed-off-by: Dan McGee <dan@archlinux.org>
---
src/pacman/remove.c | 2 +-
src/pacman/util.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 58e6edd..094a43b 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -31,7 +31,7 @@
#include "util.h"
#include "conf.h"

-static int remove_target(char *target)
+static int remove_target(const char *target)
{
pmpkg_t *info;
pmdb_t *db_local = alpm_option_get_localdb();
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 8631075..bfc707c 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -688,8 +688,9 @@ void display_targets(const alpm_list_t *pkgs, int install)
const char *title, *label;
double size;
const alpm_list_t *i;
- off_t isize = 0, dlsize = 0;
+ off_t isize = 0, rsize = 0, dlsize = 0;
alpm_list_t *j, *lp, *header = NULL, *targets = NULL;
+ pmdb_t *db_local = alpm_option_get_localdb();

if(!pkgs) {
return;
@@ -700,7 +701,12 @@ void display_targets(const alpm_list_t *pkgs, int install)
pmpkg_t *pkg = alpm_list_getdata(i);

if(install) {
+ pmpkg_t *lpkg = alpm_db_get_pkg(db_local, alpm_pkg_get_name(pkg));
dlsize += alpm_pkg_download_size(pkg);
+ if(lpkg) {
+ /* add up size of all removed packages */
+ rsize += alpm_pkg_get_isize(lpkg);
+ }
}
isize += alpm_pkg_get_isize(pkg);

@@ -736,6 +742,11 @@ void display_targets(const alpm_list_t *pkgs, int install)
if(!(config->flags & PM_TRANS_FLAG_DOWNLOADONLY)) {
size = humanize_size(isize, 'M', 1, &label);
printf(_("Total Installed Size: %.2f %s
"), size, label);
+ /* only show this net value if different from raw installed size */
+ if(rsize > 0) {
+ size = humanize_size(isize - rsize, 'M', 1, &label);
+ printf(_("Net Upgrade Size: %.2f %s
"), size, label);
+ }
}
} else {
size = humanize_size(isize, 'M', 1, &label);
--
1.7.5.2
 

Thread Tools




All times are GMT. The time now is 10:00 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org