source: scripts/watch.sh @ 2343

Revision 2343, 4.2 KB checked in by alanbach-guest, 6 years ago (diff)

Added native package exception for log files

  • 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-28 13:27 +330 GMT
6#
7# Requires: lynx, devscripts, tail, awk, sed
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
27#LIST=`find $SVN_REPO -name watch | grep debian | grep trunk | sort -u`
28LIST=`find $SVN_REPO -type d -name debian | grep trunk | sort -u`
29
30for x in $LIST
31do
32
33# ARCH Checks
34#PKG=`basename ${x/%trunk\/debian\/watch/}`
35PKG=`basename ${x/%trunk\/debian/}`
36LORPATH=`find $LOCAL_REPO -type d | grep $PKG`
37cd $SVN_REPO/pkg/
38COMPONENT=`find ./ -maxdepth 2 -type d | grep /$PKG$ | awk 'BEGIN{FS="/"}{print $2}'`
39if [ -d $COMPONENT/$PKG ]; then
40     cd $COMPONENT/$PKG
41     PKG_VERSION=`dpkg-parsechangelog -ltrunk/debian/changelog | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $1}' | awk 'BEGIN{FS=" "}{print $1}'`
42     PKG_REVISION=`dpkg-parsechangelog -ltrunk/debian/changelog  | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $2}'`
43     cd
44fi
45
46COUNT=`find $LORPATH | grep -c amd64.deb`
47if [ $COUNT -ne 0 ]; then
48        AMD64="amd64"
49else
50        AMD64=""
51fi
52
53COUNT=`find $LORPATH | grep -c i386.deb`
54if [ $COUNT -ne 0 ]; then
55        I386="i386"
56else
57        I386=""
58fi
59
60COUNT=`find $LORPATH | grep -c all.deb`
61if [ $COUNT -ne 0 ]; then
62        ALLARCH="all"
63else
64        ALLARCH=""
65fi
66
67ARCHS="$ALLARCH-$I386-$AMD64"
68FAKEARCHS="$ALLARCH$I386$AMD64"
69
70# work around the plus bug
71x=`echo $x | sed s/+/KKK/g`
72
73if [ ! -z "$FAKEARCHS" ]; then
74echo $x
75#lynx -source $BASE_URL/watch.php?vars=${x/%debian\/watch/}*$ARCHS*$PKG | sed s/Debian/Parsix/g >> $BASE_PATH/index.html
76lynx -source $BASE_URL/watch.php?vars=${x/%debian/}*$ARCHS*$PKG*$PKG_VERSION*$PKG_REVISION*$COMPONENT | sed s/Debian/Parsix/g >> $BASE_PATH/index.html
77fi
78
79if [ -f $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.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            echo "<td bgcolor='00d7e9'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>OK</b></a></td></tr>" >> $BASE_PATH/index.html
88     elif [ "$BUILD_STATUS" = "Build failed" ]; then
89            echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
90     else
91            echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.log><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
92     fi
93else
94     echo "<td bgcolor='#ffe100'>N/A</td></tr>" >> $BASE_PATH/index.html
95fi
96
97done
98
99echo "<p align=center>Last Update: `date`</p>" >> $BASE_PATH/index.html
100
101echo $FOOTER >> $BASE_PATH/index.html
102
103# replace KKK!
104sed -i s/KKK/+/g $BASE_PATH/index.html
105
Note: See TracBrowser for help on using the repository browser.