source: scripts/watch.sh @ 2364

Revision 2363, 5.0 KB checked in by alanbach-guest, 6 years ago (diff)

Modified for a better handling of Parsix specific packages

  • 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-30 10:11 +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     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
45fi
46
47COUNT=`find $LORPATH | grep -c amd64.deb`
48if [ $COUNT -ne 0 ]; then
49        AMD64="amd64"
50else
51        AMD64=""
52fi
53
54COUNT=`find $LORPATH | grep -c i386.deb`
55if [ $COUNT -ne 0 ]; then
56        I386="i386"
57else
58        I386=""
59fi
60
61COUNT=`find $LORPATH | grep -c all.deb`
62if [ $COUNT -ne 0 ]; then
63        ALLARCH="all"
64else
65        ALLARCH=""
66fi
67
68ARCHS="$ALLARCH-$I386-$AMD64"
69FAKEARCHS="$ALLARCH$I386$AMD64"
70
71# work around the plus bug
72x=`echo $x | sed s/+/KKK/g`
73
74if [ ! -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
76lynx -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
77fi
78
79if [ -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
105else
106     echo "<td bgcolor='#ffe100'>N/A</td></tr>" >> $BASE_PATH/index.html
107fi
108
109done
110
111echo "<p align=center>Last Update: `date`</p>" >> $BASE_PATH/index.html
112
113echo $FOOTER >> $BASE_PATH/index.html
114
115# replace KKK!
116sed -i s/KKK/+/g $BASE_PATH/index.html
117
Note: See TracBrowser for help on using the repository browser.