Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm.h18
-rw-r--r--lib/libalpm/be_sync.c7
-rw-r--r--lib/libalpm/sync.c6
-rw-r--r--src/pacman/callback.c15
4 files changed, 34 insertions, 12 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 2cf20343..a31f7a8a 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -402,12 +402,18 @@ typedef enum _alpm_event_type_t {
/** Scriptlet has printed information; See alpm_event_scriptlet_info_t for
* arguments. */
ALPM_EVENT_SCRIPTLET_INFO,
- /** Files will be downloaded from a repository. */
- 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,
+ /** Database files will be downloaded from a repository. */
+ ALPM_EVENT_DB_RETRIEVE_START,
+ /** Database files were downloaded from a repository. */
+ ALPM_EVENT_DB_RETRIEVE_DONE,
+ /** Not all database files were successfully downloaded from a repository. */
+ ALPM_EVENT_DB_RETRIEVE_FAILED,
+ /** Package files will be downloaded from a repository. */
+ ALPM_EVENT_PKG_RETRIEVE_START,
+ /** Package files were downloaded from a repository. */
+ ALPM_EVENT_PKG_RETRIEVE_DONE,
+ /** Not all package files were successfully downloaded from a repository. */
+ ALPM_EVENT_PKG_RETRIEVE_FAILED,
/** A file will be downloaded from a repository; See alpm_event_pkgdownload_t
* for arguments */
ALPM_EVENT_PKGDOWNLOAD_START,
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index b4a94315..add1a576 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -308,6 +308,7 @@ int SYMEXPORT alpm_dbs_update(alpm_handle_t *handle, alpm_list_t *dbs, int force
int ret = -1;
mode_t oldmask;
alpm_list_t *payloads = NULL;
+ alpm_event_t event;
/* Sanity checks */
CHECK_HANDLE(handle, return -1);
@@ -384,10 +385,16 @@ int SYMEXPORT alpm_dbs_update(alpm_handle_t *handle, alpm_list_t *dbs, int force
}
}
+ event.type = ALPM_EVENT_DB_RETRIEVE_START;
+ EVENT(handle, &event);
ret = _alpm_multi_download(handle, payloads, syncpath);
if(ret < 0) {
+ event.type = ALPM_EVENT_DB_RETRIEVE_FAILED;
+ EVENT(handle, &event);
goto cleanup;
}
+ event.type = ALPM_EVENT_DB_RETRIEVE_DONE;
+ EVENT(handle, &event);
for(i = dbs; i; i = i->next) {
alpm_db_t *db = i->data;
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 8a9dcae8..855ca69c 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -812,9 +812,9 @@ static int download_files(alpm_handle_t *handle)
}
}
- event.type = ALPM_EVENT_RETRIEVE_START;
+ event.type = ALPM_EVENT_PKG_RETRIEVE_START;
EVENT(handle, &event);
- event.type = ALPM_EVENT_RETRIEVE_DONE;
+ event.type = ALPM_EVENT_PKG_RETRIEVE_DONE;
for(i = files; i; i = i->next) {
const alpm_pkg_t *pkg = i->data;
struct dload_payload payload = {0};
@@ -825,7 +825,7 @@ static int download_files(alpm_handle_t *handle)
if(download_single_file(handle, &payload, cachedir) == -1) {
errors++;
- event.type = ALPM_EVENT_RETRIEVE_FAILED;
+ event.type = ALPM_EVENT_PKG_RETRIEVE_FAILED;
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files\n"));
}
_alpm_dload_payload_reset(&payload);
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 8fb89b39..a129758b 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -280,8 +280,12 @@ void cb_event(alpm_event_t *event)
case ALPM_EVENT_SCRIPTLET_INFO:
fputs(event->scriptlet_info.line, stdout);
break;
- case ALPM_EVENT_RETRIEVE_START:
+ case ALPM_EVENT_DB_RETRIEVE_START:
+ on_progress = 1;
+ break;
+ case ALPM_EVENT_PKG_RETRIEVE_START:
colon_printf(_("Retrieving packages...\n"));
+ on_progress = 1;
break;
case ALPM_EVENT_DISKSPACE_START:
if(config->noprogressbar) {
@@ -338,6 +342,13 @@ void cb_event(alpm_event_t *event)
}
}
break;
+ case ALPM_EVENT_DB_RETRIEVE_DONE:
+ case ALPM_EVENT_DB_RETRIEVE_FAILED:
+ case ALPM_EVENT_PKG_RETRIEVE_DONE:
+ case ALPM_EVENT_PKG_RETRIEVE_FAILED:
+ flush_output_list();
+ on_progress = 0;
+ break;
/* all the simple done events, with fallthrough for each */
case ALPM_EVENT_FILECONFLICTS_DONE:
case ALPM_EVENT_CHECKDEPS_DONE:
@@ -349,8 +360,6 @@ void cb_event(alpm_event_t *event)
case ALPM_EVENT_KEY_DOWNLOAD_DONE:
case ALPM_EVENT_LOAD_DONE:
case ALPM_EVENT_DISKSPACE_DONE:
- case ALPM_EVENT_RETRIEVE_DONE:
- case ALPM_EVENT_RETRIEVE_FAILED:
case ALPM_EVENT_HOOK_DONE:
case ALPM_EVENT_HOOK_RUN_DONE:
/* we can safely ignore those as well */