summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXavier Chantry <chantry.xavier@gmail.com>2010-10-12 20:27:49 +0200
committerDan McGee <dan@archlinux.org>2010-12-13 03:08:16 +0100
commit8791ae0fdac16419d25e18acd245a65879807eb8 (patch)
treeaac87b096ad438dbdb69b3d92850736a3327dfdb /src
parenta03daad0734428ded0398c9d71582f90063f3493 (diff)
downloadpacman-8791ae0fdac16419d25e18acd245a65879807eb8.tar.gz
pacman-8791ae0fdac16419d25e18acd245a65879807eb8.tar.xz
pacman/deptest: reimplement with alpm_find_satisfier
It's very easy to re-implement the -T feature with the more generic alpm_find_satisfier rather then the more specific and less useful alpm_deptest. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/deptest.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index f043c201..82c0cd6f 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -35,16 +35,24 @@
int pacman_deptest(alpm_list_t *targets)
{
alpm_list_t *i;
+ alpm_list_t *deps = NULL;
+ pmdb_t *localdb = alpm_option_get_localdb();
+
+ for(i = targets; i; i = alpm_list_next(i)) {
+ char *target = alpm_list_getdata(i);
+
+ if(!alpm_find_satisfier(alpm_db_get_pkgcache(localdb), target)) {
+ deps = alpm_list_add(deps, target);
+ }
+ }
- alpm_list_t *deps = alpm_deptest(alpm_option_get_localdb(), targets);
if(deps == NULL) {
return(0);
}
for(i = deps; i; i = alpm_list_next(i)) {
- const char *dep;
+ const char *dep = alpm_list_getdata(i);
- dep = alpm_list_getdata(i);
printf("%s\n", dep);
}
alpm_list_free(deps);