Mercurial > hg > aboriginal
changeset 450:e5e8830b0e18
Script to build all targets and optionally upload the tarballs via ssh, plus create a README.txt listing packages and versions used.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 03 Nov 2008 22:26:39 -0600 |
parents | 765d6566fb54 |
children | d7fe6ae2c9e9 |
files | sources/build-all-targets.sh |
diffstat | 1 files changed, 92 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sources/build-all-targets.sh Mon Nov 03 22:26:39 2008 -0600 @@ -0,0 +1,92 @@ +#!/bin/bash + +# Nightly snapshot build script. + +# TODO: +# +# Wrapper must set: +# SERVER=busybox.net +# SERVERDIR=public_html/fwlnew +# UNSTABLE=busybox,toybox,uClibc + +source sources/functions.sh + +function get_download_version() +{ + getversion $(sed -n 's@URL=.*/\(.[^ ]*\).*@\1@p' download.sh | grep ${1}-) +} + +function identify_release() +{ + if [ -d build/sources/alt-$1/.svn ] + then + echo subversion changeset $(svn info build/sources/alt-uClibc | sed -n "s/^Revision: //p") + elif [ -d build/sources/alt-$1/.hg ] + then + echo mercurial changeset $(hg tip | sed -n 's/changeset: *\([0-9]*\).*/\1/p') + else + echo release version $(get_download_version $1) + fi +} + +function do_readme() +{ + # Grab FWL version number + + FWL_REV="$(hg tip | sed -n 's/changeset: *\([0-9]*\).*/\1/p')" + + cat << EOF +Built on $(date +%F) from: + + Build script: + Firmware Linux (http://landley.net/code/firmware) mercurial changeset $FWL_REV + + Packages: + uClibc (http://uclibc.org) $(identify_release uClibc) + BusyBox (http://busybox.net) $(identify_release busybox) + Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux) + Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils) + GCC (http://gcc.gnu.org) $(identify_release gcc-core) + gmake (http://www.gnu.org/software/make) $(identify_release make) + Toybox (http://landley.net/code/toybox) $(identify_release toybox) + +EOF +} + +function build_this_target() +{ + ./cross-compiler.sh $i || return + [ ! -z "$SERVER" ] && + scp build/cross-compiler-$i.tar.bz2 ${SERVER}:${SERVERDIR} >/dev/null & + ./mini-native.sh $i || return + [ ! -z "$SERVER" ] && + scp build/mini-native-$i.tar.bz2 ${SERVER}:${SERVERDIR} >/dev/null & + ./package-mini-native.sh $i || return + [ ! -z "$SERVER" ] && + scp build/system-image-$i.tar.bz2 ${SERVER}:${SERVERDIR} >/dev/null & +} + +# Clean up old builds + +hg pull -u & +rm -rf build out-*.txt & +wait4background 0 + +# Fetch fresh packages, build host tools, extract packages. + +(./download.sh && + ./host-tools.sh && + ./download.sh --extract || dienow) | tee out.txt + +do_readme | tee build/README.txt | ( [ -z "$SERVER" ] && cat || ssh ${SERVER} "cd ${SERVERDIR}; cat > README.txt" ) & + +for i in $(cd sources/targets; ls); +do + build_this_target 2>&1 | tee out-$i.txt + [ ! -z "$SERVER" ] && (cat out-$i | bzip2 | ssh ${SERVER} \ + "cat > ${SERVERDIR}/buildlog-$(echo $i | sed 's/^out-//').bz2") & +done + +# Wait for ssh/scp invocations to finish. + +wait4background 0