autotest: added developer build support

this creates firmware builds for developers in the devbuild directory
This commit is contained in:
Andrew Tridgell 2014-10-30 11:12:17 +11:00
parent 1adacf42b9
commit c0f18272ed
2 changed files with 98 additions and 0 deletions

View File

@ -56,6 +56,20 @@ def build_binaries():
return False
return True
def build_devrelease():
'''run the build_devrelease.sh script'''
print("Running build_devrelease.sh")
import shutil
# copy the script as it changes git branch, which can change the script while running
orig=util.reltopdir('Tools/scripts/build_devrelease.sh')
copy=util.reltopdir('./build_devrelease.sh')
shutil.copyfile(orig, copy)
shutil.copymode(orig, copy)
if util.run_cmd(copy, dir=util.reltopdir('.')) != 0:
print("Failed build_devrelease.sh")
return False
return True
def build_examples():
'''run the build_examples.sh script'''
print("Running build_examples.sh")
@ -123,6 +137,7 @@ steps = [
'prerequisites',
'build.All',
'build.Binaries',
'build.DevRelease',
'build.Examples',
'build.Parameters',
@ -213,6 +228,9 @@ def run_step(step):
if step == 'build.Binaries':
return build_binaries()
if step == 'build.DevRelease':
return build_devrelease()
if step == 'build.Examples':
return build_examples()

View File

@ -0,0 +1,80 @@
#!/bin/bash
# script to build developer releases.
# Andrew Tridgell, October 2014
set -e
set -x
export PATH=$PATH:/bin:/usr/bin
DEVBUILD="$PWD/../buildlogs/binaries/devbuild"
error_count=0
# build one developer release
build_devrelease() {
GITURL="$1"
BRANCH="$2"
BUILD_TARGET="$3"
BUILD_DIR="$4"
RELEASE_DIR="$5"
RELEASE_FILE="$6"
export TMPDIR=$PWD/build.tmp.$$
echo $TMDIR
rm -rf $TMPDIR
echo "Building $RELEASE_DIR in $TMPDIR"
LOCAL_BRANCH="branch_$RELEASE_DIR"
REMOTE_NAME="remote_$RELEASE_DIR"
date
git checkout "$LOCAL_BRANCH" || {
git remote add "$REMOTE_NAME" "$GITURL" || return 1
git fetch "$REMOTE_NAME" || return 1
git checkout -b "$LOCAL_BRANCH" "$REMOTE_NAME/$BRANCH" -t || return 1
}
git fetch "$REMOTE_NAME" || return 1
git reset --hard "$REMOTE_NAME/$BRANCH" || return 1
echo "Checkout master for PX4Firmware"
(cd ../PX4Firmware && git checkout master) || return 1
echo "Checkout master for PX4NuttX"
(cd ../PX4NuttX && git checkout master) || return 1
mkdir -p "$DEVBUILD/$RELEASE_DIR" || return 1
# check if we should skip this build because we have already
# built this version
oldversion=$(cat "$DEVBUILD/$RELEASE_DIR/git-version.txt" | head -1)
newversion=$(git log -1 | head -1)
[ "$oldversion" = "$newversion" ] && {
echo "Skipping build - version match $newversion"
return 0
}
pushd "$BUILD_DIR" || return 1
make configure || return 1
make px4-clean || return 1
make clean || return 1
make "$BUILD_TARGET" || return 1
/bin/cp "$RELEASE_FILE" "$DEVBUILD/$RELEASE_DIR" || return 1
git log -1 > "$DEVBUILD/$RELEASE_DIR/git-version.txt" || return 1
[ -f APM_Config.h ] && {
version=$(grep 'define.THISFIRMWARE' *.pde 2> /dev/null | cut -d'"' -f2)
echo >> "$DEVBUILD/$RELEASE_DIR/git-version.txt"
echo "APMVERSION: $version" >> "$DEVBUILD/$RELEASE_DIR/git-version.txt"
}
git checkout master || return 1
popd
rm -rf $TMPDIR
}
# list all developer releases here
build_devrelease git://github.com/jschall/ardupilot devbuild-jon-copter px4-v2 ArduCopter devbuild-jon-copter ArduCopter-v2.px4 || error_count=$((error_count+1))
git checkout master || error_count=$((error_count+1))
exit $error_count