status-report-scripts bzstat.gp,1.1,1.2 grabBZstats,1.1,1.2
Christian Iseli (c4chris)
fedora-extras-commits at redhat.com
Tue Sep 11 13:48:24 UTC 2007
Author: c4chris
Update of /cvs/fedora/status-report-scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29083
Modified Files:
bzstat.gp grabBZstats
Log Message:
Update for new interface.
Index: bzstat.gp
===================================================================
RCS file: /cvs/fedora/status-report-scripts/bzstat.gp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- bzstat.gp 7 Jul 2006 15:25:37 -0000 1.1
+++ bzstat.gp 11 Sep 2007 13:48:22 -0000 1.2
@@ -2,16 +2,20 @@
# $Id$
# Useful to plot grabBZstats script output
set xlabel "Week #, starting from August 1, 2005"
-set ylabel "Ticket count"
+set ylabel "Ticket count per week"
+set y2label "Open ticket in queue"
+set yrange [0:150]
+set ytics nomirror
+set y2tics nomirror 0,1000
set key top left
-set style data lp
-set term png small color picsize 1024 768
+set style data line
+set term png small size 1024,768
set output "bzstat.png"
-plot "bzstat.data" using 1:2 t "opened tickets",\
- "bzstat.data" using 1:3 t "closed tickets",\
- "bzstat.data" using 1:4 t "queue size",\
- "bzstat.data" using 1:5 t "accepted tickets",\
- "bzstat.data" using 1:6 t "duplicate tickets",\
- "bzstat.data" using 1:7 t "dropped tickets"
+plot "bzstat.data" using 1:2 t "opened tickets p.w.",\
+ "bzstat.data" using 1:3 t "closed tickets p.w.",\
+ "bzstat.data" using 1:5 t "accepted tickets p.w.",\
+ "bzstat.data" using 1:6 t "duplicate tickets p.w.",\
+ "bzstat.data" using 1:7 t "dropped tickets p.w.",\
+ "bzstat.data" using 1:4 t "open ticket in queue" axis x1y2
set output
quit
Index: grabBZstats
===================================================================
RCS file: /cvs/fedora/status-report-scripts/grabBZstats,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- grabBZstats 7 Jul 2006 15:25:37 -0000 1.1
+++ grabBZstats 11 Sep 2007 13:48:22 -0000 1.2
@@ -9,20 +9,18 @@
use strict;
use Getopt::Long;
use Date::Manip;
-use File::Temp qw/ tempfile /;
+use XMLRPC::Lite;
-# Cookies and BZ URLs to retrieve tickets
-my $BZ_cooky = "# HTTP Cookie File
-bugzilla.redhat.com FALSE /bugzilla FALSE 2145917104 COLUMNLIST opendate%20changeddate%20bug_severity%20assigned_to%20reporter%20bug_status%20resolution%20component%20blockedby%20short_desc
-bugzilla.redhat.com FALSE /bugzilla FALSE 2145917173 Bugzilla_logincookie 496436
-bugzilla.redhat.com FALSE /bugzilla FALSE 2145917173 Bugzilla_login 156481";
-my @BZ_URLs;
-# All package reviews
-push @BZ_URLs,
- "https://bugzilla.redhat.com/bugzilla/buglist.cgi?query_format=advanced&product=Fedora%20Extras&chfieldto=Now&component=Package%20Review&ctype=csv";
+my $rpc = new XMLRPC::Lite (
+ proxy => 'https://bugzilla.redhat.com/xmlrpc.cgi'
+);
+# Not sure of the way to increase the timeout on reading...
+$rpc->transport->timeout(360);
+$main::BZusername = "";
+$main::password = "";
my %opt;
-my @options = ( "help" );
+my @options = ( "help", "bu=s", "p=s" );
my @Ticket;
my $startDate = ParseDate("1 August 2005");
@@ -30,80 +28,35 @@
if( ! GetOptions( \%opt, @options ) ) { &usage(); }
# Override any default settings with arguments that the user has supplied
+$main::BZusername = $opt{"bu"} if defined $opt{"bu"};
+$main::password = $opt{"p"} if defined $opt{"p"};
&usage() if defined $opt{'help'};
-my ($tfh, $tfn) = tempfile();
-print $tfh $BZ_cooky;
-close $tfh;
-foreach my $url (@BZ_URLs) {
- local *IN;
- open IN, "wget --load-cookies $tfn -nv -O - \"$url\"|"
- or die "Failed to wget $url : $!";
- while ( <IN> ) {
- s/[,\n]+$//;
- my @F = split /,/;
- my $i = 0;
- while ($i <= $#F) {
- if (substr($F[$i], 0, 1) eq '"') {
- if (substr($F[$i], -1, 1) ne '"') {
- $F[$i] .= "," . $F[$i + 1];
- splice @F, $i + 1, 1;
- next;
- }
- }
- $i += 1;
- }
- if ($F[0] !~ /^\d+$/) {
- # Check header line
- if ($F[0] ne "bug_id"
- || $F[1] ne "\"opendate\""
- || $F[2] ne "\"changeddate\""
- || $F[3] ne "\"bug_severity\""
- || $F[4] ne "\"assigned_to\""
- || $F[5] ne "\"reporter\""
- || $F[6] ne "\"bug_status\""
- || $F[7] ne "\"resolution\""
- || $F[8] ne "\"component\""
- || $F[9] ne "\"blockedby\""
- || $F[10] ne "\"short_desc\"") {
- die "Bad header: $_";
- }
- next;
- }
- next if $F[10] =~ /TESTING-BUGSPAM/;
- next if $F[10] =~ /^.Tracker:/;
- warn "assigned_to should be an email address: $F[4]"
- if index($F[4], "@") < 0;
- warn "reporter should be an email address: $F[5]"
- if index($F[5], "@") < 0;
- $F[9] =~ s/["{}]//g;
- $F[1] =~ s/["]//g;
- $F[2] =~ s/["]//g;
- $F[6] =~ s/["]//g;
- $F[7] =~ s/["]//g;
- $F[8] =~ s/["]//g;
- $F[1] = ParseDate($F[1]);
- $F[2] = ParseDate($F[2]);
- push @Ticket, \@F;
- }
- close IN;
-}
-unlink $tfn;
-my @SubmitSortedT = sort { Date_Cmp($$a[1], $$b[1]) } @Ticket;
-my @ModifSortedT = sort { Date_Cmp($$a[2], $$b[2]) } @Ticket;
+my $bA = &runQuery($rpc);
+foreach my $bug (@$bA) {
+ # Try to guess package name
+ my $name = $bug->{'short_desc'};
+ $bug->{'opendate'} = ParseDate($bug->{'opendate'});
+ $bug->{'changeddate'} = ParseDate($bug->{'changeddate'});
+ next if $name =~ /TESTING-BUGSPAM/;
+ next if $name =~ /^.Tracker:/;
+ push @Ticket, $bug;
+}
+my @SubmitSortedT = sort { Date_Cmp($a->{'opendate'}, $b->{'opendate'}) } @Ticket;
+my @ModifSortedT = sort { Date_Cmp($a->{'changeddate'}, $b->{'changeddate'}) } @Ticket;
my $curDate = $startDate;
my $openCount = 0;
my @Open;
foreach my $e (@SubmitSortedT) {
- if (Date_Cmp($$e[1], $curDate) < 0) {
+ if (Date_Cmp($e->{'opendate'}, $curDate) < 0) {
$openCount += 1;
next;
}
push @Open, $openCount;
$openCount = 0;
$curDate = DateCalc($curDate, "+ 1 week");
- while (Date_Cmp($$e[1], $curDate) >= 0) {
+ while (Date_Cmp($e->{'opendate'}, $curDate) >= 0) {
push @Open, $openCount;
$curDate = DateCalc($curDate, "+ 1 week");
}
@@ -120,19 +73,20 @@
my @Close;
my @K = ("Accepted", "DUPLICATE", "Dropped");
foreach my $e (@ModifSortedT) {
- next if $$e[6] ne "CLOSED";
+ next if $e->{'bug_status'} ne "CLOSED";
my $key;
$key = "Accepted"
- if $$e[7] =~ /^(CURRENTRELEASE|NEXTRELEASE|RAWHIDE)$/;
+ if $e->{'resolution'} =~ /^(CURRENTRELEASE|NEXTRELEASE|RAWHIDE|ERRATA)$/;
$key = "DUPLICATE"
- if $$e[7] eq "DUPLICATE";
+ if $e->{'resolution'} eq "DUPLICATE";
$key = "Dropped"
- if $$e[7] =~ /^(CANTFIX|DEFERRED|NOTABUG|WONTFIX|WORKSFORME)$/;
+ if $e->{'resolution'} =~ /^(CANTFIX|DEFERRED|NOTABUG|WONTFIX|WORKSFORME|INSUFFICIENT_DATA|UPSTREAM)$/;
unless (defined $key) {
- print STDERR join("|", @$e), "\n";
+ print STDERR $e->{'bug_id'}, ": ", $e->{'resolution'}, "\n";
die "Can't classify";
+ #$key = "Dropped";
}
- if (Date_Cmp($$e[2], $curDate) < 0) {
+ if (Date_Cmp($e->{'changeddate'}, $curDate) < 0) {
$closeCount->{"all"} += 1;
$closeCount->{$key} += 1;
next;
@@ -140,7 +94,7 @@
push @Close, $closeCount;
$closeCount = {};
$curDate = DateCalc($curDate, "+ 1 week");
- while (Date_Cmp($$e[2], $curDate) >= 0) {
+ while (Date_Cmp($e->{'changeddate'}, $curDate) >= 0) {
push @Close, $closeCount;
$closeCount = {};
$curDate = DateCalc($curDate, "+ 1 week");
@@ -183,3 +137,59 @@
-help this help note\n";
exit 1;
}
+
+sub runQuery {
+ my ($rpc) = @_;
+ my $querydata = {
+ 'column_list' => ['opendate', 'changeddate', 'bug_severity', 'alias',
+ 'assigned_to', 'reporter', 'bug_status',
+ 'resolution', 'component', 'blockedby', 'short_desc'],
+ 'product' => ['Fedora'],
+ 'component' => ['Package Review'],
+ 'bug_status' => ["NEW", "VERIFIED", "ASSIGNED", "REOPENED",
+ "NEEDINFO_ENG", "NEEDINFO", "INVESTIGATE", "MODIFIED",
+ "ON_DEV", "UNCONFIRMED", "QA_READY", "ON_QA",
+ "FAILS_QA", "NEEDINFO_REPORTER", "RELEASE_PENDING",
+ "POST"]
+ };
+ my $call;
+ while (1) {
+ print STDERR "Running runQuery(rpc) all open\n";
+ eval {
+ $call = $rpc->call('bugzilla.runQuery', $querydata,
+ $main::BZusername, $main::password);
+ if ($call->faultstring) {
+ print STDERR $call->faultstring . "\n";
+ exit 1;
+ }
+ };
+ if ($@) {
+ warn $@;
+ } else {
+ last;
+ }
+ }
+ my $result = $call->result;
+ my $res_all = $result->{'bugs'};
+ $querydata->{'bug_status'} = ["CLOSED"];
+ while (1) {
+ print STDERR "Running runQuery(rpc) closed\n";
+ eval {
+ $call = $rpc->call('bugzilla.runQuery', $querydata,
+ $main::BZusername, $main::password);
+ if ($call->faultstring) {
+ print STDERR $call->faultstring . "\n";
+ exit 1;
+ }
+ };
+ if ($@) {
+ warn $@;
+ } else {
+ last;
+ }
+ }
+ $result = $call->result;
+ my $res2 = $result->{'bugs'};
+ push @$res_all, @$res2;
+ return $res_all;
+}
More information about the fedora-extras-commits
mailing list