Date: Wednesday, February 14, 2007 @ 00:52:49 Author: aaron Path: /home/cvs-pacman/pacman-lib/scripts Modified: makepkg (1.49 -> 1.50) 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 ---------+ makepkg | 81 +++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 37 deletions(-) Index: pacman-lib/scripts/makepkg diff -u pacman-lib/scripts/makepkg:1.49 pacman-lib/scripts/makepkg:1.50 --- pacman-lib/scripts/makepkg:1.49 Tue Feb 13 15:47:34 2007 +++ pacman-lib/scripts/makepkg Wed Feb 14 00:52:49 2007 @@ -182,32 +182,15 @@ [ $# -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 @@ 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 @@ 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