git-update.sh: Fix issues

This commit is contained in:
Robert Swain 2010-01-28 07:27:49 +01:00
parent 05e9dd968c
commit 795495519a

View file

@ -6,16 +6,28 @@
# run this from a directory that contains the checkouts for each of the # run this from a directory that contains the checkouts for each of the
# modules # modules
FAILURE= PIDS=
CORE="\
gstreamer gst-plugins-base"
MODULES="\ MODULES="\
gstreamer gst-plugins-base \
gst-plugins-good gst-plugins-ugly gst-plugins-bad \ gst-plugins-good gst-plugins-ugly gst-plugins-bad \
gst-ffmpeg \ gst-ffmpeg \
gst-python \ gst-python \
gnonlin" gnonlin"
for m in $MODULES; do tmp=${TMPDIR-/tmp}
tmp=$tmp/git-update.$(date +%Y%m%d-%H%M-).$RANDOM.$RANDOM.$RANDOM.$$
(umask 077 && mkdir "$tmp") || {
echo "Could not create temporary directory! Exiting." 1>&2
exit 1
}
ERROR_LOG="$tmp/failures.log"
touch $ERROR_LOG
for m in $CORE $MODULES; do
if test -d $m; then if test -d $m; then
echo "+ updating $m" echo "+ updating $m"
cd $m cd $m
@ -23,22 +35,22 @@ for m in $MODULES; do
git pull origin master git pull origin master
if test $? -ne 0 if test $? -ne 0
then then
echo "$m: update (trying stash, pull, stash apply)" >> $ERROR_LOG
git stash git stash
git pull origin master git pull origin master
if test $? -ne 0 if test $? -ne 0
then then
git stash apply echo "$m: update" >> $ERROR_LOG
FAILURE="$FAILURE$m: update\n"
else
git stash apply
fi
cd .. cd ..
continue continue
fi fi
git stash apply
fi
git submodule update git submodule update
if test $? -ne 0 if test $? -ne 0
then then
FAILURE="$FAILURE$m: update\n" echo "$m: update (submodule)" >> $ERROR_LOG
cd .. cd ..
continue continue
fi fi
@ -46,42 +58,74 @@ for m in $MODULES; do
fi fi
done done
# then build build()
for m in $MODULES; do {
if test -d $m; then if test -d $1; then
cd $m cd $1
if test ! -e Makefile if test ! -e Makefile
then then
./autoregen.sh echo "+ $1: autoregen.sh"
./autoregen.sh > "$tmp/$1-regen.log" 2>&1
if test $? -ne 0 if test $? -ne 0
then then
FAILURE="$FAILURE$m: autoregen.sh\n" echo "$1: autoregen.sh [$tmp/$1-regen.log]" >> $ERROR_LOG
cd .. cd ..
continue return -1
fi fi
echo "+ $1: autoregen.sh done"
fi fi
make $@ echo "+ $1: make"
make > "$tmp/$1-make.log" 2>&1
if test $? -ne 0 if test $? -ne 0
then then
FAILURE="$FAILURE$m: make\n" echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG
cd .. cd ..
continue return -1
fi fi
echo "+ $1: make done"
make $@ check if test "x$CHECK" != "x"; then
echo "+ $1: make check"
make check > "$tmp/$1-check.log" 2>&1
if test $? -ne 0 if test $? -ne 0
then then
FAILURE="$FAILURE$m: check\n" echo "$1: check [$tmp/$1-check.log]" >> $ERROR_LOG
cd .. cd ..
continue return
fi
echo "+ $1: make check done"
fi fi
cd .. cd ..
fi fi
}
beach()
{
if test -e $ERROR_LOG; then
echo "Failures:"
echo
cat $ERROR_LOG
else
rm -rf "$tmp"
fi
}
# build core and base plugins sequentially
# exit if build fails (excluding checks)
for m in $CORE; do
build $m
if [ $? == -1 ]; then
beach
fi
done done
if test "x$FAILURE" != "x"; then # build other modules in parallel
echo "Failures:" for m in $MODULES; do
echo build $m &
echo -e $FAILURE PIDS="$PIDS $!"
fi done
wait $PIDS
beach