SVN: toys/stbr/stbr.tcl
shadzik
shadzik at pld-linux.org
Mon May 14 21:58:53 CEST 2007
Author: shadzik
Date: Mon May 14 21:58:52 2007
New Revision: 8530
Modified:
toys/stbr/stbr.tcl
Log:
- remove logging to file
- add sqlite logging function
Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl (original)
+++ toys/stbr/stbr.tcl Mon May 14 21:58:52 2007
@@ -1,7 +1,7 @@
# Send To Builder Request TCL by shadzik at pld-linux.org
set reqbook "./scripts/requesters.txt"
-set logfile "./scripts/stbr.log"
+set logfile "./scripts/stbrlog.db"
set file "./scripts/cvslog.sh"
set back &
set cntr 0
@@ -35,26 +35,22 @@
set second [lindex $arg 1]
set specs ""; append specs $second; append specs " "; append specs [lrange $arg 2 end]
set rspecs ""
-set logspecs ""
if {!([string match th-ready $first] || [string match th-test $first])} {putserv "privmsg $chan :$nick: Usage: !stbr th-{ready|test} spec1 spec2 ..."; return 0}
if {([string length $second]<2)} {putserv "privmsg $chan :$nick: Usage: !stbr th-{ready|test} spec1 spec2 ..."; return 0}
if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; putserv "privmsg $chan :$nick: I reached my STBR time limit (30sec). Please try later."; return 0}
+set time [clock seconds]
+set date [clock format $time -format "%d.%m.%Y %H:%M"]
foreach spec $specs {
if {!([string match *.spec $spec])} { append spec ".spec"}
if {([cvs $spec] == 0)} {putserv "privmsg $chan :$nick: There is no such spec ($spec) in PLD's repository."; return 0}
lappend rspecs $spec
-append logspecs $cvsurl; append logspecs $spec; append logspecs $endcvs
-append logspecs "$red"; lappend logspecs $spec ; append logspecs "$endc"; append logspecs $enda
if {[exec $file $nick $first $spec]==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)"; append logspecs " (to $green$person$endc)"
+gets $tfile person; append rspecs " (to $person)"
close $tfile
+exec sqlite $logfile "INSERT INTO stbr VALUES('$date','$nick');"
+exec sqlite $logfile "INSERT INTO application VALUES('$date','$spec','$person','$first');"
}
-set lfile [open $logfile a]
-set time [clock seconds]
-set log [clock format $time -format "%d.%m.%Y %H:%M"]; lappend log "$nick requested build for $logspecs to $bold$first$endb"; append log "<br>";
-puts $lfile $log
-close $lfile
putserv "privmsg $chan :$nick: Sent STBR Mail to $first for $rspecs."
if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; return 1}
}
More information about the pld-cvs-commit
mailing list