mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
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>
This commit is contained in:
parent
d03b57f459
commit
842cbc9ea4
@ -246,7 +246,6 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
|
|||||||
size_t replaces = 0, current = 0, numtargs;
|
size_t replaces = 0, current = 0, numtargs;
|
||||||
int abort = 0;
|
int abort = 0;
|
||||||
alpm_list_t *targ;
|
alpm_list_t *targ;
|
||||||
pmpkg_t *pkg;
|
|
||||||
|
|
||||||
numtargs = alpm_list_count(trans->add);
|
numtargs = alpm_list_count(trans->add);
|
||||||
mount_points = mount_point_list();
|
mount_points = mount_point_list();
|
||||||
@ -259,24 +258,27 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
|
|||||||
if(replaces) {
|
if(replaces) {
|
||||||
numtargs += replaces;
|
numtargs += replaces;
|
||||||
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
||||||
|
pmpkg_t *local_pkg;
|
||||||
int percent = (current * 100) / numtargs;
|
int percent = (current * 100) / numtargs;
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
pkg = targ->data;
|
local_pkg = targ->data;
|
||||||
calculate_removed_size(mount_points, pkg);
|
calculate_removed_size(mount_points, local_pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(targ = trans->add; targ; targ = targ->next, current++) {
|
for(targ = trans->add; targ; targ = targ->next, current++) {
|
||||||
|
pmpkg_t *pkg, *local_pkg;
|
||||||
int percent = (current * 100) / numtargs;
|
int percent = (current * 100) / numtargs;
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
pkg = targ->data;
|
pkg = targ->data;
|
||||||
/* is this package already installed? */
|
/* is this package already installed? */
|
||||||
if(_alpm_db_get_pkgfromcache(db_local, pkg->name)) {
|
local_pkg = _alpm_db_get_pkgfromcache(db_local, pkg->name);
|
||||||
calculate_removed_size(mount_points, pkg);
|
if(local_pkg) {
|
||||||
|
calculate_removed_size(mount_points, local_pkg);
|
||||||
}
|
}
|
||||||
calculate_installed_size(mount_points, pkg);
|
calculate_installed_size(mount_points, pkg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user