| 1 | #!/bin/sh |
|---|
| 2 | # Bash script to create Parsix watch page html |
|---|
| 3 | # Coyright 2007 Alan Baghumian / GNU/GPL |
|---|
| 4 | # |
|---|
| 5 | # Updated: 2007-10-30 10:11 +330 GMT |
|---|
| 6 | # |
|---|
| 7 | # Requires: lynx, devscripts, tail, awk, sed |
|---|
| 8 | |
|---|
| 9 | BASE_PATH="/home/parsix/public_html/watch" |
|---|
| 10 | BASE_URL="http://watch.parsix.org" |
|---|
| 11 | BUILDD="http://buildd.parsix.org" |
|---|
| 12 | LOGS_PATH="/home/parsix/public_html/buildlogs" |
|---|
| 13 | LOCAL_REPO="/home/parsix/public_html/packages/pool" |
|---|
| 14 | SVN_REPO="/svn/pkg-parsix/" |
|---|
| 15 | UNDERLINE=$'\137' # 137 is octal ASCII code for '_' |
|---|
| 16 | |
|---|
| 17 | if [ -f $BASE_PATH/index.html ]; then |
|---|
| 18 | rm $BASE_PATH/index.html |
|---|
| 19 | fi |
|---|
| 20 | |
|---|
| 21 | HEADER="<html lang='en-us'><head><title>Parsix GNU/Linux :: Package Watch System</title><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><link rel='icon' href='http://www.parsix.org/html/themes/parsix/images/icon.png' type='image/png'><link rel='shortcut icon' href='http://www.parsix.org/html/themes/parsix/images/favicon.ico'><link rel='stylesheet' href='http://www.parsix.org/html/modules/Admin/pnstyle/admin.css' type='text/css'><link rel='stylesheet' href='http://www.parsix.org/html/themes/parsix/style/styleNN.css' type='text/css'><style type='text/css'>@import url('http://www.parsix.org/html/themes/parsix/style/style.css');</style></head><body bgcolor='#deba73' text='#000000' link='#363636' vlink='#363636' alink='#d5ae83'><CENTER><H2>Parsix GNU/Linux Package Watch System</H2></CENTER><table border=1 align=center width=80% bgcolor=#f7f0e0><tr><td><b>Package Name</b></td><td><b>Upstream Version</b></td><td><b>Parsix Version</b></td><td><b>Supported Archs</b></td><td><b>Status</b></td><td><b>Build Server Status</b></td><tr>" |
|---|
| 22 | |
|---|
| 23 | FOOTER="</body></html>" |
|---|
| 24 | |
|---|
| 25 | echo $HEADER > $BASE_PATH/index.html |
|---|
| 26 | |
|---|
| 27 | #LIST=`find $SVN_REPO -name watch | grep debian | grep trunk | sort -u` |
|---|
| 28 | LIST=`find $SVN_REPO -type d -name debian | grep trunk | sort -u` |
|---|
| 29 | |
|---|
| 30 | for x in $LIST |
|---|
| 31 | do |
|---|
| 32 | |
|---|
| 33 | # ARCH Checks |
|---|
| 34 | #PKG=`basename ${x/%trunk\/debian\/watch/}` |
|---|
| 35 | PKG=`basename ${x/%trunk\/debian/}` |
|---|
| 36 | LORPATH=`find $LOCAL_REPO -type d | grep $PKG` |
|---|
| 37 | cd $SVN_REPO/pkg/ |
|---|
| 38 | COMPONENT=`find ./ -maxdepth 2 -type d | grep /$PKG$ | awk 'BEGIN{FS="/"}{print $2}'` |
|---|
| 39 | if [ -d $COMPONENT/$PKG ]; then |
|---|
| 40 | cd $COMPONENT/$PKG |
|---|
| 41 | PARSIX_SPEC=`cat trunk/debian/copyright | grep -c "Parsix GNU/Linux Project"` |
|---|
| 42 | PKG_VERSION=`dpkg-parsechangelog -ltrunk/debian/changelog | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $1}' | awk 'BEGIN{FS=" "}{print $1}'` |
|---|
| 43 | PKG_REVISION=`dpkg-parsechangelog -ltrunk/debian/changelog | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $2}'` |
|---|
| 44 | cd |
|---|
| 45 | fi |
|---|
| 46 | |
|---|
| 47 | COUNT=`find $LORPATH | grep -c amd64.deb` |
|---|
| 48 | if [ $COUNT -ne 0 ]; then |
|---|
| 49 | AMD64="amd64" |
|---|
| 50 | else |
|---|
| 51 | AMD64="" |
|---|
| 52 | fi |
|---|
| 53 | |
|---|
| 54 | COUNT=`find $LORPATH | grep -c i386.deb` |
|---|
| 55 | if [ $COUNT -ne 0 ]; then |
|---|
| 56 | I386="i386" |
|---|
| 57 | else |
|---|
| 58 | I386="" |
|---|
| 59 | fi |
|---|
| 60 | |
|---|
| 61 | COUNT=`find $LORPATH | grep -c all.deb` |
|---|
| 62 | if [ $COUNT -ne 0 ]; then |
|---|
| 63 | ALLARCH="all" |
|---|
| 64 | else |
|---|
| 65 | ALLARCH="" |
|---|
| 66 | fi |
|---|
| 67 | |
|---|
| 68 | ARCHS="$ALLARCH-$I386-$AMD64" |
|---|
| 69 | FAKEARCHS="$ALLARCH$I386$AMD64" |
|---|
| 70 | |
|---|
| 71 | # work around the plus bug |
|---|
| 72 | x=`echo $x | sed s/+/KKK/g` |
|---|
| 73 | |
|---|
| 74 | if [ ! -z "$FAKEARCHS" ]; then |
|---|
| 75 | #lynx -source $BASE_URL/watch.php?vars=${x/%debian\/watch/}*$ARCHS*$PKG | sed s/Debian/Parsix/g >> $BASE_PATH/index.html |
|---|
| 76 | lynx -source $BASE_URL/watch.php?vars=${x/%debian/}*$ARCHS*$PKG*$PKG_VERSION*$PKG_REVISION*$COMPONENT*$PARSIX_SPEC | sed s/Debian/Parsix/g >> $BASE_PATH/index.html |
|---|
| 77 | fi |
|---|
| 78 | |
|---|
| 79 | if [ -f "$LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log" -o -f "$LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION.log" ]; then |
|---|
| 80 | if [ ! -z "$PKG_REVISION" ]; then |
|---|
| 81 | BUILD_STATUS=`tail -1 $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log` |
|---|
| 82 | else |
|---|
| 83 | BUILD_STATUS=`tail -1 $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION.log` |
|---|
| 84 | fi |
|---|
| 85 | |
|---|
| 86 | if [ "$BUILD_STATUS" = "Build OK" ]; then |
|---|
| 87 | if [ ! -z "$PKG_REVISION" ]; then |
|---|
| 88 | echo "<td bgcolor='00d7e9'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>OK</b></a></td></tr>" >> $BASE_PATH/index.html |
|---|
| 89 | else |
|---|
| 90 | echo "<td bgcolor='00d7e9'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION.log><b>OK</b></a></td></tr>" >> $BASE_PATH/index.html |
|---|
| 91 | fi |
|---|
| 92 | elif [ "$BUILD_STATUS" = "Build failed" ]; then |
|---|
| 93 | if [ ! -z "$PKG_REVISION" ]; then |
|---|
| 94 | echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html |
|---|
| 95 | else |
|---|
| 96 | echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html |
|---|
| 97 | fi |
|---|
| 98 | else |
|---|
| 99 | if [ ! -z "$PKG_REVISION" ]; then |
|---|
| 100 | echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html |
|---|
| 101 | else |
|---|
| 102 | echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html |
|---|
| 103 | fi |
|---|
| 104 | fi |
|---|
| 105 | else |
|---|
| 106 | echo "<td bgcolor='#ffe100'>N/A</td></tr>" >> $BASE_PATH/index.html |
|---|
| 107 | fi |
|---|
| 108 | |
|---|
| 109 | done |
|---|
| 110 | |
|---|
| 111 | echo "<p align=center>Last Update: `date`</p>" >> $BASE_PATH/index.html |
|---|
| 112 | |
|---|
| 113 | echo $FOOTER >> $BASE_PATH/index.html |
|---|
| 114 | |
|---|
| 115 | # replace KKK! |
|---|
| 116 | sed -i s/KKK/+/g $BASE_PATH/index.html |
|---|
| 117 | |
|---|