[pacman-dev] [PATCH 1/2] Log if dbs are up to date, synced, or failed to sync

Allan McRae allan at archlinux.org
Sun Dec 16 08:50:05 EST 2012


On 13/12/12 23:19, Olivier Brunel wrote:
> 
> Signed-off-by: Olivier Brunel <i.am.jack.mail at gmail.com>
> ---
> This simply adds information about what was actually done, I left the
> "synchronizing" message in case it's used by external tools (e.g. pacmatic).

Do we need output in all three cases?

I am just thinking about bloat in the log file.  A quick look in my
pacman log file indicates this would add another 60% lines to the log.
As this log should not be rotated, we do not want it too bloated.

Would it be better to just log when it is updated or failed, and log
nothing when nothing is done?

Opinions?


>  src/pacman/sync.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/pacman/sync.c b/src/pacman/sync.c
> index 532a667..f8fce7f 100644
> --- a/src/pacman/sync.c
> +++ b/src/pacman/sync.c
> @@ -331,12 +331,18 @@ static int sync_synctree(int level, alpm_list_t *syncs)
>  
>  		int ret = alpm_db_update((level < 2 ? 0 : 1), db);
>  		if(ret < 0) {
> +			alpm_logaction(config->handle, "failed to update %s (%s)\n",
> +					alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle)));
>  			pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"),
>  					alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle)));
>  		} else if(ret == 1) {
> +			alpm_logaction(config->handle, "%s is up to date\n",
> +					alpm_db_get_name(db));
>  			printf(_(" %s is up to date\n"), alpm_db_get_name(db));
>  			success++;
>  		} else {
> +			alpm_logaction(config->handle, "synchronized %s\n",
> +					alpm_db_get_name(db));
>  			success++;
>  		}
>  	}
> 



More information about the pacman-dev mailing list