summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/abuild/abuild155
-rw-r--r--util/abuild/abuild.19
2 files changed, 113 insertions, 51 deletions
diff --git a/util/abuild/abuild b/util/abuild/abuild
index 53b492bfe0..61ea37abe1 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -14,6 +14,9 @@
#set -x # Turn echo on....
+ABUILD_DATE="October 24, 2006"
+ABUILD_VERSION="0.4"
+
# Where shall we place all the build trees?
TARGET=$( pwd )/linuxbios-builds
XMLFILE=$( pwd )/abuild.xml
@@ -24,6 +27,8 @@ PAYLOAD=/dev/null
# Lines of error context to be printed in FAILURE case
CONTEXT=5
+TESTSUBMISSION="http://qa.linuxbios.org/deployment/send.php"
+
# One might want to adjust these in case of cross compiling
MAKE="make"
PYTHON=python
@@ -35,19 +40,34 @@ ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
-e "s/Power Macintosh/ppc/"`
+trap interrupt INT
+
+function interrupt
+{
+ printf "\n$0: execution interrupted manually.\n"
+ if [ "$mode" == "xml" ]; then
+ printf "$0: deleting incomplete xml output file.\n"
+ fi
+ exit 1
+}
+
function debug
{
- test "$verbose" == "true" && echo $*
+ test "$verbose" == "true" && printf "$*\n"
}
function xml
{
- test "$mode" == "xml" && echo "$*" >> $XMLFILE
+ test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
}
function xmlfile
{
- test "$mode" == "xml" && { echo '<![CDATA['; cat $1; echo ']]>'; } >> $XMLFILE
+ test "$mode" == "xml" && {
+ printf '<![CDATA[\n'
+ cat $1
+ printf ']]>\n'
+ } >> $XMLFILE
}
@@ -88,18 +108,18 @@ function create_config
if [ -x $payloads/payload.sh ]; then
PAYLOAD=`$payloads/payload.sh $VENDOR $MAINBOARD`
- echo "Using custom payload $PAYLOAD"
+ printf "Using custom payload $PAYLOAD\n"
fi
mkdir -p $TARGET
if [ -f $TARGCONFIG ]; then
cp $TARGCONFIG $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
- echo -n "Using existing test target $TARGCONFIG"
+ printf "Using existing test target $TARGCONFIG"
xml " <config>$TARGCONFIG</config>"
else
- echo -n " Creating config file..."
+ printf " Creating config file..."
xml " <config>autogenerated</config>"
( cat << EOF
# This will make a target directory of ./VENDOR_MAINBOARD
@@ -149,7 +169,7 @@ EOF
-e s,CROSS_HOSTCC,"$HOSTCC",g \
$TARGET/Config-${VENDOR}_${MAINBOARD}.lb
- echo " ok"
+ printf " ok\n"
}
function create_builddir
@@ -157,7 +177,7 @@ function create_builddir
VENDOR=$1
MAINBOARD=$2
- echo -n " Creating builddir..."
+ printf " Creating builddir..."
target_dir=$TARGET
config_dir=$LBROOT/util/newconfig
@@ -182,12 +202,12 @@ function create_builddir
export PYTHONPATH=$config_dir
$PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log
if [ $? -eq 0 ]; then
- echo "ok"
+ printf "ok\n"
xml " <builddir>ok</builddir>"
xml ""
return 0
else
- echo "FAILED! Log excerpt:"
+ printf "FAILED! Log excerpt:\n"
xml " <builddir>failed</builddir>"
xml " <log>"
xmlfile $build_dir/config.log
@@ -211,7 +231,7 @@ function compile_target
VENDOR=$1
MAINBOARD=$2
- echo -n " Compiling image .."
+ printf " Compiling image .."
CURR=$( pwd )
cd $TARGET/${VENDOR}_${MAINBOARD}
stime=`date +%s`
@@ -222,8 +242,8 @@ function compile_target
if [ $ret -eq 0 ]; then
xml " <compile>ok</compile>"
xml " <compiletime>${duration}s</compiletime>"
- echo "ok" > compile.status
- echo "ok. (took ${duration}s)"
+ printf "ok\n" > compile.status
+ printf "ok. (took ${duration}s)\n"
cd $CURR
return 0
else
@@ -233,7 +253,7 @@ function compile_target
xmlfile make.log
xml " </log>"
- echo "FAILED after ${duration}s! Log excerpt:"
+ printf "FAILED after ${duration}s! Log excerpt:\n"
tail -n $CONTEXT make.log
cd $CURR
return 1
@@ -273,7 +293,7 @@ function build_target
HOSTCC='gcc'
CROSS_COMPILE=''
- echo -n "Processing mainboard/$VENDOR/$MAINBOARD"
+ printf "Processing mainboard/$VENDOR/$MAINBOARD"
xml "<mainboard>"
xml ""
@@ -287,7 +307,7 @@ function build_target
source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
if [ "$ARCH" == "$TARCH" ]; then
- echo " ($TARCH: ok)"
+ printf " ($TARCH: ok)\n"
else
found_crosscompiler=false
if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
@@ -314,15 +334,14 @@ function build_target
# Check result:
if [ $found_crosscompiler == "false" ]; then
- echo " ($TARCH: skipped, we're $ARCH)"
- echo
+ printf " ($TARCH: skipped, we're $ARCH)\n\n"
xml " <status>notbuilt</status>"
xml ""
xml "</mainboard>"
return 0
else
- echo " ($TARCH: ok, we're $ARCH)"
+ printf " ($TARCH: ok, we're $ARCH)\n"
xml " <compiler>"
xml " <path>`which ${CROSS_COMPILE}gcc`</path>"
xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
@@ -333,8 +352,7 @@ function build_target
built_successfully $VENDOR $MAINBOARD && \
{
- echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )"
- echo
+ printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n"
xml " <status>previouslyok</status>"
xml ""
xml "</mainboard>"
@@ -343,8 +361,7 @@ function build_target
build_broken $VENDOR $MAINBOARD || \
{
- echo " ( broken mainboard/$VENDOR/$MAINBOARD skipped )"
- echo
+ printf " ( broken mainboard/$VENDOR/$MAINBOARD skipped )\n\n"
xml " <status>knownbroken</status>"
xml ""
xml "</mainboard>"
@@ -354,51 +371,88 @@ function build_target
create_buildenv $VENDOR $MAINBOARD
if [ $? -eq 0 ]; then
compile_target $VENDOR $MAINBOARD &&
- xml "<status>ok</status>" ||
+ xml " <status>ok</status>" ||
xml "<status>broken</status>"
fi
xml ""
xml "</mainboard>"
- echo
+ printf "\n"
+}
+
+function test_target
+{
+ VENDOR=$1
+ MAINBOARD=$2
+
+ if [ "$hwtest" != "true" ]; then
+ return 0
+ fi
+
+ # image does not exist. we silently skip the patch.
+ if [ ! -r "$TARGET/${VENDOR}_${MAINBOARD}/linuxbios.rom" ]; then
+ return 0
+ fi
+
+ which curl &> /dev/null
+ if [ $? != 0 ]; then
+ printf "curl is not installed but required for test submission. skipping test.\n\n"
+ return 0
+ fi
+
+ CURR=`pwd`
+ if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/tested" ]; then
+ printf "Testing image for board $VENDOR $MAINBOARD skipped (previously submitted).\n\n"
+ return 0
+ fi
+ # touch $TARGET/${VENDOR}_${MAINBOARD}/tested
+
+ printf "Submitting image for board $VENDOR $MAINBOARD to test system...\n"
+
+ curl -f -F "romfile=@$TARGET/${VENDOR}_${MAINBOARD}/linuxbios.rom" \
+ -F "mode=abuild" -F "mainboard=${VENDOR}_${MAINBOARD}" -F "submit=Upload" \
+ "http://qa.linuxbios.org/deployment/send.php"
+
+ printf "\n"
+ return 0
}
function myhelp
{
- echo "Usage: $0 [-v] [-a] [-b] [-t <vendor/board>] [-p <dir>] [lbroot]"
- echo " $0 [-V|--version]"
- echo " $0 [-h|--help]"
- echo
- echo "Options:"
- echo " [-v|--verbose] print more messages"
- echo " [-a|--all] build previously succeeded ports as well"
- echo " [-b|--broken] attempt to build ports that are known broken"
- echo " [-t|--target <vendor/board>] attempt to build target vendor/board only"
- echo " [-p|--payloads <dir>] use payloads in <dir> to build images"
- echo " [-V|--version] print version number and exit"
- echo " [-h|--help] print this help and exit"
- echo " [-x|--xml] write xml log file "
- echo " (defaults to $XMLFILE)"
- echo " [lbroot] absolute path to LinuxBIOS sources"
- echo " (defaults to $LBROOT)"
- echo
+ printf "Usage: $0 [-v] [-a] [-b] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
+ printf " $0 [-V|--version]\n"
+ printf " $0 [-h|--help]\n"
+ printf
+ printf "Options:\n"
+ printf " [-v|--verbose] print more messages\n"
+ printf " [-a|--all] build previously succeeded ports as well\n"
+ printf " [-b|--broken] attempt to build ports that are known broken\n"
+ printf " [-t|--target <vendor/board>] attempt to build target vendor/board only\n"
+ printf " [-p|--payloads <dir>] use payloads in <dir> to build images\n"
+ printf " [-V|--version] print version number and exit\n"
+ printf " [-h|--help] print this help and exit\n"
+ printf " [-x|--xml] write xml log file \n"
+ printf " (defaults to $XMLFILE)\n"
+ printf " [-T|--test] submit image(s) to automated test system\n"
+ printf " [lbroot] absolute path to LinuxBIOS sources\n"
+ printf " (defaults to $LBROOT)\n\n"
}
function myversion
{
cat << EOF
-LinuxBIOS autobuild: V0.3.
+LinuxBIOS autobuild v$ABUILD_VERSION ($ABUILD_DATE)
Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
Copyright (C) 2006 by coresystems GmbH <info@coresystems.de>
+
This program is free software; you may redistribute it under the terms
of the GNU General Public License. This program has absolutely no
warranty.
EOF
- myhelp
}
# default options
@@ -408,7 +462,7 @@ LBROOT=$( cd ../..; pwd )
verbose=false
# parse parameters
-args=`getopt -l version,verbose,help,all,target:,broken,payloads: Vvhat:bp: -- "$@"`
+args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test Vvhat:bp:T -- "$@"`
if [ $? != 0 ]; then
myhelp
@@ -424,10 +478,11 @@ while true ; do
-b|--broken) shift; buildbroken=true;;
-v|--verbose) shift; verbose=true;;
-V|--version) shift; myversion; exit 0;;
- -h|--help) shift; myhelp; exit 0;;
+ -h|--help) shift; myversion; myhelp; exit 0;;
-p|--payloads) shift; payloads="$1"; shift;;
+ -T|--test) shift; hwtest=true;;
--) shift; break;;
- -*) echo -e "Invalid option\n"; myhelp; exit 1;;
+ -*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;;
esac
done
@@ -442,14 +497,16 @@ xml '<abuild>'
if [ "$target" != "" ]; then
# build a single board
- VENDOR=`echo $target|cut -f1 -d/`
- MAINBOARD=`echo $target|cut -f2 -d/`
+ VENDOR=`printf $target|cut -f1 -d/`
+ MAINBOARD=`printf $target|cut -f2 -d/`
build_target $VENDOR $MAINBOARD
+ test_target $VENDOR $MAINBOARD
else
# build all boards per default
for VENDOR in $( vendors ); do
for MAINBOARD in $( mainboards $VENDOR ); do
build_target $VENDOR $MAINBOARD
+ test_target $VENDOR $MAINBOARD
done
done
fi
diff --git a/util/abuild/abuild.1 b/util/abuild/abuild.1
index e808978322..efab83d46d 100644
--- a/util/abuild/abuild.1
+++ b/util/abuild/abuild.1
@@ -1,4 +1,4 @@
-.TH ABUILD 1 "September 19, 2006"
+.TH ABUILD 1 "October 24, 2006"
.SH NAME
abuild \- build LinuxBIOS images for all available targets
.SH SYNOPSIS
@@ -41,6 +41,11 @@ The file will be called
.B abuild.xml
and will be created in the current directory.
.TP
+.B "\-T, \-\-test"
+Submit generated image(s) to the automated test system.
+The results of the tests will be made available at
+.B http://qa.linuxbios.org/log_manual.php
+.TP
.B "\-v, \-\-verbose"
More verbose output.
.TP
@@ -62,7 +67,7 @@ is covered by the GNU General Public License (GPL), version 2 or later.
.br
2006 coresystems GmbH
.SH AUTHORS
-Stefan Reinauer <stepan@openbios.org>
+Stefan Reinauer <stepan@coresystems.de>
.PP
This manual page was written by Uwe Hermann <uwe@hermann-uwe.de>.
It is licensed under the terms of the GNU GPL (v2 or later).