summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2020-04-19 04:05:13 +0200
committerAllan McRae <allan@archlinux.org>2020-05-09 03:58:39 +0200
commit557845bc971ff272c53da773baea277a2d2d47b8 (patch)
treebc0e6cebfeebc84baac7fa76c8344c3977cc9057
parent0346e0eef224ab8ba22b659026ffdf2bfe95f3ae (diff)
downloadpacman-557845bc971ff272c53da773baea277a2d2d47b8.tar.gz
pacman-557845bc971ff272c53da773baea277a2d2d47b8.tar.xz
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>
-rw-r--r--src/pacman/util.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 03035037..9422c0c3 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -150,26 +150,17 @@ int check_syncdbs(size_t need_repos, int check_valid)
int sync_syncdbs(int level, alpm_list_t *syncs)
{
- alpm_list_t *i;
- unsigned int success = 1;
-
- for(i = syncs; i; i = alpm_list_next(i)) {
- alpm_db_t *db = i->data;
-
- int ret = alpm_db_update((level < 2 ? 0 : 1), db);
- if(ret < 0) {
- pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"),
- alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle)));
- success = 0;
- } else if(ret == 1) {
- printf(_(" %s is up to date\n"), alpm_db_get_name(db));
- }
- }
+ int ret;
+ int force = (level < 2 ? 0 : 1);
- if(!success) {
- pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases\n"));
+ multibar_move_completed_up(false);
+ ret = alpm_dbs_update(config->handle, syncs, force);
+ if(ret < 0) {
+ pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"),
+ alpm_strerror(alpm_errno(config->handle)));
}
- return (success > 0);
+
+ return (ret >= 0);
}
/* discard unhandled input on the terminal's input buffer */