add full xml logging to abuild to work on the complete information

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2314 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2006-05-27 00:22:02 +00:00
parent 2d1fe3700e
commit 192b7bc445
1 changed files with 70 additions and 3 deletions

View File

@ -5,6 +5,7 @@
# This script builds LinuxBIOS images for all available targets. # This script builds LinuxBIOS images for all available targets.
# #
# (C) 2004 by Stefan Reinauer <stepan@openbios.org> # (C) 2004 by Stefan Reinauer <stepan@openbios.org>
# (C) 2006 by coresystems GmbH <info@coresystems.de>
# #
# This file is subject to the terms and conditions of the GNU General # This file is subject to the terms and conditions of the GNU General
# Public License. See the file COPYING in the main directory of this # Public License. See the file COPYING in the main directory of this
@ -15,6 +16,7 @@
# Where shall we place all the build trees? # Where shall we place all the build trees?
TARGET=$( pwd )/linuxbios-builds TARGET=$( pwd )/linuxbios-builds
XMLFILE=$( pwd )/abuild.xml
# path to payload. Should be more generic # path to payload. Should be more generic
PAYLOAD=/dev/null PAYLOAD=/dev/null
@ -26,6 +28,9 @@ CONTEXT=5
MAKE="make" MAKE="make"
PYTHON=python PYTHON=python
# this can be changed to xml by -x
mode=text
ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 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/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
-e "s/Power Macintosh/ppc/"` -e "s/Power Macintosh/ppc/"`
@ -35,6 +40,18 @@ function debug
test "$verbose" == "true" && echo $* test "$verbose" == "true" && echo $*
} }
function xml
{
test "$mode" == "xml" && echo "$*" >> $XMLFILE
}
function xmlfile
{
test "$mode" == "xml" && { echo '<![CDATA['; cat $1; echo ']]>'; } >> $XMLFILE
}
function vendors function vendors
{ {
# make this a function so we can easily select # make this a function so we can easily select
@ -72,10 +89,12 @@ function create_config
if [ -f $TARGCONFIG ]; then if [ -f $TARGCONFIG ]; then
cp $TARGCONFIG $TARGET/Config-${VENDOR}_${MAINBOARD}.lb cp $TARGCONFIG $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
echo "Used existing test target $TARGCONFIG" echo "Used existing test target $TARGCONFIG"
xml " <config>$TARGCONFIG</config>"
return return
fi fi
echo -n " Creating config file..." echo -n " Creating config file..."
xml " <config>autogenerated</config>"
( cat << EOF ( cat << EOF
# This will make a target directory of ./VENDOR_MAINBOARD # This will make a target directory of ./VENDOR_MAINBOARD
@ -154,8 +173,16 @@ function create_builddir
$PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log $PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "ok" echo "ok"
xml " <builddir>ok</builddir>"
xml ""
return 0
else else
echo "FAILED! Log excerpt:" echo "FAILED! Log excerpt:"
xml " <builddir>failed</builddir>"
xml " <log>"
xmlfile $build_dir/config.log
xml " </log>"
xml ""
tail -n $CONTEXT $build_dir/config.log tail -n $CONTEXT $build_dir/config.log
return 1 return 1
fi fi
@ -183,11 +210,19 @@ function compile_target
etime=`date +%s` etime=`date +%s`
duration=$(( $etime - $stime )) duration=$(( $etime - $stime ))
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
xml " <compile>ok</compile>"
xml " <compiletime>${duration}s</compiletime>"
echo "ok" > compile.status echo "ok" > compile.status
echo "ok. (took ${duration}s)" echo "ok. (took ${duration}s)"
cd $CURR cd $CURR
return 0 return 0
else else
xml " <compile>failed</compile>"
xml " <compiletime>${duration}s</compiletime>"
xml " <log>"
xmlfile make.log
xml " </log>"
echo "FAILED after ${duration}s! Log excerpt:" echo "FAILED after ${duration}s! Log excerpt:"
tail -n $CONTEXT make.log tail -n $CONTEXT make.log
cd $CURR cd $CURR
@ -229,6 +264,14 @@ function build_target
CROSS_COMPILE='' CROSS_COMPILE=''
echo -n "Processing mainboard/$VENDOR/$MAINBOARD" echo -n "Processing mainboard/$VENDOR/$MAINBOARD"
xml "<mainboard>"
xml ""
xml " <vendor>$VENDOR</vendor>"
xml " <device>$MAINBOARD</device>"
xml ""
xml " <architecture>$TARCH</architecture>"
xml ""
[ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \ [ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
@ -255,6 +298,12 @@ function build_target
done done
fi fi
xml " <compiler>"
xml " <path>`which ${CROSS_COMPILE}gcc`</path>"
xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
xml " </compiler>"
xml ""
# TBD: look for suitable cross compiler suite # TBD: look for suitable cross compiler suite
# cross-$TARCH-gcc and cross-$TARCH-ld # cross-$TARCH-gcc and cross-$TARCH-ld
@ -272,6 +321,9 @@ function build_target
{ {
echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )" echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )"
echo echo
xml " <status>previouslyok</status>"
xml ""
xml "</mainboard>"
return 0 return 0
} }
@ -279,14 +331,22 @@ function build_target
{ {
echo " ( broken mainboard/$VENDOR/$MAINBOARD skipped )" echo " ( broken mainboard/$VENDOR/$MAINBOARD skipped )"
echo echo
xml " <status>knownbroken</status>"
xml ""
xml "</mainboard>"
return 0 return 0
} }
create_buildenv $VENDOR $MAINBOARD create_buildenv $VENDOR $MAINBOARD
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
compile_target $VENDOR $MAINBOARD compile_target $VENDOR $MAINBOARD &&
xml "<status>ok</status>" ||
xml "<status>broken</status>"
fi fi
xml ""
xml "</mainboard>"
echo echo
} }
@ -303,6 +363,7 @@ function myhelp
echo " [-t|--target <vendor/board>] attempt to build target vendor/board only" echo " [-t|--target <vendor/board>] attempt to build target vendor/board only"
echo " [-V|--version] print version number and exit" echo " [-V|--version] print version number and exit"
echo " [-h|--help] print this help and exit" echo " [-h|--help] print this help and exit"
echo " [-x|--xml] write xml log file $XMLFILE"
echo " [lbroot] absolute path to LinuxBIOS sources" echo " [lbroot] absolute path to LinuxBIOS sources"
echo " (defaults to $LBROOT)" echo " (defaults to $LBROOT)"
echo echo
@ -312,9 +373,10 @@ function myversion
{ {
cat << EOF cat << EOF
LinuxBIOS autobuild: V0.1. LinuxBIOS autobuild: V0.2.
Copyright (C) 2004 by Stefan Reinauer, <stepan@openbios.org> 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 This program is free software; you may redistribute it under the terms
of the GNU General Public License. This program has absolutely no of the GNU General Public License. This program has absolutely no
warranty. warranty.
@ -340,6 +402,7 @@ fi
eval set "$args" eval set "$args"
while true ; do while true ; do
case "$1" in case "$1" in
-x|--xml) shift; mode=xml; rm -f $XMLFILE ;;
-t|--target) shift; target="$1"; shift;; -t|--target) shift; target="$1"; shift;;
-a|--all) shift; buildall=true;; -a|--all) shift; buildall=true;;
-b|--broken) shift; buildbroken=true;; -b|--broken) shift; buildbroken=true;;
@ -357,6 +420,9 @@ test -z "$1" || LBROOT=$1
debug "LBROOT=$LBROOT" debug "LBROOT=$LBROOT"
xml '<?xml version="1.0" encoding="utf-8"?>'
xml '<abuild>'
if [ "$target" != "" ]; then if [ "$target" != "" ]; then
# build a single board # build a single board
VENDOR=`echo $target|cut -f1 -d/` VENDOR=`echo $target|cut -f1 -d/`
@ -370,4 +436,5 @@ else
done done
done done
fi fi
xml '</abuild>'