summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
authorXavier Chantry <chantry.xavier@gmail.com>2010-10-17 11:18:01 +0200
committerXavier Chantry <chantry.xavier@gmail.com>2011-01-29 19:39:05 +0100
commiteed7ba92e849edbd5505baa2c1d4864d0490fa80 (patch)
tree15ab42f331c66236bf216d34561db2cc27375cc2 /src/pacman
parent4a72c0964abc4b4836c2aafb9c59716299215802 (diff)
pacman/remove: switch to new alpm_remove_pkg interface
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/remove.c33
-rw-r--r--src/pacman/sync.c3
2 files changed, 32 insertions, 4 deletions
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 82d1c384..fb02e242 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -31,6 +31,36 @@
#include "util.h"
#include "conf.h"
+static int remove_target(char *target)
+{
+ pmpkg_t *info;
+ pmdb_t *db_local = alpm_option_get_localdb();
+ alpm_list_t *p;
+
+ if((info = alpm_db_get_pkg(db_local, target)) != NULL) {
+ if(alpm_remove_pkg(info) == -1) {
+ pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", target, alpm_strerrorlast());
+ return(-1);
+ }
+ return(0);
+ }
+
+ /* fallback to group */
+ pmgrp_t *grp = alpm_db_readgrp(db_local, target);
+ if(grp == NULL) {
+ pm_fprintf(stderr, PM_LOG_ERROR, "'%s': target not found\n", target);
+ return(-1);
+ }
+ for(p = alpm_grp_get_pkgs(grp); p; p = alpm_list_next(p)) {
+ pmpkg_t *pkg = alpm_list_getdata(p);
+ if(alpm_remove_pkg(pkg) == -1) {
+ pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", target, alpm_strerrorlast());
+ return(-1);
+ }
+ }
+ return(0);
+}
+
/**
* @brief Remove a specified list of packages.
*
@@ -62,8 +92,7 @@ int pacman_remove(alpm_list_t *targets)
} else {
targ = target;
}
- if(alpm_remove_target(targ) == -1) {
- pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", targ, alpm_strerrorlast());
+ if(remove_target(targ) == -1) {
retval = 1;
goto cleanup;
}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index deda77d4..63e5766e 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -636,8 +636,7 @@ static int process_group(alpm_list_t *dbs, char *group)
printf(_(":: There are %d members in group %s:\n"), count,
group);
select_display(pkgs);
- select_question(count,
- _("Which ones do you want to install?"));
+ select_question(count);
char *array = malloc(count);
memset(array, 1, count);
int n = 0;