2023-12-04 05:55:08 -04:00
|
|
|
#!/usr/bin/env bash
|
2013-03-18 01:15:50 -03:00
|
|
|
|
2019-12-17 03:10:23 -04:00
|
|
|
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/prefix/bin:$HOME/gcc/active/bin:$PATH
|
2013-03-18 01:15:50 -03:00
|
|
|
export PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
cd $HOME/APM || exit 1
|
|
|
|
|
|
|
|
test -n "$FORCEBUILD" || {
|
|
|
|
(cd APM && git fetch > /dev/null 2>&1)
|
2014-01-20 04:54:35 -04:00
|
|
|
|
2013-03-29 06:00:42 -03:00
|
|
|
newtags=$(cd APM && git fetch --tags | wc -l)
|
2013-03-18 01:15:50 -03:00
|
|
|
oldhash=$(cd APM && git rev-parse origin/master)
|
|
|
|
newhash=$(cd APM && git rev-parse HEAD)
|
2014-01-20 04:54:35 -04:00
|
|
|
|
2016-03-31 19:44:33 -03:00
|
|
|
if [ "$oldhash" = "$newhash" -a "$newtags" = "0" ]; then
|
|
|
|
echo "$(date) no change $oldhash $newhash" >> build.log
|
2013-03-18 01:15:50 -03:00
|
|
|
exit 0
|
|
|
|
fi
|
2016-03-31 19:44:33 -03:00
|
|
|
echo "$(date) Build triggered $oldhash $newhash $newtags" >> build.log
|
2013-03-18 01:15:50 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
############################
|
|
|
|
# grab a lock file. Not atomic, but close :)
|
|
|
|
# tries to cope with NFS
|
|
|
|
lock_file() {
|
|
|
|
lck="$1"
|
|
|
|
pid=`cat "$lck" 2> /dev/null`
|
|
|
|
|
|
|
|
if test -f "$lck" && kill -0 $pid 2> /dev/null; then
|
|
|
|
LOCKAGE=$(($(date +%s) - $(stat -c '%Y' "build.lck")))
|
2022-02-07 16:19:23 -04:00
|
|
|
test $LOCKAGE -gt 80000 && {
|
2013-03-18 01:15:50 -03:00
|
|
|
echo "old lock file $lck is valid for $pid with age $LOCKAGE seconds"
|
|
|
|
}
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
/bin/rm -f "$lck"
|
|
|
|
echo "$$" > "$lck"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lock_file build.lck || {
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ulimit -m 500000
|
|
|
|
#ulimit -s 500000
|
|
|
|
#ulimit -t 1800
|
|
|
|
#ulimit -v 500000
|
|
|
|
|
|
|
|
(
|
|
|
|
date
|
|
|
|
|
|
|
|
oldhash=$(cd APM && git rev-parse HEAD)
|
|
|
|
|
2016-03-05 22:41:50 -04:00
|
|
|
echo "Updating APM"
|
2013-03-18 01:15:50 -03:00
|
|
|
pushd APM
|
2015-08-26 23:03:14 -03:00
|
|
|
git checkout -f master
|
|
|
|
git fetch origin
|
|
|
|
git reset --hard origin/master
|
2022-08-14 04:21:41 -03:00
|
|
|
Tools/gittools/submodule-sync.sh
|
2013-03-18 01:15:50 -03:00
|
|
|
git clean -f -f -x -d -d
|
|
|
|
git tag autotest-$(date '+%Y-%m-%d-%H%M%S') -m "test tag `date`"
|
|
|
|
popd
|
|
|
|
|
2013-03-23 02:19:23 -03:00
|
|
|
rsync -a APM/Tools/autotest/web-firmware/ buildlogs/binaries/
|
|
|
|
|
2013-07-16 00:23:48 -03:00
|
|
|
echo "Updating MAVProxy"
|
|
|
|
pushd MAVProxy
|
2013-09-05 22:46:19 -03:00
|
|
|
git fetch origin
|
|
|
|
git reset --hard origin/master
|
|
|
|
git show
|
2013-07-16 00:23:48 -03:00
|
|
|
python setup.py build install --user
|
|
|
|
popd
|
2013-03-18 01:15:50 -03:00
|
|
|
|
2020-03-08 20:58:35 -03:00
|
|
|
echo "Updating pymavlink"
|
|
|
|
pushd APM/modules/mavlink/pymavlink
|
|
|
|
git show
|
|
|
|
python setup.py build install --user
|
|
|
|
popd
|
|
|
|
|
2013-03-18 01:15:50 -03:00
|
|
|
githash=$(cd APM && git rev-parse HEAD)
|
|
|
|
hdate=$(date +"%Y-%m-%d-%H:%m")
|
|
|
|
|
2013-05-29 23:19:50 -03:00
|
|
|
(cd APM && Tools/scripts/build_parameters.sh)
|
2013-03-18 01:15:50 -03:00
|
|
|
|
2020-03-17 21:52:56 -03:00
|
|
|
(cd APM && Tools/scripts/build_log_message_documentation.sh)
|
|
|
|
|
2013-08-14 19:58:56 -03:00
|
|
|
(cd APM && Tools/scripts/build_docs.sh)
|
|
|
|
|
2013-09-13 00:22:00 -03:00
|
|
|
killall -9 JSBSim || /bin/true
|
|
|
|
|
2014-11-13 02:27:02 -04:00
|
|
|
# raise core limit
|
|
|
|
ulimit -c 10000000
|
|
|
|
|
2019-06-05 20:10:32 -03:00
|
|
|
# build in home dir, as on faster storage
|
|
|
|
export BUILD_BINARIES_PATH=$HOME/build/tmp
|
|
|
|
|
2019-06-07 05:44:02 -03:00
|
|
|
# exit on panic so we don't waste time waiting around
|
|
|
|
export SITL_PANIC_EXIT=1
|
|
|
|
|
2023-04-21 02:27:49 -03:00
|
|
|
timelimit 72000 python3 APM/Tools/autotest/autotest.py --autotest-server --timeout=70000 > buildlogs/autotest-output.txt 2>&1
|
2013-03-18 01:15:50 -03:00
|
|
|
|
2019-06-07 05:44:02 -03:00
|
|
|
mkdir -p "buildlogs/history/$hdate"
|
|
|
|
|
2019-06-05 19:42:29 -03:00
|
|
|
(cd buildlogs && cp -f *.txt *.flashlog *.tlog *.km[lz] *.gpx *.html *.png *.bin *.BIN *.elf "history/$hdate/")
|
|
|
|
echo $githash > "buildlogs/history/$hdate/githash.txt"
|
|
|
|
|
2013-03-18 01:15:50 -03:00
|
|
|
) >> build.log 2>&1
|
2016-10-31 05:51:51 -03:00
|
|
|
|
|
|
|
# autotest done, let's mark GTD flags
|
|
|
|
touch /tmp/.autotest.done
|
|
|
|
|