view @ 374:ed4caa451355

Adjust busybox defconfig to remove options that don't build under knoppix 5.1.1 (inotifyd, 2.4 module support) and yank options we don't want anyway because another package must provide them (patch, /bin/sh). (Pondered moving to a miniconfig, but this is still "almost defconfig" and the patch makes it easier to see what actually mattered to us.)
author Rob Landley <>
date Sat, 02 Aug 2008 11:54:05 -0500
parents 5c61d556fe0c
children dd7632f3000c
line wrap: on
line source


# Test script to build every target architecture, logging output.
#  With --fork, it builds them in parallel
#  With --nofork, it build them sequentially
#  With --watch, it displays output from an existing parallel build

# Build and package one architecture.

function buildarch()
  nice -n 20 ./ $1 &&
  nice -n 20 ./ $1 &&
  nice -n 20 ./ $1

if [ "$1" != "--watch" ] && [ "$1" != "--stat" ]
  if [ $# -ne 0 ]

     if [ ! -z "$RECORD_COMMANDS" ]
       mkdir -p build/cmdlines-host &&
       export WRAPPY_LOGDIR=`pwd`/build/cmdlines-host

    # The first thing we need to do is download the source, build the host
    # tools, and extract the source packages.  This is only done once (not
    # repeated for each architecure), so we do it up front here.  Doing this
    # multiple times in parallel would collide, which is the main reason
    # you can't just run several times in parallel.

    (touch .kthxbye &&
     nice -n 20 ./ &&
     # host-tools populates one directory with every command the build needs,
     # so we can ditch the old $PATH afterwards.
     nice -n 20 ./ || exit 1

     # Ordinarily the build extracts packages the first time it needs them,
     # but letting multiple builds do that in parallel can collide, so
     # extract them all now up front.  (Adjust the path manually here so we're
     # using the busybox tools rather than the host distro's to do the
     # extract, just to be consistent.)
     if [ -f `pwd`/build/host/busybox ]
     nice -n 20 ./ --extract &&
     rm .kthxbye) 2>&1 | tee out.txt

     # Exiting from a sub-shell doesn't exit the parent shell, and because
     # we piped the output of the subshell to tee, we can't get the exit code
     # of the subshell.  So we use a sentinel file: if it wasn't deleted, the
     # build went "boing" and should stop now.

     rm .kthxbye 2>/dev/null && exit 1

  # Loop through each architecture and call "buildarch" as appropriate.

  for i in `cd sources/configs; ls`

    if [ ! -z "$RECORD_COMMANDS" ]
      mkdir -p build/cmdlines-$i || exit 1
      export WRAPPY_LOGDIR=`pwd`/build/cmdlines-host

    # Build sequentially.

    if [ "$1" == "--nofork" ]
      buildarch $i 2>&1 | tee out-$i.txt || exit 1

    # Build in parallel

    elif [ "$1" == "--fork" ]
      (buildarch $i > out-$i.txt 2>&1 &)&

    # Didn't understand command line arguments, dump help.

      echo "Usage: [--fork] [--nofork] [--watch] [--stat]"
      echo -e "\t--nofork  Build all targets one after another."
      echo -e "\t--fork    Build all targets in parallel (needs lots of RAM)."
      echo -e "\t--watch   Restart monitor for --nofork."
      echo -e "\t--stat    Grep logfiles for success/failure after build."
      exit 1

# Show which builds did or didn't work.

if [ "$1" == "--stat" ]
  echo "Success:"
  grep -l system-image- out-*.txt

  echo "Failed:"
  (ls -1 out-*.txt; grep -l system-image- out-*.txt) | sort | uniq -u

  exit 0

# Show progress indicators for parallel build.

if [ "$1" != "--nofork" ]
  watch -n 3 'X=; for i in out-*.txt; do /bin/echo -e "$X$i"; X="\n"; tail -n 1 $i; done'