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

Andrew Gregory andrew.gregory.8 at gmail.com
Mon Dec 14 16:05:23 UTC 2015


On 12/14/15 at 01:45pm, Allan McRae wrote:
> This provides a way to detect when the processing of package changes starts,
> allowing pacman to deliminate hook output and package installation/removal

s/deliminate/delineate/?

> output.
> 
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  lib/libalpm/alpm.h    | 4 ++++
>  lib/libalpm/trans.c   | 5 +++++
>  src/pacman/callback.c | 4 ++++
>  3 files changed, 13 insertions(+)
...
> diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
> index 06997a0..0ead10d 100644
> --- a/lib/libalpm/trans.c
> +++ b/lib/libalpm/trans.c
> @@ -160,6 +160,7 @@ int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data)
>  int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
>  {
>  	alpm_trans_t *trans;
> +	alpm_event_any_t event;
>  
>  	/* Sanity checks */
>  	CHECK_HANDLE(handle, return -1);
> @@ -197,6 +198,8 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
>  	trans->state = STATE_COMMITING;
>  
>  	alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction started\n");
> +	event.type = ALPM_EVENT_TRANSACTION_START;
> +	EVENT(handle, &event);
>  
>  	if(trans->add == NULL) {
>  		if(_alpm_remove_packages(handle, 1) == -1) {
> @@ -222,6 +225,8 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
>  		alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction completed\n");
>  		_alpm_hook_run(handle, ALPM_HOOK_POST_TRANSACTION);
>  	}
> +	event.type = ALPM_EVENT_TRANSACTION_DONE;
> +	EVENT(handle, &event);

You have the pre-transaction hooks outside the transaction events but
the post hooks inside them.


More information about the pacman-dev mailing list