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 01-10-2011, 01:50 AM
Dan McGee
 
Default Ensure we use local package when calculating removed size

We were checking if a package existed locally, but then using the
incoming package to calculate removed size rather than the currently
installed package.

Also adjust the local variable in the replaces loop to make it more
clear that we are always dealing with local packages here.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/diskspace.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index d0f6c64..045369d 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -248,7 +248,6 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
size_t replaces = 0, current = 0, numtargs;
int abort = 0;
alpm_list_t *targ;
- pmpkg_t *pkg;

numtargs = alpm_list_count(trans->add);
mount_points = mount_point_list();
@@ -261,24 +260,27 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
if(replaces) {
numtargs += replaces;
for(targ = trans->remove; targ; targ = targ->next, current++) {
+ pmpkg_t *local_pkg;
int percent = (current * 100) / numtargs;
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
numtargs, current);

- pkg = targ->data;
- calculate_removed_size(mount_points, pkg);
+ local_pkg = targ->data;
+ calculate_removed_size(mount_points, local_pkg);
}
}

for(targ = trans->add; targ; targ = targ->next, current++) {
+ pmpkg_t *pkg, *local_pkg;
int percent = (current * 100) / numtargs;
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
numtargs, current);

pkg = targ->data;
/* is this package already installed? */
- if(_alpm_db_get_pkgfromcache(db_local, pkg->name)) {
- calculate_removed_size(mount_points, pkg);
+ local_pkg = _alpm_db_get_pkgfromcache(db_local, pkg->name);
+ if(local_pkg) {
+ calculate_removed_size(mount_points, local_pkg);
}
calculate_installed_size(mount_points, pkg);

--
1.7.3.5
 

Thread Tools




All times are GMT. The time now is 11:51 PM.

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