diff --git a/tools/prstats/Makefile b/tools/prstats/Makefile index 95db1393e5..b19020979c 100644 --- a/tools/prstats/Makefile +++ b/tools/prstats/Makefile @@ -1,15 +1,46 @@ # -# $FreeBSD$ +# $FreeBSD: www/tools/prstats/Makefile,v 1.1 2001/10/29 01:58:12 murray Exp $ # +.if exists(../../en/Makefile.conf) +.include "../../en/Makefile.conf" +.endif +.if exists(../../en/Makefile.inc) +.include "../../en/Makefile.inc" +.endif + +WEB_PREFIX?= ${.CURDIR}/../.. +GNATSDIR= /c/gnats +PRGRAPHDIR= ${DESTDIR}${WEBBASE}/prstats +GNUPLOT= /usr/local/bin/gnuplot + +GRAPHS= gnats.png +GRAPHS+= gnats1.png gnats1r.png +GRAPHS+= gnats30.png gnats30r.png +GRAPHS+= gnats365.png gnats365r.png +GRAPHS+= gnats7.png gnats7r.png +CLEANFILES= ${GRAPHS} +CLEANFILES+= _ __ __1 __30 __365 __7 + +INSTALL_WEB?= \ + ${INSTALL} ${COPY} ${INSTALLFLAGS} -o ${WEBOWN} -g ${WEBGRP} -m ${WEBMODE} + all: - ./go.tcl + ./go.tcl ${GNATSDIR} ./eval.tcl - make copy - -copy: ./cut.tcl 365 __ __365 ./cut.tcl 30 __ __30 ./cut.tcl 7 __ __7 ./cut.tcl 1 __ __1 - /usr/local/bin/gnuplot g + ${GNUPLOT} g + +install: ${GRAPHS} +.for entry in ${GRAPHS} +.if exists(${.CURDIR}/${entry}) + ${INSTALL_WEB} ${.CURDIR}/${entry} ${PRGRAPHDIR} +.else + ${INSTALL_WEB} ${entry} ${PRGRAPHDIR} +.endif +.endfor + +.include "${WEB_PREFIX}/share/mk/web.site.mk" diff --git a/tools/prstats/go.tcl b/tools/prstats/go.tcl index 51e35edc40..cdd758d54f 100755 --- a/tools/prstats/go.tcl +++ b/tools/prstats/go.tcl @@ -1,43 +1,47 @@ #!/usr/local/bin/tclsh8.3 # -# $FreeBSD$ +# $FreeBSD: www/tools/prstats/go.tcl,v 1.1 2001/10/29 01:58:12 murray Exp $ # +# This script expects the directory of a GNATS database as its sole argument. +set gnatsdir [lindex $argv 0] set fo [open _ w] proc PR {fn} { global fo set n [lrange [split $fn /] end end] set fi [open $fn] while {[gets $fi a] >= 0} { if {[string range $a 0 12] == "State-Changed"} { if {[lindex $a 0] == "State-Changed-When:"} { set t [clock scan [lrange $a 1 end]] #puts "* $t" } if {[lindex $a 0] == "State-Changed-From-To:"} { regsub {\->*[ ]*} [lrange $a 1 end] { } d set b [lindex $d 1] set c [lindex $d 0] if {$b == "" || $c == ""} { puts stderr "$n <$a> <$d> <$b> <$c>" break } #puts "* - $c + $b" } if {[lindex $a 0] == "State-Changed-Why:"} { puts $fo "$t $n {incr $c -1 ; incr $b}" } } elseif {[string range $a 0 13] == ">Arrival-Date:"} { #puts "* $a" puts $fo "[clock scan [lrange $a 1 end]] $n {incr open}" } else { #puts $a } } close $fi } -foreach pr [glob {/c/gnats/*/[1-9]*}] { + +append gnatsdir {/*/[1-9]*} +foreach pr [glob $gnatsdir] { PR $pr }