xbps-src: multiple improvements for -B and run_func.

* run_func now errors out by itself if the function returned any error.
* if -B flag is enabled and binpkg already exists, skip updating local
  repo pkg-index.
This commit is contained in:
Juan RP
2011-07-18 13:43:22 +02:00
parent e22c565811
commit 110aede193
7 changed files with 74 additions and 78 deletions

View File

@@ -38,7 +38,8 @@ run_func_error()
lver="${version}"
fi
msg_error "'${pkgname}-${lver}': '$func' phase didn't complete due to errors or SIGINT!\n"
echo
msg_error "${pkgname}-${lver}: '$func' interrupted!\n"
}
remove_pkgdestdir_sighandler()
@@ -116,14 +117,17 @@ run_func()
tee "$logfile" < "$logpipe" &
exec 1>"$logpipe" 2>"$logpipe"
set -e
trap "run_func_error $func" 0
trap "run_func_error $func && return $?" INT
msg_normal "'$pkgname-$lver': running $func phase...\n"
$func 2>&1
rval=$?
set +e
trap '' 0
trap - INT
exec 1>&3 2>&3 3>&-
rm -f "$logpipe"
return 0
if [ $rval -ne 0 ]; then
msg_error "${pkgname}-${lver}: $func failed!\n"
fi
fi
return 255 # function not found.
}