source: scripts/watch.sh @ 2277

Revision 2277, 3.8 KB checked in by alanbach-guest, 7 years ago (diff)

Updated to support build server logs

  • Property svn:executable set to *
Line 
1#!/bin/sh
2# Bash script to create Parsix watch page html
3# Coyright 2007 Alan Baghumian / GNU/GPL
4#
5# Updated: 2007-10-22 10:18 +330 GMT
6#
7# Requires: lynx, devscripts
8
9BASE_PATH="/home/parsix/public_html/watch"
10BASE_URL="http://watch.parsix.org"
11BUILDD="http://buildd.parsix.org"
12LOGS_PATH="/home/parsix/public_html/buildlogs"
13LOCAL_REPO="/home/parsix/public_html/packages/pool"
14SVN_REPO="/svn/pkg-parsix/"
15UNDERLINE=$'\137' # 137 is octal ASCII code for '_'
16
17if [ -f $BASE_PATH/index.html ]; then
18   rm $BASE_PATH/index.html
19fi
20
21HEADER="<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
23FOOTER="</body></html>"
24
25echo $HEADER > $BASE_PATH/index.html
26
27LIST=`find $SVN_REPO -name watch | grep debian | grep trunk | sort -u`
28
29for x in $LIST
30do
31
32# ARCH Checks
33PKG=`basename ${x/%trunk\/debian\/watch/}`
34LORPATH=`find $LOCAL_REPO -type d | grep $PKG`
35cd $SVN_REPO/pkg/
36COMPONENT=`find ./ -maxdepth 2 -type d | grep /$PKG$ | awk 'BEGIN{FS="/"}{print $2}'`
37if [ -d $COMPONENT/$PKG ]; then
38     cd $COMPONENT/$PKG
39     PKG_VERSION=`dpkg-parsechangelog -ltrunk/debian/changelog | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $1}' | awk 'BEGIN{FS=" "}{print $1}'`
40     PKG_REVISION=`dpkg-parsechangelog -ltrunk/debian/changelog  | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $2}'`
41     cd
42fi
43
44COUNT=`find $LORPATH | grep -c amd64.deb`
45if [ $COUNT -ne 0 ]; then
46        AMD64="amd64"
47else
48        AMD64=""
49fi
50
51COUNT=`find $LORPATH | grep -c i386.deb`
52if [ $COUNT -ne 0 ]; then
53        I386="i386"
54else
55        I386=""
56fi
57
58COUNT=`find $LORPATH | grep -c all.deb`
59if [ $COUNT -ne 0 ]; then
60        ALLARCH="all"
61else
62        ALLARCH=""
63fi
64
65ARCHS="$ALLARCH-$I386-$AMD64"
66FAKEARCHS="$ALLARCH$I386$AMD64"
67
68# work around the plus bug
69x=`echo $x | sed s/+/KKK/g`
70
71if [ ! -z "$FAKEARCHS" ]; then
72lynx -source $BASE_URL/watch.php?vars=${x/%debian\/watch/}*$ARCHS*$PKG | sed s/Debian/Parsix/g >> $BASE_PATH/index.html
73fi
74
75if [ -f $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log ]; then
76     echo "log exists..."
77     BUILD_STATUS=`tail -1 $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log`
78     if [ "$BUILD_STATUS" = "Build OK" ]; then
79            echo "<td bgcolor='00d7e9'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>OK</b></a></td></tr>" >> $BASE_PATH/index.html
80     elif [ "$BUILD_STATUS" = "Build failed" ]; then
81            echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
82     else
83            echo "<td bgcolor='#ffff00'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log>N/A</a></td></tr>" >> $BASE_PATH/index.html
84     fi
85else
86     echo "<td bgcolor='#ffff00'>N/A</td></tr>" >> $BASE_PATH/index.html
87fi
88
89done
90
91echo "<p align=center>Last Update: `date`</p>" >> $BASE_PATH/index.html
92
93echo $FOOTER >> $BASE_PATH/index.html
94
95# replace KKK!
96sed -i s/KKK/+/g $BASE_PATH/index.html
97
98
Note: See TracBrowser for help on using the repository browser.