medit/tools/test-release.sh

125 lines
2.8 KiB
Bash
Raw Normal View History

2011-04-13 22:43:06 -07:00
#! /bin/sh
2011-04-17 00:20:31 -07:00
if [ -z "$test_release_tmpdir" ]; then
tmpdir=`mktemp --directory --tmpdir=/var/tmp medit-release.XXXXXX`
2011-04-17 00:20:31 -07:00
mkdir $tmpdir/files
else
tmpdir=$test_release_tmpdir
fi
2011-04-13 22:43:06 -07:00
2011-09-05 21:49:40 -07:00
if [ ! -d "$1" ]; then
2011-04-13 22:43:06 -07:00
echo "Usage: $0 <sourcedir>"
exit 1
fi
srcdir=`cd $1 && pwd`
2011-04-16 18:46:51 -07:00
shift
2011-04-13 22:43:06 -07:00
2011-04-16 18:46:51 -07:00
if [ "`cd $srcdir && hg st | grep -v test-release.sh`" ]; then
2011-04-13 22:43:06 -07:00
echo "uncommitted changes, aborting"
exit 1
fi
do_or_die() {
echo "$@"
"$@" || exit 1
}
set_title() {
echo -n "\033]0;$1\007"
}
prepare() {
set_title "medit-release prepare"
2011-04-16 18:46:51 -07:00
if [ ! -d $tmpdir/medit ]; then
do_or_die cd $tmpdir
do_or_die hg clone $srcdir medit
fi
if [ ! -e $tmpdir/medit/configure ]; then
do_or_die cd $tmpdir/medit
set_title "medit-release autogen.sh"
do_or_die ./autogen.sh
fi
2011-04-13 22:43:06 -07:00
}
check_unix() {
2011-04-16 18:46:51 -07:00
prepare
2011-04-13 22:43:06 -07:00
set_title "medit-release unix build"
do_or_die mkdir $tmpdir/build-unix
do_or_die cd $tmpdir/build-unix
2011-04-16 12:31:54 -07:00
do_or_die $tmpdir/medit/configure --enable-dev-mode
2011-04-16 23:41:50 -07:00
do_or_die make -j 3
2011-04-13 22:43:06 -07:00
set_title "medit-release unix fullcheck"
do_or_die make fullcheck
2011-04-17 00:20:31 -07:00
# set_title "medit-release unix user-build"
# do_or_die tar xjf medit-*.tar.bz2
# do_or_die cd medit-*
# do_or_die ./configure
# do_or_die make -j 3
# do_or_die make test
# do_or_die cd ..
2011-04-13 22:43:06 -07:00
do_or_die mv medit-*.tar.bz2 $tmpdir/files/
}
2011-04-16 12:31:54 -07:00
check_no_python() {
2011-04-16 18:46:51 -07:00
prepare
2011-04-16 12:31:54 -07:00
set_title "medit-release unix-no-python build"
do_or_die mkdir $tmpdir/build-unix-no-python
do_or_die cd $tmpdir/build-unix-no-python
do_or_die $tmpdir/medit/configure --enable-dev-mode --without-python
2011-04-16 23:41:50 -07:00
do_or_die make -j 3
2011-04-16 12:31:54 -07:00
set_title "medit-release unix-no-python fullcheck"
2011-04-16 12:33:28 -07:00
do_or_die make test
2011-04-16 12:31:54 -07:00
}
check_python() {
2011-04-16 18:46:51 -07:00
prepare
2011-04-16 12:31:54 -07:00
set_title "medit-release unix-python build"
do_or_die mkdir $tmpdir/build-unix-python
do_or_die cd $tmpdir/build-unix-python
2011-04-16 18:46:51 -07:00
do_or_die $tmpdir/medit/configure --enable-dev-mode --enable-moo-module --enable-shared --disable-static
2011-04-16 23:41:50 -07:00
do_or_die make -j 3
2011-04-16 18:46:51 -07:00
}
2011-04-13 22:43:06 -07:00
check_windows() {
2011-04-16 18:46:51 -07:00
prepare
2011-04-13 22:43:06 -07:00
set_title "medit-release windows build"
do_or_die mkdir $tmpdir/build-windows
do_or_die cd $tmpdir/build-windows
do_or_die $tmpdir/medit/plat/win32/mingw-configure
2011-04-16 23:41:50 -07:00
do_or_die make -j 3
2011-04-13 22:43:06 -07:00
set_title "medit-release windows installer"
do_or_die make installer
do_or_die mv medit-*.exe $tmpdir/files/
}
2011-04-16 18:46:51 -07:00
check_all() {
2011-04-16 23:41:50 -07:00
all_checks="unix no_python python windows"
2011-04-16 18:46:51 -07:00
fail=false
2011-04-16 23:41:50 -07:00
failed_checks=
2011-04-13 22:43:06 -07:00
2011-04-17 00:20:31 -07:00
export test_release_tmpdir=$tmpdir
2011-04-16 18:46:51 -07:00
for check in `echo $all_checks`; do
2011-04-16 23:41:50 -07:00
if ! $0 $srcdir "$check"; then
failed_checks="$failed_checks $check"
2011-04-16 18:46:51 -07:00
fail=true
fi
done
if $fail; then
echo "FAILED"
2011-04-16 23:41:50 -07:00
for check in `echo $failed_checks`; do
echo "check_$check - FAIL"
2011-04-16 18:46:51 -07:00
done
else
echo "SUCCESS, files are in $tmpdir/files/"
fi
}
if [ -n "$1" ]; then
2011-04-16 18:53:46 -07:00
"check_$1" $srcdir || exit 1
2011-04-16 18:46:51 -07:00
else
check_all || exit 1
fi