[pacman-dev] [PATCH] Change the exit code for pacman_deptest() and some clean up.
Andrew Fyfe
andrew at neptune-one.net
Fri Jun 29 05:55:56 EDT 2007
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.
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 at neptune-one.net>
---
scripts/makepkg.in | 2 +-
src/pacman/deptest.c | 17 ++++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
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..d587868 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,10 @@ 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);
+ free(dep);
}
return(retval);
}
--
1.5.2.2
More information about the pacman-dev
mailing list