blob: abf8d5d67f7e34029492a6a749cd6569eb086937 (
plain) (
tree)
|
|
#!/bin/bash
set -e
function progress {
local file=$1
ls=$(ls -l $file)
while [ true ]; do
sleep 10
new_ls=$(ls -l $file)
if [ "$new_ls" != "$ls" ]; then
echo -n "."
fi
ls="$new_ls"
done
}
function do_and_log {
start_time=`date +%s`
log="logs/latest-log.$$"
echo "" >$log
echo -n "$1..."
(progress $log) &
pid=$!
disown
shift
if $* >$log 2>&1; then
kill $pid >/dev/null 2>&1
stop_time=`date +%s`
diff_time=$((stop_time-start_time))
echo " done, took $diff_time seconds"
else
kill $pid >/dev/null 2>&1
echo " failed."
tail -n 200 $log
echo "*** Failed ***"
exit 1
fi
}
if [ ! -d "logs" ]; then
mkdir logs
fi
do_and_log "Autoconfing" ./otp_build autoconf
do_and_log "Configuring" ./otp_build configure
do_and_log "Building OTP" ./otp_build boot -a
if [ "$1" = "release" ]; then
do_and_log "Releasing OTP" ./otp_build release -a
fi
if [ "$1" = "docs" ]; then
DOC_TARGET=${TRAVIS_BRANCH:-release/`erts/autoconf/config.guess`}
DOC_TARGET=${TRAVIS_TAG:-$DOC_TARGET}
TESTROOT=$PWD/$DOC_TARGET do_and_log "Building documentation" make release_docs
do_and_log "Linting documentation" make xmllint
# The code below prepares this build to be used as a deploy to
# github pages for documentation.
if [ "$TRAVIS_PULL_REQUEST" = "false" -a "$TRAVIS_TAG" = "" -a "$TRAVIS_REPO_SLUG" = "erlang/otp" ]; then
set -x
rm -rf logs
SHA=`git rev-parse --verify HEAD`
DATE=`git show -s --format=%ci`
git clean -xfdq -e $DOC_TARGET
git fetch https://github.com/erlang/cd master
git checkout -f FETCH_HEAD
rm -rf _docs/$DOC_TARGET
mv $DOC_TARGET _docs/$DOC_TARGET
echo "---" > _docs/$DOC_TARGET.md
echo "title: $DOC_TARGET" >> _docs/$DOC_TARGET.md
echo "sha: $SHA" >> _docs/$DOC_TARGET.md
echo "generated: $DATE" >> _docs/$DOC_TARGET.md
echo "---" >> _docs/$DOC_TARGET.md
set +x
fi
fi
exit 0
|