SVN: toys/stbr: index.php resend.sh stbr.tcl
shadzik
shadzik at pld-linux.org
Fri Nov 6 06:46:59 CET 2009
Author: shadzik
Date: Fri Nov 6 06:46:58 2009
New Revision: 10952
Added:
toys/stbr/resend.sh (contents, props changed)
Modified:
toys/stbr/index.php
toys/stbr/stbr.tcl
Log:
- resend request to a randomly picked developer if it was not filled for 2 days
Modified: toys/stbr/index.php
==============================================================================
--- toys/stbr/index.php (original)
+++ toys/stbr/index.php Fri Nov 6 06:46:58 2009
@@ -4,6 +4,7 @@
#setlocale(LC_ALL, 'C');
ob_start("ob_gzhandler");
$db = sqlite_open("../db/stbrlog.db");
+$unfdb = sqlite_open("../db/unfilled.db");
include("queue.php");
@@ -395,6 +396,9 @@
$insert = sqlite_escape_string($insert);
sqlite_exec($db, $insert, $err);
//echo $err;
+ $delete = 'delete from unfilled where spec="'. $q['aspec'] .'" and branch="'. $q['abranch'] .'"';
+ $delete = sqlite_escape_string($delete);
+ sqlite_exec($unfdb, $delete, $err);
}
$title = "onmouseover=\"O(event, this, '$title')\"";
@@ -419,6 +423,9 @@
$insert .= ',"Check SourceX: tag(s) in .spec file or contact developers.");';
$insert = sqlite_escape_string($insert);
sqlite_exec($db, $insert, $err);
+ $delete = 'delete from unfilled where spec="'. $q['aspec'] .'" and branch="'. $q['abranch'] .'"';
+ $delete = sqlite_escape_string($delete);
+ sqlite_exec($unfdb, $delete, $err);
}
}
}
@@ -451,6 +458,7 @@
<?
}
sqlite_close($db);
+sqlite_close($unfdb);
?>
</tbody>
</table>
Added: toys/stbr/resend.sh
==============================================================================
--- (empty file)
+++ toys/stbr/resend.sh Fri Nov 6 06:46:58 2009
@@ -0,0 +1,80 @@
+#!/bin/bash
+# author: shadzik at pld-linux dot org
+# use with stbr.tcl at exactly the same version
+# Version: 0.9
+
+CVSROOT=":pserver:cvs at cvs.pld-linux.org/cvsroot/"
+HOST="pld-linux.org"
+DIST="$1"
+FROM="stbr"
+SPEC="$2"
+BRANCH="$3"
+SEND_TO="$4"
+BUILDER="upgrade"
+
+option="-r"
+send_branch=":$BRANCH"
+
+if [ "$BUILDER" == "upgrade" ]; then
+
+rm -fr packages/$SPEC >/dev/null 2>&1
+
+if [ "$BRANCH" == "HEAD" ]; then
+ send_branch=""
+ cvs -d $CVSROOT get packages/$SPEC >/dev/null 2>&1
+else
+ cvs -d $CVSROOT up -r $BRANCH packages/$SPEC >/dev/null 2>&1
+fi
+ADD_INFO=`grep -B 50 -A 2 Name: packages/$SPEC`
+fi
+
+spec_name=$(awk '/Name:/ {print $2}' packages/$SPEC)
+spec_ver=$(awk '/Version:/ {print $2}' packages/$SPEC |tr . _)
+spec_rel=$(awk '/Release:/ {print $2}' packages/$SPEC |grep -vE "(\.)")
+
+if [ "x$spec_rel" != "x" ]; then
+auto_tag="auto-$DIST-$spec_name-$spec_ver-$spec_rel"
+cvs -d $CVSROOT status -v packages/$SPEC |grep $auto_tag >/dev/null && TAG_INFO="Found $auto_tag tag. You need to increase spec release to successfully send upgrade." || TAG_INFO="No $auto_tag tag found. It's safe to send upgrade."
+else
+ TAG_INFO="Release seems not to be integer. Please correct this before sending upgrade."
+fi
+
+LAST_AUTOTAG=$(cvs -d ":pserver:cvs at cvs.pld-linux.org/cvsroot/" status -v packages/$SPEC |grep auto-$DIST |head -1 |awk '{print $1}')
+
+if [ "x$LAST_AUTOTAG" != "x" ]; then
+ LAST_AT="$LAST_AUTOTAG"
+else
+ LAST_AT="This spec was probably never sent to $DIST builders."
+fi
+
+function sendreq() {
+/usr/sbin/sendmail -t <<EOF
+From: $FROM <$FROM at IRC-bot>
+To: $SEND_TO@$HOST
+Subject: build request for $spec_name
+
+Hello,
+
+$FROM is requesting build for $SPEC (on branch $BRANCH).
+Please perform an $BUILDER on PLD-$DIST line.
+
+I suppose you're lazy so I provide some commands you could just copy & paste:
+make-request -d $DIST $option ${spec_name}.spec$send_branch
+
+Additional spec information:
+$ADD_INFO
+
+Tag information:
+$TAG_INFO
+
+Last auto-tag found:
+$LAST_AT
+
+Thank you.
+
+Yours truly,
+STBR Requester
+EOF
+}
+
+sendreq
Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl (original)
+++ toys/stbr/stbr.tcl Fri Nov 6 06:46:58 2009
@@ -4,8 +4,10 @@
set cmdbook "./scripts/cmdbook.txt"
set logfile "/home/users/stbr/db/stbrlog.db"
+set unfilled "/home/users/stbr/db/unfilled.db"
set script "./scripts/cvslog.sh"
set cancellation "./scripts/cancellation.sh"
+set resend "./scripts/resend.sh"
set makereq "./pld-builder.new/client/make-request.sh"
set back &
set cntr 0
@@ -106,11 +108,7 @@
proc sendto {dist spec branch} {
global cvsroot
-if {([string match ti $dist])} {
- set reqbook "./scripts/requesters-ti.txt"
-} {
- set reqbook "./scripts/requesters.txt"
-}
+set reqbook "./scripts/requesters-${dist}.txt"
if {([string match HEAD $branch])} {set cmd "-N"} {set cmd "-r$branch"}
set splited [split $spec "."]
set lsize [llength $splited]
@@ -132,6 +130,39 @@
random $reqbook
}
+bind time - "* * * * *" checkunfilled
+
+proc checkunfilled {nick host hand chan arg} {
+ global unfilled resend queuechan
+ putcmdlog "STBR: Looking for unfilled specs..."
+ set time [clock seconds]
+ set unfilledreq [exec sqlite $unfilled "select * from unfilled order by date;"]
+ foreach unfr $unfilledreq {
+ set splitreq [split $unfr "|"]
+ set date [lindex $splitreq 0]
+ set futuredate [clock scan {+2 days} -base $date]
+ set spec [lindex $splitreq 1]
+ set branch [lindex $splitreq 2]
+ set recipient [lindex $splitreq 3]
+ set dist [lindex $splitreq 4]
+ set reqbook "./scripts/requesters-${dist}.txt"
+ if { [expr {$time >= $futuredate }] } {
+ set towho [random $reqbook]
+ set splited [split $spec "."]
+ set lsize [llength $splited]
+ if {($lsize == 3)} {
+ set pkg [lrange $splited 0 1]
+ regsub -all " " $pkg "." pkg
+ } else {
+ set pkg [lindex $splited 0]
+ }
+ #exec $resend $dist $pkg/$spec $branch $towho
+ exec sqlite $unfilled "update unfilled set date='$time' where spec='$spec' and branch='$branch' and line='$dist';"
+ putserv "privmsg $queuechan :I've found unfilled requests. Resent request for $spec to $towho."
+ }
+ }
+}
+
proc pub:stat {nick host hand chan arg} {
global cvsroot maintenance
if {([file exists $maintenance]) && (![matchattr $hand S])} {
@@ -212,7 +243,7 @@
}
proc pub:stbr {nick host hand chan arg} {
-global script back cntr logfile usage makereq cmdbook cmdtxt maintenance
+global script back cntr logfile usage makereq cmdbook cmdtxt maintenance unfilled
if {([file exists $maintenance]) && (![matchattr $hand S])} {
set plik [open $maintenance r]
gets $plik reason
@@ -342,6 +373,7 @@
} {
if {[exec $script $dist $nick $second $pkg/$spec $branch $towho $bconds_with $bconds_without $defines &]==0} {putserv "privmsg $chan :$nick: An error occured. Couldn't send STBR Mail for $spec to $towho."; return 1}
exec sqlite $logfile "INSERT INTO application VALUES('$date','$spec','$branch','$towho','$second','$dist');"
+ exec sqlite $unfilled "INSERT INTO unfilled VALUES('$time','$spec','$branch','$towho','$dist');"
}
}
exec sqlite $logfile "INSERT INTO stbr VALUES('$date','$nick');"
More information about the pld-cvs-commit
mailing list