Add events ALPM_EVENT_RETRIEVE_{DONE, FAILED}
To go along with RETRIEVE_START, one other event will be emmitted once the downloads are done: RETRIEVE_DONE if all files were successfully downloaded, else RETRIEVE_FAILED. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
cd793c5ab7
commit
01cc55a1f4
3 changed files with 9 additions and 0 deletions
|
@ -318,6 +318,10 @@ typedef enum _alpm_event_type_t {
|
||||||
ALPM_EVENT_SCRIPTLET_INFO,
|
ALPM_EVENT_SCRIPTLET_INFO,
|
||||||
/** Files will be downloaded from a repository. */
|
/** Files will be downloaded from a repository. */
|
||||||
ALPM_EVENT_RETRIEVE_START,
|
ALPM_EVENT_RETRIEVE_START,
|
||||||
|
/** Files were downloaded from a repository. */
|
||||||
|
ALPM_EVENT_RETRIEVE_DONE,
|
||||||
|
/** Not all files were successfully downloaded from a repository. */
|
||||||
|
ALPM_EVENT_RETRIEVE_FAILED,
|
||||||
/** Disk space usage will be computed for a package. */
|
/** Disk space usage will be computed for a package. */
|
||||||
ALPM_EVENT_DISKSPACE_START,
|
ALPM_EVENT_DISKSPACE_START,
|
||||||
/** Disk space usage was computed for a package. */
|
/** Disk space usage was computed for a package. */
|
||||||
|
|
|
@ -977,12 +977,15 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||||
|
|
||||||
event.type = ALPM_EVENT_RETRIEVE_START;
|
event.type = ALPM_EVENT_RETRIEVE_START;
|
||||||
EVENT(handle, &event);
|
EVENT(handle, &event);
|
||||||
|
event.type = ALPM_EVENT_RETRIEVE_DONE;
|
||||||
for(i = files; i; i = i->next) {
|
for(i = files; i; i = i->next) {
|
||||||
if(download_single_file(handle, i->data, cachedir) == -1) {
|
if(download_single_file(handle, i->data, cachedir) == -1) {
|
||||||
errors++;
|
errors++;
|
||||||
|
event.type = ALPM_EVENT_RETRIEVE_FAILED;
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files\n"));
|
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EVENT(handle, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
|
|
@ -300,6 +300,8 @@ void cb_event(alpm_event_t *event)
|
||||||
case ALPM_EVENT_DELTA_INTEGRITY_DONE:
|
case ALPM_EVENT_DELTA_INTEGRITY_DONE:
|
||||||
case ALPM_EVENT_DELTA_PATCHES_DONE:
|
case ALPM_EVENT_DELTA_PATCHES_DONE:
|
||||||
case ALPM_EVENT_DISKSPACE_DONE:
|
case ALPM_EVENT_DISKSPACE_DONE:
|
||||||
|
case ALPM_EVENT_RETRIEVE_DONE:
|
||||||
|
case ALPM_EVENT_RETRIEVE_FAILED:
|
||||||
/* nothing */
|
/* nothing */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue