libalpm: fix total download reporting wrong total
When a package does not need to be downloaded but a signature does, total download didn't count that towards the total. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
b40c5553b4
commit
ab549c8467
1 changed files with 7 additions and 9 deletions
|
@ -755,6 +755,11 @@ static int download_files(alpm_handle_t *handle)
|
||||||
cachedir = _alpm_filecache_setup(handle);
|
cachedir = _alpm_filecache_setup(handle);
|
||||||
handle->trans->state = STATE_DOWNLOADING;
|
handle->trans->state = STATE_DOWNLOADING;
|
||||||
|
|
||||||
|
ret = find_dl_candidates(handle, &files);
|
||||||
|
if(ret != 0) {
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
/* Total progress - figure out the total download size if required to
|
/* Total progress - figure out the total download size if required to
|
||||||
* pass to the callback. This function is called once, and it is up to the
|
* pass to the callback. This function is called once, and it is up to the
|
||||||
* frontend to compute incremental progress. */
|
* frontend to compute incremental progress. */
|
||||||
|
@ -762,21 +767,14 @@ static int download_files(alpm_handle_t *handle)
|
||||||
off_t total_size = (off_t)0;
|
off_t total_size = (off_t)0;
|
||||||
size_t howmany = 0;
|
size_t howmany = 0;
|
||||||
/* sum up the download size for each package and store total */
|
/* sum up the download size for each package and store total */
|
||||||
for(i = handle->trans->add; i; i = i->next) {
|
for(i = files; i; i = i->next) {
|
||||||
alpm_pkg_t *spkg = i->data;
|
alpm_pkg_t *spkg = i->data;
|
||||||
total_size += spkg->download_size;
|
total_size += spkg->download_size;
|
||||||
if(spkg->download_size > 0) {
|
|
||||||
howmany++;
|
howmany++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
handle->totaldlcb(howmany, total_size);
|
handle->totaldlcb(howmany, total_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = find_dl_candidates(handle, &files);
|
|
||||||
if(ret != 0) {
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(files) {
|
if(files) {
|
||||||
/* check for necessary disk space for download */
|
/* check for necessary disk space for download */
|
||||||
if(handle->checkspace) {
|
if(handle->checkspace) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue