From 7edeb276b63efeea7e8f266dfee792e2709ba412 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 29 Jul 2011 15:35:59 -0500 Subject: Keep track of explicitly added and removed packages This allows us to sort the output list by showing all pulled dependencies first, followed by the explicitly specified targets. Signed-off-by: Dan McGee --- src/pacman/remove.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/pacman/remove.c') diff --git a/src/pacman/remove.c b/src/pacman/remove.c index 95a728ee..3fc8279c 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -33,16 +33,17 @@ static int remove_target(const char *target) { - alpm_pkg_t *info; + alpm_pkg_t *pkg; alpm_db_t *db_local = alpm_option_get_localdb(config->handle); alpm_list_t *p; - if((info = alpm_db_get_pkg(db_local, target)) != NULL) { - if(alpm_remove_pkg(config->handle, info) == -1) { + if((pkg = alpm_db_get_pkg(db_local, target)) != NULL) { + if(alpm_remove_pkg(config->handle, pkg) == -1) { pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(alpm_errno(config->handle))); return -1; } + config->explicit_removes = alpm_list_add(config->explicit_removes, pkg); return 0; } @@ -53,12 +54,13 @@ static int remove_target(const char *target) return -1; } for(p = grp->packages; p; p = alpm_list_next(p)) { - alpm_pkg_t *pkg = alpm_list_getdata(p); + pkg = alpm_list_getdata(p); if(alpm_remove_pkg(config->handle, pkg) == -1) { pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(alpm_errno(config->handle))); return -1; } + config->explicit_removes = alpm_list_add(config->explicit_removes, pkg); } return 0; } -- cgit v1.2.3-24-g4f1b