Author: shadzik
Date: Fri May 18 05:11:40 2007
New Revision: 8603

Modified:
   toys/stbr/stbr.tcl
Log:
- add procedure sendto
- version 0.5


Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl  (original)
+++ toys/stbr/stbr.tcl  Fri May 18 05:11:40 2007
@@ -5,7 +5,6 @@
 set file "./scripts/cvslog.sh"
 set back &
 set cntr 0
-set towho "./scripts/sent.txt"
 set cvsroot ":pserver:[EMAIL PROTECTED]:/cvsroot"
 set usage "Usage: !stbr \[help\] \[no\]upgrade spec1\[:BRANCH\] 
spec2\[:BRANCH\] ..."
 
@@ -21,12 +20,26 @@
        putserv "privmsg $chan :$nick: Most important is that you understand 
what the difference between 'upgrade' and 'noupgrade' is. When you call 
'noupgrade' it's going to be just an test-build. When you call 'upgrade' the 
package is going to be upgraded on builders and ftp."
 }
 
+proc sendto {spec branch} {
+global cvsroot reqbook
+if {([string match HEAD $branch])} {set cmd "-N"} {set cmd "-r$branch"}
+if {[catch {exec cvs -d $cvsroot log $cmd SPECS/$spec | awk {/author/{a = $5; 
sub(/;/, "", a); if (!seen[a]) print a; seen[a] = 1}}} results]} {return 0}
+set file [open $reqbook r]
+gets $file lista
+close $file
+foreach devil $results {
+       foreach requester $lista {
+               if {([string match $requester $devil])} {return $devil}
+       }
+}
+}
+
 bind pub * !stbr pub:stbr
 bind pub * stbr: pub:stbr
 bind pub * stbr, pub:stbr
 
 proc pub:stbr {nick host hand chan arg} {
-global file back cntr logfile towho usage
+global file back cntr logfile usage
 putcmdlog "#$hand# Noticed Send To Build Request Mail command";
 set first [lindex $arg 0]
 if {([string match help $first])} {help $chan $nick; return 0}
@@ -44,16 +57,14 @@
 if {([string match *:* $spec])} {set splited [split $spec ":"];set spec 
[lindex $splited 0]; set branch [lindex $splited 1]} {set branch "HEAD"}
 if {!([string match *.spec $spec])} { append spec ".spec"}
 if {([cvs $spec $branch] == 0)} {putserv "privmsg $chan :$nick: There is no 
such spec ($spec) on branch $branch in PLD's repository."; return 0}
-lappend rspecs $spec; append rspecs ":$branch"
-if {[exec $file $nick $first $spec $branch]==0} {putserv "privmsg $chan 
:$nick: An error occured. Couldn't send STBR Mail for $spec."; return 1}
-set tfile [open $towho r]
-gets $tfile person; append rspecs " (to $person)"
-close $tfile
-exec sqlite $logfile "INSERT INTO application 
VALUES('$date','$spec','$branch','$person','$first');"
+set towho [sendto $spec $branch]
+lappend rspecs $spec; append rspecs ":$branch (to $towho)"
+if {[exec $file $nick $first $spec $branch $towho]==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','$first');"
 }
 exec sqlite $logfile "INSERT INTO stbr VALUES('$date','$nick');"
-putserv "privmsg $chan :$nick: Sent STBR Mail, an $first will be performed for 
$rspecs."
+putserv "privmsg $chan :$nick: Sent STBR Mail for $rspecs. An $first will be 
performed."
 if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; return 1}
 }
 
-putlog "Send To Builder Request TCL v0.4 by shadzik loaded."
+putlog "Send To Builder Request TCL v0.5 by shadzik loaded."
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to