diff options
Diffstat (limited to 'src/pacman/deptest.c')
| -rw-r--r-- | src/pacman/deptest.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c index 1ae7ceb5..32fb3d08 100644 --- a/src/pacman/deptest.c +++ b/src/pacman/deptest.c @@ -1,8 +1,8 @@ /* * deptest.c - * + * * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ @@ -24,20 +24,16 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <libintl.h> #include <alpm.h> #include <alpm_list.h> /* pacman */ -#include "deptest.h" +#include "pacman.h" #include "util.h" #include "conf.h" -#include "log.h" -#include "sync.h" - -extern config_t *config; +/* TODO: This should use _alpm_checkdeps() */ int pacman_deptest(alpm_list_t *targets) { int retval = 0; @@ -46,7 +42,7 @@ int pacman_deptest(alpm_list_t *targets) if(targets == NULL) { return(0); } - + for(i = targets; i; i = alpm_list_next(i)) { int found = 0; pmpkg_t *pkg; @@ -55,20 +51,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_dep_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_dep_get_name(dep)); for(j = provides; j; j = alpm_list_next(j)) { pmpkg_t *pkg; pkg = alpm_list_getdata(j); @@ -78,13 +70,14 @@ int pacman_deptest(alpm_list_t *targets) break; } } + alpm_list_free(provides); } if(!found) { - MSG(NL, "%s", saved_target); - retval = 1; + printf("%s\n", target); + retval = 127; } - free(saved_target); + free(dep); } return(retval); } |
