[pacman-dev] [PATCH 2/3] Add events ALPM_EVENT_HOOK_{START, DONE}

Andrew Gregory andrew.gregory.8 at gmail.com
Mon Dec 14 15:59:48 UTC 2015


On 12/14/15 at 01:45pm, Allan McRae wrote:
> From: Olivier Brunel <jjk at jjacky.com>
> 
> Add events to let frontends know when hooks are being processed (and when it's
> done), as that might be useful to update the UI.
> 
> Signed-off-by: Olivier Brunel <jjk at jjacky.com>
> ---
>  lib/libalpm/alpm.h    | 24 +++++++++++++++++++++++-
>  lib/libalpm/hook.c    | 11 +++++++++--
>  lib/libalpm/hook.h    |  7 +------
>  src/pacman/callback.c |  6 ++++++
>  4 files changed, 39 insertions(+), 9 deletions(-)
...
> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> index 7a21b22..37966ab 100644
> --- a/src/pacman/callback.c
> +++ b/src/pacman/callback.c
> @@ -167,6 +167,11 @@ void cb_event(alpm_event_t *event)
>  		return;
>  	}
>  	switch(event->type) {
> +		case ALPM_EVENT_HOOK_START:
> +			colon_printf(_("Running %s hooks...\n"),
> +					event->hook.when == ALPM_HOOK_PRE_TRANSACTION
> +					? _("pre-transaction") : _("post-transaction"));

Is there any reason to break up this string like this?  Splitting it
and using substitution adds an extra string to be translated and
I would think translators would benefit from the extra context of the
full message.

> +			break;
>  		case ALPM_EVENT_CHECKDEPS_START:
>  			printf(_("checking dependencies...\n"));
>  			break;
> @@ -329,6 +334,7 @@ void cb_event(alpm_event_t *event)
>  		case ALPM_EVENT_DISKSPACE_DONE:
>  		case ALPM_EVENT_RETRIEVE_DONE:
>  		case ALPM_EVENT_RETRIEVE_FAILED:
> +		case ALPM_EVENT_HOOK_DONE:
>  		/* we can safely ignore those as well */
>  		case ALPM_EVENT_PKGDOWNLOAD_START:
>  		case ALPM_EVENT_PKGDOWNLOAD_DONE:
> -- 
> 2.6.4


More information about the pacman-dev mailing list