Skip to content

Commit 557845b

Browse files
anatolallanmcrae
authored andcommitted
Convert downloading databases to the new multiplexed API
Signed-off-by: Anatol Pomozov <[email protected]> Signed-off-by: Allan McRae <[email protected]>
1 parent 0346e0e commit 557845b

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/pacman/util.c

+9-18
Original file line numberDiff line numberDiff line change
@@ -150,26 +150,17 @@ int check_syncdbs(size_t need_repos, int check_valid)
150150

151151
int sync_syncdbs(int level, alpm_list_t *syncs)
152152
{
153-
alpm_list_t *i;
154-
unsigned int success = 1;
155-
156-
for(i = syncs; i; i = alpm_list_next(i)) {
157-
alpm_db_t *db = i->data;
158-
159-
int ret = alpm_db_update((level < 2 ? 0 : 1), db);
160-
if(ret < 0) {
161-
pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"),
162-
alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle)));
163-
success = 0;
164-
} else if(ret == 1) {
165-
printf(_(" %s is up to date\n"), alpm_db_get_name(db));
166-
}
167-
}
153+
int ret;
154+
int force = (level < 2 ? 0 : 1);
168155

169-
if(!success) {
170-
pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases\n"));
156+
multibar_move_completed_up(false);
157+
ret = alpm_dbs_update(config->handle, syncs, force);
158+
if(ret < 0) {
159+
pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"),
160+
alpm_strerror(alpm_errno(config->handle)));
171161
}
172-
return (success > 0);
162+
163+
return (ret >= 0);
173164
}
174165

175166
/* discard unhandled input on the terminal's input buffer */

0 commit comments

Comments
 (0)