Convert downloading databases to the new multiplexed API

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Anatol Pomozov 2020-04-18 19:05:13 -07:00 committed by Allan McRae
parent 0346e0eef2
commit 557845bc97

View file

@ -150,26 +150,17 @@ int check_syncdbs(size_t need_repos, int check_valid)
int sync_syncdbs(int level, alpm_list_t *syncs) int sync_syncdbs(int level, alpm_list_t *syncs)
{ {
alpm_list_t *i; int ret;
unsigned int success = 1; int force = (level < 2 ? 0 : 1);
for(i = syncs; i; i = alpm_list_next(i)) { multibar_move_completed_up(false);
alpm_db_t *db = i->data; ret = alpm_dbs_update(config->handle, syncs, force);
int ret = alpm_db_update((level < 2 ? 0 : 1), db);
if(ret < 0) { if(ret < 0) {
pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"), pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"),
alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle))); alpm_strerror(alpm_errno(config->handle)));
success = 0;
} else if(ret == 1) {
printf(_(" %s is up to date\n"), alpm_db_get_name(db));
}
} }
if(!success) { return (ret >= 0);
pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases\n"));
}
return (success > 0);
} }
/* discard unhandled input on the terminal's input buffer */ /* discard unhandled input on the terminal's input buffer */