1 /* 2 * deptest.c 3 * 4 * Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org> 5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include <stdio.h> 22 23 #include <alpm.h> 24 #include <alpm_list.h> 25 26 /* pacman */ 27 #include "pacman.h" 28 #include "conf.h" 29 pacman_deptest(alpm_list_t * targets)30int pacman_deptest(alpm_list_t *targets) 31 { 32 alpm_list_t *i; 33 alpm_list_t *deps = NULL; 34 alpm_db_t *localdb = alpm_get_localdb(config->handle); 35 36 for(i = targets; i; i = alpm_list_next(i)) { 37 char *target = i->data; 38 39 if(!alpm_find_satisfier(alpm_db_get_pkgcache(localdb), target)) { 40 deps = alpm_list_add(deps, target); 41 } 42 } 43 44 if(deps == NULL) { 45 return 0; 46 } 47 48 for(i = deps; i; i = alpm_list_next(i)) { 49 const char *dep = i->data; 50 51 printf("%s\n", dep); 52 } 53 alpm_list_free(deps); 54 return 127; 55 } 56