source: scripts/watch/watch.sh @ 10080

Revision 3341, 5.1 KB checked in by alanbach-guest, 6 years ago (diff)
  • Modified to meet svn new structure
  • 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: 2008-03-17 08:37 +0100 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/pkg"
15DIST_NAME="viola"
16UNDERLINE=$'\137' # 137 is octal ASCII code for '_'
17
18if [ -f $BASE_PATH/index.html ]; then
19   rm $BASE_PATH/index.html
20fi
21
22HEADER="<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>"
23
24FOOTER="</body></html>"
25
26echo $HEADER > $BASE_PATH/index.html
27
28#LIST=`find $SVN_REPO -name watch | grep debian | grep trunk | sort -u`
29LIST=`find $SVN_REPO/$DIST_NAME -type d -name debian | grep trunk | sort -u`
30
31for x in $LIST
32do
33
34# ARCH Checks
35#PKG=`basename ${x/%trunk\/debian\/watch/}`
36PKG=`basename ${x/%trunk\/debian/}`
37LORPATH=`find $LOCAL_REPO -type d | grep $PKG`
38cd $SVN_REPO/$DIST_NAME/
39COMPONENT=`find ./ -maxdepth 2 -type d | grep /$PKG$ | awk 'BEGIN{FS="/"}{print $2}'`
40if [ -d $COMPONENT/$PKG ]; then
41     cd $COMPONENT/$PKG
42     PARSIX_SPEC=`cat trunk/debian/copyright | grep -c "Parsix GNU/Linux Project"`
43     PKG_VERSION=`dpkg-parsechangelog -ltrunk/debian/changelog | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $1}' | awk 'BEGIN{FS=" "}{print $1}'`
44     PKG_REVISION=`dpkg-parsechangelog -ltrunk/debian/changelog  | grep Version | awk 'BEGIN{FS=": "}{print $2}' | awk 'BEGIN{FS="-"}{print $2}'`
45     cd
46fi
47
48COUNT=`find $LORPATH | grep -c amd64.deb`
49if [ $COUNT -ne 0 ]; then
50        AMD64="amd64"
51else
52        AMD64=""
53fi
54
55COUNT=`find $LORPATH | grep -c i386.deb`
56if [ $COUNT -ne 0 ]; then
57        I386="i386"
58else
59        I386=""
60fi
61
62COUNT=`find $LORPATH | grep -c all.deb`
63if [ $COUNT -ne 0 ]; then
64        ALLARCH="all"
65else
66        ALLARCH=""
67fi
68
69ARCHS="$ALLARCH-$I386-$AMD64"
70FAKEARCHS="$ALLARCH$I386$AMD64"
71
72# work around the plus bug
73x=`echo $x | sed s/+/KKK/g`
74
75if [ ! -z "$FAKEARCHS" ]; then
76#lynx -source $BASE_URL/watch.php?vars=${x/%debian\/watch/}*$ARCHS*$PKG | sed s/Debian/Parsix/g >> $BASE_PATH/index.html
77lynx -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
78fi
79
80if [ -f "$LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.blog" -o -f "$LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION.blog" ]; then
81     if [ ! -z "$PKG_REVISION" ]; then
82          BUILD_STATUS=`tail -1 $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.blog`
83     else
84          BUILD_STATUS=`tail -1 $LOGS_PATH/$PKG$UNDERLINE$PKG_VERSION.blog`
85     fi
86
87     if [ "$BUILD_STATUS" = "Build OK" ]; then
88            if [ ! -z "$PKG_REVISION" ]; then
89                 echo "<td bgcolor='00d7e9'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.blog><b>OK</b></a></td></tr>" >> $BASE_PATH/index.html
90            else
91                 echo "<td bgcolor='00d7e9'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION.blog><b>OK</b></a></td></tr>" >> $BASE_PATH/index.html
92            fi
93     elif [ "$BUILD_STATUS" = "Build failed" ]; then
94            if [ ! -z "$PKG_REVISION" ]; then
95                 echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.blog><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
96            else
97                 echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION.blog><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
98            fi
99     else
100            if [ ! -z "$PKG_REVISION" ]; then
101                 echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION-$PKG_REVISION.blog><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
102            else
103                 echo "<td bgcolor='#ff9199'><a href=$BUILDD/$PKG$UNDERLINE$PKG_VERSION.blog><b>Failed</b></a></td></tr>" >> $BASE_PATH/index.html
104            fi
105     fi
106else
107     echo "<td bgcolor='#ffe100'>N/A</td></tr>" >> $BASE_PATH/index.html
108fi
109
110done
111
112echo "<p align=center>Last Update: `date`</p>" >> $BASE_PATH/index.html
113
114echo $FOOTER >> $BASE_PATH/index.html
115
116# replace KKK!
117sed -i s/KKK/+/g $BASE_PATH/index.html
118
Note: See TracBrowser for help on using the repository browser.