summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-14 05:52:49 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-14 05:52:49 +0000
commit7e9fdfd44efb59b412a1173a14bc809d75aa2164 (patch)
treef0cbba814666003cf999abe7876d6cb61ee224ab
parent98db5dcc23d6f61c346053c35424fcdeca2d4f92 (diff)
downloadpacman-7e9fdfd44efb59b412a1173a14bc809d75aa2164.tar.xz
While trying to change the number of missing deps output by makepkg, I noticed
some needless complication in a few of these functions (checkdeps required stderr output due to the way it was called/used) so that's all cleaned up now. Also, makepkg no longer outputs a single dep when they are missing, it lists all at once, including makedeps
-rwxr-xr-xscripts/makepkg81
1 files changed, 44 insertions, 37 deletions
diff --git a/scripts/makepkg b/scripts/makepkg
index 36fd161f..7cc5871d 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -182,32 +182,15 @@ checkdeps() {
[ $# -gt 0 ] || return
- missdep=$(pacman $PACMAN_OPTS -T $*)
+ pmout=$(pacman $PACMAN_OPTS -T $*)
ret=$?
- if [ "$ret" != "0" ]; then
- if [ "$ret" = "127" ]; then
- msg "Missing Dependencies:"
- msg ""
- nl=0
- for dep in $missdep; do
- echo -ne "$dep " >&2
- if [ "$nl" = "1" ]; then
- nl=0
- echo -ne "\n" >&2
- # add this dep to the list
- depname=$(echo $dep | sed 's|=.*$||' | sed 's|>.*$||' | sed 's|<.*$||')
- deplist="$deplist $depname"
- continue
- fi
- nl=1
- done
- msg ""
- else
- error "pacman returned a fatal error."
- exit 1
- fi
+ if [ $ret -eq 127 ]; then #unresolved deps
+ #strip out the pacman prefix from "requires: xyz"
+ echo $pmout | sed 's|requires:||g'
+ elif [ $ret -ne 0 ]; then
+ error "pacman returned a fatal error ($ret): $pmout"
+ exit 1
fi
- echo $deplist
}
handledeps() {
@@ -302,6 +285,30 @@ handledeps() {
return $missingdeps
}
+resolvedeps() {
+ deplist=$(checkdeps $*)
+ if [ -n "${deplist}" ]; then
+ handledeps $deplist
+ if [ $? -eq 0 ]; then
+ # check deps again to make sure they were resolved
+ deplist=$(checkdeps ${depends[@]})
+ if [ -n "${deplist}" ]; then
+ error "Failed to install missing dependencies."
+ fi
+ fi
+ fi
+
+ if [ -n "${deplist}" ]; then
+ msg "Missing Dependencies:"
+ for dep in ${deplist}; do
+ msg2 "${dep}"
+ done
+ return 1
+ else
+ return 0
+ fi
+}
+
# fix flyspray bug #5923
removedeps() {
if [ "$RMDEPS" = "1" -a "$SUDO" = "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then
@@ -591,22 +598,22 @@ if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1"
fi
# skip printing a warning message for the others: geninteg, nobuild, repkg
elif [ $(type -p pacman) ]; then
+ deperr=0
+
msg "Checking Runtime Dependencies..."
- deplist=$(checkdeps ${depends[@]})
- handledeps $deplist
- if [ $? -gt 0 ]; then
- exit 1
- fi
- # check deps again to make sure they were resolved
- deplist=$(checkdeps ${depends[@]})
- if [ ! -z "$deplist" ]; then
- error "Failed to install missing dependencies."
- exit 1
+ resolvedeps ${depends[@]}
+ if [ $? -ne 0 ]; then
+ deperr=1
fi
+
msg "Checking Buildtime Dependencies..."
- makedeplist=$(checkdeps ${makedepends[@]})
- handledeps $makedeplist
- if [ $? -gt 0 ]; then
+ resolvedeps ${makedepends[@]}
+ if [ $? -ne 0 ]; then
+ deperr=1
+ fi
+
+ if [ $deperr -eq 1 ]; then
+ error "could not resolve all dependencies."
exit 1
fi
else