From 4ae2c3d81c309f93d2c41e22e71c5cf445123896 Mon Sep 17 00:00:00 2001 From: Andrew Manison Date: Sun, 11 Jul 2010 09:47:33 +0000 Subject: Added command line options to control clean operation and mail notification. --- rebuild-alpine.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/rebuild-alpine.sh b/rebuild-alpine.sh index 5f975dd15..20756bd9a 100755 --- a/rebuild-alpine.sh +++ b/rebuild-alpine.sh @@ -13,7 +13,7 @@ distclean () { done } -build () { +build () { local pkgs local maintainer local pkgno @@ -26,17 +26,25 @@ build () { pkgno=$(expr "$pkgno" + 1) echo "Building $p ($pkgno of $pktcnt in $1 - $failed failed)" cd $rootdir/$1/$p - abuild -rm > $rootdir/$1_$p.txt 2>&1 + abuild -rm > $rootdir/$1_$p.txt 2>&1 if [ "$?" = "0" ] ; then rm $rootdir/$1_$p.txt else - maintainer=$(grep Maintainer APKBUILD | cut -d " " -f 3-) - if [ -z "$maintainer" ] ; then - maintainer="default maintainer" - fi echo "Package $1/$p failed to build (output in $rootdir/$1_$p.txt)" -# echo "Package $1/$p failed to build. Notify $maintainer. Output is attached" | email -s "NOT SPAM $p build report" -a $rootdir/$1_$p.txt -n AlpineBuildBot -f build@alpinelinux.org amanison@anselsystems.com - failed=$(expr "$failed" + 1) + if [ -n "$mail" ] ; then + maintainer=$(grep Maintainer APKBUILD | cut -d " " -f 3-) + if [ -n "$maintainer" ] ; then + recipients="$maintainer -c dev@lists.alpinelinux.org" + else + recipients="dev@lists.alpinelinux.org" + fi + if [ -n "$mail" ] ; then + echo "Package $1/$p failed to build. Build output is attached" | \ + email -s "NOT SPAM $p build report" -a $rootdir/$1_$p.txt \ + -n AlpineBuildBot -f buildbot@alpinelinux.org $recipients + fi + fi + failed=$(expr "$failed" + 1) fi done cd $rootdir @@ -44,7 +52,16 @@ build () { touch START_OF_BUILD.txt -if [ "$1" = "clean" ] ; then +unset clean +unset mail +while getopts "cm" opt; do + case $opt in + 'c') clean="--clean";; + 'm') mail="--mail";; + esac +done + +if [ -n "$clean" ] ; then echo "Invoked with 'clean' option. This will take a while ..." tmp=$(distclean) echo "Done" -- cgit v1.2.3