summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Fyfe <andrew@neptune-one.net>2007-06-29 10:41:48 +0100
committerDan McGee <dan@archlinux.org>2007-07-10 10:15:24 -0400
commit5e68e9d4514b5e3e50b25e4242be0a4d27da4fdc (patch)
tree6b61df2634a80fe71844888b8bfb32e596dfcf85 /src
parent7ec2e088ec4995e370d991507f7f22a5d3d9b27a (diff)
downloadpacman-5e68e9d4514b5e3e50b25e4242be0a4d27da4fdc.tar.xz
Cleanup of pacman_deptest()
Clean up some left over code from http://projects.archlinux.org/git/gitweb.cgi?p=pacman.git;a=commitdiff;h=7653bb93997f52848b54ab80868cd6da52808a75 Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/deptest.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 5addfb32..0f149b28 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -35,6 +35,7 @@
extern config_t *config;
+/* TODO: This should use _alpm_checkdeps() */
int pacman_deptest(alpm_list_t *targets)
{
int retval = 0;
@@ -52,20 +53,16 @@ int pacman_deptest(alpm_list_t *targets)
alpm_list_t *j, *provides;
target = alpm_list_getdata(i);
-
- /* splitdep modifies the string... we'll compensate for now */
- char *saved_target = NULL;
- saved_target = calloc(strlen(target)+1, sizeof(char));
- strncpy(saved_target, target, strlen(target));
-
dep = alpm_splitdep(target);
- pkg = alpm_db_get_pkg(alpm_option_get_localdb(), target);
+ pkg = alpm_db_get_pkg(alpm_option_get_localdb(),
+ alpm_depend_get_name(dep));
if(pkg && alpm_depcmp(pkg, dep)) {
found = 1;
} else {
/* not found, can we find anything that provides this in the local DB? */
- provides = alpm_db_whatprovides(alpm_option_get_localdb(), target);
+ provides = alpm_db_whatprovides(alpm_option_get_localdb(),
+ alpm_depend_get_name(dep));
for(j = provides; j; j = alpm_list_next(j)) {
pmpkg_t *pkg;
pkg = alpm_list_getdata(j);
@@ -78,10 +75,10 @@ int pacman_deptest(alpm_list_t *targets)
}
if(!found) {
- printf("%s\n", saved_target);
+ printf("%s\n", target);
retval = 127;
}
- free(saved_target);
+ free(dep);
}
return(retval);
}