#!/bin/sh
#
#  Rebuild a package and the dependencies it needs.
#


#
#  Build the named package first.
#
debian-builder --verbose $1


#
#  Now all it's dependencies which don't look like they're already present.
#
for i in `./getRequired $1`; do
  if [ -e /var/cache/debian-builder/deb/$i*.deb ] ; then
    echo $i already built
  else
    ./debian-builder-recursive $i;
  fi
done


