Delay check for repository servers until we need them

In the sync download code, we added an early check in 6731d0a940 for
sync download server existence so we wouldn't show the same error over
and over for each file to be downloaded. Move this check into the
download block so we only run it if there are actually files that need
to be downloaded for this repository.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-09-27 07:53:38 -05:00
parent 5e13b2b6af
commit 47657107af

View file

@ -815,14 +815,6 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
for(i = handle->dbs_sync; i; i = i->next) { for(i = handle->dbs_sync; i; i = i->next) {
alpm_db_t *current = i->data; alpm_db_t *current = i->data;
if(!current->servers) {
handle->pm_errno = ALPM_ERR_SERVER_NONE;
_alpm_log(handle, ALPM_LOG_ERROR, "%s: %s\n",
alpm_strerror(handle->pm_errno), current->treename);
errors++;
continue;
}
for(j = handle->trans->add; j; j = j->next) { for(j = handle->trans->add; j; j = j->next) {
alpm_pkg_t *spkg = j->data; alpm_pkg_t *spkg = j->data;
@ -861,6 +853,14 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
} }
if(files) { if(files) {
if(!current->servers) {
handle->pm_errno = ALPM_ERR_SERVER_NONE;
_alpm_log(handle, ALPM_LOG_ERROR, "%s: %s\n",
alpm_strerror(handle->pm_errno), current->treename);
errors++;
continue;
}
EVENT(handle, ALPM_EVENT_RETRIEVE_START, current->treename, NULL); EVENT(handle, ALPM_EVENT_RETRIEVE_START, current->treename, NULL);
for(j = files; j; j = j->next) { for(j = files; j; j = j->next) {
struct dload_payload *payload = j->data; struct dload_payload *payload = j->data;