[pacman-dev] [PATCH] remove.c: downgrade TRANS_DUP_TARGET to warning
Allan McRae
allan at archlinux.org
Wed May 7 00:14:22 EDT 2014
On 06/05/14 12:34, Andrew Gregory wrote:
> Matches the behavior for sync packages.
>
> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
>
> src/pacman/remove.c | 12 +++++++++---
> test/pacman/tests/remove001.py | 4 ++--
> 2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/src/pacman/remove.c b/src/pacman/remove.c
> index 933e6f7..38ad2a2 100644
> --- a/src/pacman/remove.c
> +++ b/src/pacman/remove.c
> @@ -43,9 +43,15 @@ static int remove_target(const char *target)
>
> if((pkg = alpm_db_get_pkg(db_local, target)) != NULL) {
> if(alpm_remove_pkg(config->handle, pkg) == -1) {
> - pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target,
> - alpm_strerror(alpm_errno(config->handle)));
> - return -1;
> + alpm_errno_t err = alpm_errno(config->handle);
> + if(err == ALPM_ERR_TRANS_DUP_TARGET) {
> + /* just skip duplicate targets */
> + pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), target);
Ack.
It would be good if this message could be clarified here and in other
places. How about "skipping duplicate target:"?
> + return 0;
> + } else {
> + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(err));
> + return -1;
> + }
> }
> config->explicit_removes = alpm_list_add(config->explicit_removes, pkg);
> return 0;
> diff --git a/test/pacman/tests/remove001.py b/test/pacman/tests/remove001.py
> index 02d00a4..263418b 100644
> --- a/test/pacman/tests/remove001.py
> +++ b/test/pacman/tests/remove001.py
> @@ -5,5 +5,5 @@
>
> self.args = "-R " + "foo "*5
>
> -self.addrule("PACMAN_RETCODE=1")
> -self.addrule("PKG_EXIST=foo")
> +self.addrule("PACMAN_RETCODE=0")
> +self.addrule("!PKG_EXIST=foo")
>
More information about the pacman-dev
mailing list