pacman: send 'loading packages...' msg to stderr

Message ID 20220227011958.157762-1-jean@raby.sh
State New
Headers show
Series pacman: send 'loading packages...' msg to stderr | expand

Commit Message

Jean Raby Feb. 27, 2022, 1:19 a.m. UTC
This allows for parsing the output of:
    pacman --upgrade --print-format '<format>' pkg.zst

without having to remove info messages from it.

Signed-off-by: Jean Raby <jean@raby.sh>
---
 src/pacman/upgrade.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allan McRae March 6, 2022, 6:35 a.m. UTC | #1
On 27/2/22 11:19, Jean Raby wrote:
> This allows for parsing the output of:
>      pacman --upgrade --print-format '<format>' pkg.zst
> 
> without having to remove info messages from it.
> 

This is not the correct approach as the message is not an error.

I would consider a patch that silenced that output if --print was being 
used.

Allan

> Signed-off-by: Jean Raby <jean@raby.sh>
> ---
>   src/pacman/upgrade.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
> index 0691856f..6f70b115 100644
> --- a/src/pacman/upgrade.c
> +++ b/src/pacman/upgrade.c
> @@ -99,7 +99,7 @@ int pacman_upgrade(alpm_list_t *targets)
>   		goto fail_free;
>   	}
>   
> -	printf(_("loading packages...\n"));
> +	fprintf(stderr,_("loading packages...\n"));
>   	retval |= load_packages(local_targets, alpm_option_get_local_file_siglevel(config->handle));
>   	retval |= load_packages(fetched_files, alpm_option_get_remote_file_siglevel(config->handle));
>

Patch

diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 0691856f..6f70b115 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -99,7 +99,7 @@  int pacman_upgrade(alpm_list_t *targets)
 		goto fail_free;
 	}
 
-	printf(_("loading packages...\n"));
+	fprintf(stderr,_("loading packages...\n"));
 	retval |= load_packages(local_targets, alpm_option_get_local_file_siglevel(config->handle));
 	retval |= load_packages(fetched_files, alpm_option_get_remote_file_siglevel(config->handle));