-for dist in ${UBUNTU_DIST} ${DEBIAN_DIST}; do
- for arch in i386 amd64; do
- if test ! -f /var/cache/pbuilder/${dist}-${arch}-base.tgz; then
- DIST=$dist ARCH=$arch pbuilder create
- fi
- if $update; then
- DIST=$dist ARCH=$arch pbuilder update --override-config
- fi
- DIST=$dist ARCH=$arch pbuilder --build $PKG
- if test -f ${dist}-${arch}/*.dsc; then
- :
- else
- echo "No .dsc file for ${dist}-${arch}"
- exit 1
- fi
- done
+i=0
+concurrency=4
+echo "Building $PKG"
+date
+for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
+ for arch in i386 amd64; do
+ rm -fr ${dist}-${arch}
+ (
+ if test ! -f /var/cache/pbuilder/${dist}-${arch}-base.tgz; then
+ DIST=$dist ARCH=$arch pbuilder create
+ fi
+ if $update; then
+ DIST=$dist ARCH=$arch pbuilder update --override-config
+ fi
+ DIST=$dist ARCH=$arch pbuilder --build $PKG
+ ) >${dist}-${arch}.log 2>&1 &
+ i=`expr $i + 1`
+ if test $i -eq $concurrency; then
+ i=0
+ wait
+ fi
+ done