Changed the exit code for missing deps from 1 to 128 because 1 is used for other errors. makepkg breaks if pacman exits with 1 for any reason other than a missing dep. Changed alpm_splitdeps( deptest ) so it doesn't change the value of deptest. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> --- lib/libalpm/deps.c | 4 +++- scripts/makepkg.in | 2 +- src/pacman/deptest.c | 16 +++++----------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 524136b..b259c4b 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -442,7 +442,9 @@ pmdepend_t SYMEXPORT *alpm_splitdep(const char *depstring) if(depstring == NULL) { return(NULL); } - newstr = strdup(depstring); + + newstr = calloc(strlen(depstring)+1, sizeof(char)); + strncpy(newstr, depstring, strlen(depstring)); depend = malloc(sizeof(pmdepend_t)); if(depend == NULL) { diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 8be44c6..12459f9 100644 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -296,7 +296,7 @@ check_deps() { pmout=$(pacman $PACMAN_OPTS -T $*) ret=$? - if [ $ret -eq 1 ]; then #unresolved deps + if [ $ret -eq 128 ]; then #unresolved deps echo "$pmout" elif [ $ret -ne 0 ]; then error "$(gettext "Pacman returned a fatal error (%i): %s")" "$ret" "$pmout" diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c index 264ba1c..8a731ae 100644 --- a/src/pacman/deptest.c +++ b/src/pacman/deptest.c @@ -27,6 +27,7 @@ #include <alpm.h> #include <alpm_list.h> +#include <deps.h> /* pacman */ #include "pacman.h" @@ -52,20 +53,14 @@ 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(), dep->name); 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(), dep->name); for(j = provides; j; j = alpm_list_next(j)) { pmpkg_t *pkg; pkg = alpm_list_getdata(j); @@ -78,10 +73,9 @@ int pacman_deptest(alpm_list_t *targets) } if(!found) { - printf("%s\n", saved_target); - retval = 1; + printf("%s\n", target); + retval = 128; } - free(saved_target); } return(retval); } -- 1.5.2.2