Skip to content
Permalink
Browse files
Add auto_distcheck.sh script
  • Loading branch information
Noah Slater committed Mar 10, 2013
1 parent 185ca0d commit 84d45cb6c5e870128d72c8f601f1ad166651c4ca
Showing 1 changed file with 54 additions and 0 deletions.
@@ -0,0 +1,54 @@
#!/bin/sh -e

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

if test -n "$1"; then
version=$1
else
echo "error: no version"
exit 1
fi

log () {
printf "\033[1;31m$1\033[0m\n"
}

basename=`basename $0`

temp_dir=`mktemp -d /tmp/${basename}.XXXXXX` || exit 1

exit="echo Files in: $temp_dir"

trap "echo && $exit && kill 0" SIGINT

while true; do
sleep 5
log "Checking build..."
if test -s apache-couchdb-$version.tar.gz; then
break
else
time_start=`date "+%s"`
log_file=$temp_dir/$time_start".txt"
echo "Build started `date -r $time_start`" > $log_file
make distcheck | tee -a $log_file
time_finish=`date "+%s"`
echo "Build finished `date -r $time_finish`" >> $log_file
total_time=`expr $time_finish - $time_start`
echo "Build took `TZ=UTC date -r $total_time +%H:%M:%S`" >> $log_file
fi
done

log "Build success..."

$exit

0 comments on commit 84d45cb

Please sign in to comment.