SVN: toys/stbr/stbr.tcl
shadzik
shadzik at pld-linux.org
Tue Oct 6 22:42:40 CEST 2009
Author: shadzik
Date: Tue Oct 6 22:42:40 2009
New Revision: 10709
Modified:
toys/stbr/stbr.tcl
Log:
- add bcond and alt_kernel functionality
- version: 0.9
Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl (original)
+++ toys/stbr/stbr.tcl Tue Oct 6 22:42:40 2009
@@ -8,7 +8,7 @@
set back &
set cntr 0
set cvsroot ":pserver:cvs at cvs.pld-linux.org:/cvsroot"
-set usage "Usage: !stbr \[help\] \[url\] th\|ti \[command \<valid builder command\>\] \[no\]upgrade spec1\[:BRANCH\] spec2\[:BRANCH\] ..."
+set usage "Usage: !stbr \[help\] \[url\] th\|ti \[no\]upgrade spec1\[:BRANCH\]\[+bcond+...\]\[-bcond-...\]\[%kernel%...\] spec2\[:BRANCH\]\[+bcond+...\]\[-bcond-...\]\[%kernel%...\] ..."
set nickpass "stbr-bot"
set cmdtxt "./scripts/cmd.txt"
set maintenance "./scripts/maintenance.txt"
@@ -182,6 +182,9 @@
set specs ""; append specs $third; append specs " "; append specs [lrange $arg 3 end]
set rspecs ""
set tspecs ""
+set defines ""
+set bconds_with ""
+set bconds_without ""
if {!([string match noupgrade $second] || [string match upgrade $second])} {
putserv "privmsg $chan :$nick: $usage"; return 0
}
@@ -189,19 +192,117 @@
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}
if {([string match noupgrade $second])} {set second "test-build"}
foreach spec $specs {
-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])} {
+ set splited [split $spec ":"]
+ set spec [lindex $splited 0]
+ set branchstr [lindex $splited 1]
+ if {([string match *+* $branchstr]) || ([string match *-* $branchstr]) || ([string match *%* $branchstr])} {
+ if {([string match *%* $branchstr])} {
+ set bsplited [split $branchstr "%"]
+ set branchstr [lindex $bsplited 0]
+ set defines [lrange $bsplited 1 end]
+ if {([string match *-* $branchstr])} {
+ set bsplited [split $branchstr "-"]
+ set branchstr [lindex $bsplited 0]
+ set bconds_without [lrange $bsplited 1 end]
+ if {([string match *+* $branchstr])} {
+ set bsplited [split $branchstr "+"]
+ set branch [lindex $bsplited 0]
+ set bconds_with [lrange $bsplited 1 end]
+ } else {
+ set branch $branchstr
+ }
+ } elseif {([string match *+* $branchstr])} {
+ set bsplited [split $branchstr "+"]
+ set branch [lindex $bslited 0]
+ set bconds_with [lrange $bsplited 1 end]
+ }
+ } elseif {([string match *-* $branchstr])} {
+ set bsplited [split $branchstr "-"]
+ set branchstr [lindex $bsplited 0]
+ set bconds_without [lrange $bsplited 1 end]
+ if {([string match *+* $branchstr])} {
+ set bsplited [split $branchstr "+"]
+ set branch [lindex $bsplited 0]
+ set bconds_with [lrange $bsplited 1 end]
+ }
+ }
+ } else {
+ set branch $branchstr
+ }
+} else {
+ set branch "HEAD"
+ if {([string match *+* $spec]) || ([string match *-* $spec]) || ([string match *%* $spec])} {
+ if {([string match *%* $spec])} {
+ set bsplited [split $spec "%"]
+ set spec [lindex $bsplited 0]
+ set defines [lrange $bsplited 1 end]
+ if {([string match *-* $spec])} {
+ set bsplited [split $spec "-"]
+ set spec [lindex $bsplited 0]
+ set bconds_without [lrange $bsplited 1 end]
+ if {([string match *+* $spec])} {
+ set bsplited [split $spec "+"]
+ set spec [lindex $bsplited 0]
+ set bconds_with [lrange $bsplited 1 end]
+ } else {
+ set spec $spec
+ }
+ } elseif {([string match *+* $spec])} {
+ set bsplited [split $spec "+"]
+ set spec [lindex $bslited 0]
+ set bconds_with [lrange $bsplited 1 end]
+ }
+ } elseif {([string match *-* $spec])} {
+ set bsplited [split $spec "-"]
+ set spec [lindex $bsplited 0]
+ set bconds_without [lrange $bsplited 1 end]
+ if {([string match *+* $spec])} {
+ set bsplited [split $spec "+"]
+ set spec [lindex $bsplited 0]
+ set bconds_with [lrange $bsplited 1 end]
+ }
+ }
+ } else {
+ set spec $spec
+ }
+}
+if {$bconds_with != ""} {
+ set flag "--with "
+ set with ""
+ foreach bcond $bconds_with {
+ set bcond $flag$bcond; append bcond " "; append with $bcond
+ }
+ set bconds_with $with
+}
+if {$bconds_without != ""} {
+ set flag "--without "
+ set without ""
+ foreach bcond $bconds_without {
+ set bcond $flag$bcond; append bcond " "; append without $bcond
+ }
+ set bconds_without $without
+}
+if {$defines != ""} {
+ set flag "--kernel "
+ set definedis ""
+ foreach define $defines {
+ set define $flag$define; append define " "; append definedis $define
+ }
+ set defines $definedis
+}
if {!([string match *.spec $spec])} { set pkg $spec; append spec ".spec"} {set splited [split $spec "."]; set pkg [lindex $splited 0]}
set towho [sendto $dist $spec $branch]
if {($towho == 0)} {putserv "privmsg $chan :$nick: There is no such spec ($spec) on branch $branch in PLD's repository."; return 0}
set isbanned [banned_spec $spec]
if {($isbanned == 0)} {putserv "privmsg $chan :$nick: $spec is banned from being STBRed."; return 0}
-lappend rspecs $spec; append rspecs ":$branch (to $towho)"
-lappend tspecs $spec; append tspecs ":$branch"
+lappend rspecs $spec; append rspecs ":$branch (to $towho, options: $bconds_with $bconds_without $defines)"
+lappend tspecs $spec; append tspecs ":$branch (options: $bconds_with $bconds_without $defines)"
if {([string match test-build $second])} {
- if {[utimer 5 "exec $makereq -d $dist -t $spec:$branch >/dev/null 2>&1"]==0} {putserv "privmsg $chan :$nick: An error occured. Couldn't send test-build request for $spec to builders."; return 1}
+ if {[utimer 5 "exec $makereq -d $dist -t $bconds_with $bconds_without $defines $spec:$branch >/dev/null 2>&1"]==0} {putserv "privmsg $chan :$nick: An error occured. Couldn't send test-build request for $spec to builders."; return 1}
exec sqlite $logfile "INSERT INTO application VALUES('$date','$spec','$branch','stbr','$second','$dist');"
} {
- if {[exec $script $dist $nick $second $pkg/$spec $branch $towho &]==0} {putserv "privmsg $chan :$nick: An error occured. Couldn't send STBR Mail for $spec to $towho."; return 1}
+ 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');"
}
}
@@ -218,4 +319,4 @@
if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; return 1}
}
-putlog "Send To Builder Request TCL v0.8.1 by shadzik loaded."
+putlog "Send To Builder Request TCL v0.9 by shadzik loaded."
More information about the pld-cvs-commit
mailing list