Subversion Repositories Koakuma

Rev

Rev 15 | Rev 21 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 18
Line 1... Line 1...
1
#!/usr/bin/env tclsh
1
#!/usr/bin/env tclsh
2
# $Id: koakuma.cgi.in 15 2024-10-02 06:42:12Z nishi $
2
# $Id: koakuma.cgi.in 18 2024-10-02 07:35:40Z nishi $
3
 
3
 
4
set KOAKUMA_VERSION "1.00"
4
set KOAKUMA_VERSION "1.00"
5
set components ""
5
set components ""
6
 
6
 
7
chan configure stdout -buffering none
7
chan configure stdout -buffering none
Line 384... Line 384...
384
				rputs "Status: 400 Bad Request"
384
				rputs "Status: 400 Bad Request"
385
				$doc appendFromScript {
385
				$doc appendFromScript {
386
					keyError {valueString "Bad JSON"}
386
					keyError {valueString "Bad JSON"}
387
				}
387
				}
388
			} else {
388
			} else {
389
				set projname "[$clidoc selectNodes "string(/name)"]"
389
				set projname "[regsub -all { } "[$clidoc selectNodes "string(/name)"]" "-"]"
390
				set builddesc "[$clidoc selectNodes "string(/description)"]"
390
				set builddesc "[$clidoc selectNodes "string(/description)"]"
391
				if { "$projname" == "" || "$builddesc" == "" } {
391
				if { "$projname" == "" || "$builddesc" == "" } {
392
					rputs "Status: 400 Bad Request"
392
					rputs "Status: 400 Bad Request"
393
					$doc appendFromScript {
393
					$doc appendFromScript {
394
						keyError {valueString "Required field missing"}
394
						keyError {valueString "Required field missing"}
Line 519... Line 519...
519
				rputs "Status: 400 Bad Request"
519
				rputs "Status: 400 Bad Request"
520
				$doc appendFromScript {
520
				$doc appendFromScript {
521
					keyError {valueString "Bad JSON"}
521
					keyError {valueString "Bad JSON"}
522
				}
522
				}
523
			} else {
523
			} else {
524
				set projname "[$clidoc selectNodes "string(/name)"]"
524
				set projname "[regsub -all { } "[$clidoc selectNodes "string(/name)"]" "-"]"
525
				set projdescription "[$clidoc selectNodes "string(/description)"]"
525
				set projdescription "[$clidoc selectNodes "string(/description)"]"
526
				set projvcs "[$clidoc selectNodes "string(/vcs)"]"
526
				set projvcs "[$clidoc selectNodes "string(/vcs)"]"
527
				set url "[$clidoc selectNodes "string(/url)"]"
527
				set url "[$clidoc selectNodes "string(/url)"]"
528
				if { "$projname" == "" || "$projdescription" == "" || "$projvcs" == "" || "$url" == "" } {
528
				if { "$projname" == "" || "$projdescription" == "" || "$projvcs" == "" || "$url" == "" } {
529
					rputs "Status: 400 Bad Request"
529
					rputs "Status: 400 Bad Request"
Line 612... Line 612...
612
				tputs	"		<th>"
612
				tputs	"		<th>"
613
				tputs	"			Status"
613
				tputs	"			Status"
614
				tputs	"		</th>"
614
				tputs	"		</th>"
615
				tputs	"		<td>"
615
				tputs	"		<td>"
616
				if { [file exists "@@PREFIX@@/lib/koakuma/db/data/$projname/build.lock"] } {
616
				if { [file exists "@@PREFIX@@/lib/koakuma/db/data/$projname/build.lock"] } {
617
					set fid [open "@@PREFIX@@/lib/koakuma/db/data/$projname/build.loc" "r"]
617
					set fid [open "@@PREFIX@@/lib/koakuma/db/data/$projname/build.lock" "r"]
618
					if { [file exists "/proc/[gets $fid]"] } {
618
					if { [file exists "/proc/[gets $fid]"] } {
619
						tputs "Running"
619
						tputs "Running"
620
					} else {
620
					} else {
621
						tputs "Idle"
621
						tputs "Idle"
622
					}
622
					}