summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2021-03-16 00:33:08 +0100
committerAllan McRae <allan@archlinux.org>2021-03-25 02:39:03 +0100
commit1e60a5f00674a9a9b0c530c741bd6701d0e1e834 (patch)
tree8539fba8183d42179f6b5504f32725bd1901de4c /src
parent9bf3d6a7603bf48771a20d1f4bd789670e7446f7 (diff)
downloadpacman-1e60a5f00674a9a9b0c530c741bd6701d0e1e834.tar.gz
pacman-1e60a5f00674a9a9b0c530c741bd6701d0e1e834.tar.xz
Remove "total download" callback in favor of generic event callback
Total download callback called right before packages start downloaded. But we already have an event for such event (ALPM_EVENT_PKG_RETRIEVE_START) and it is naturally to use the event to pass information about expected download size. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/callback.c9
-rw-r--r--src/pacman/callback.h2
-rw-r--r--src/pacman/conf.c4
3 files changed, 2 insertions, 13 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 40973340..a28a79a9 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -338,6 +338,8 @@ void cb_event(alpm_event_t *event)
case ALPM_EVENT_PKG_RETRIEVE_START:
colon_printf(_("Retrieving packages...\n"));
on_progress = 1;
+ list_total_pkgs = event->pkg_retrieve.num;
+ list_total = event->pkg_retrieve.total_size;
total_enabled = config->totaldownload && list_total;
if(total_enabled) {
init_total_progressbar();
@@ -696,13 +698,6 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
}
}
-/* callback to handle receipt of total download value */
-void cb_dl_total(size_t howmany, off_t total)
-{
- list_total_pkgs = howmany;
- list_total = total;
-}
-
static int dload_progressbar_enabled(void)
{
return !config->noprogressbar && (getcols() != 0);
diff --git a/src/pacman/callback.h b/src/pacman/callback.h
index 9b5deb6f..8ac9d960 100644
--- a/src/pacman/callback.h
+++ b/src/pacman/callback.h
@@ -35,8 +35,6 @@ void cb_question(alpm_question_t *question);
void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
size_t howmany, size_t remain);
-/* callback to handle receipt of total download value */
-void cb_dl_total(size_t howmany, off_t total);
/* callback to handle display of download progress */
void cb_download(const char *filename, alpm_download_event_type_t event,
void *data);
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 96e5790f..a4f2ba35 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -892,10 +892,6 @@ static int setup_libalpm(void)
pm_printf(ALPM_LOG_WARNING, _("no '%s' configured\n"), "XferCommand");
}
- if(config->totaldownload) {
- alpm_option_set_totaldlcb(handle, cb_dl_total);
- }
-
alpm_option_set_arch(handle, config->arch);
alpm_option_set_checkspace(handle, config->checkspace);
alpm_option_set_usesyslog(handle, config->usesyslog);