status-report-scripts parseBZbugList,1.73,1.74
Christian Iseli (c4chris)
fedora-extras-commits at redhat.com
Tue Jun 19 22:11:37 UTC 2007
Author: c4chris
Update of /cvs/fedora/status-report-scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9837
Modified Files:
parseBZbugList
Log Message:
Use XMLRPC on all BZ queries. Adapt to new Fedora product.
Index: parseBZbugList
===================================================================
RCS file: /cvs/fedora/status-report-scripts/parseBZbugList,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- parseBZbugList 5 Jun 2007 13:25:03 -0000 1.73
+++ parseBZbugList 19 Jun 2007 22:11:35 -0000 1.74
@@ -21,7 +21,6 @@
# - Maybe report a count of FE-DEADREVIEW.
# - Track packages that do not build on all supported arches, and check they
# have an arch dependent BZ tracking ticket.
-# - Use RPC also for open bug reports and quit querying BZ through wget
use strict;
use Getopt::Long;
@@ -33,14 +32,6 @@
proxy => 'https://bugzilla.redhat.com/bugzilla/xmlrpc.cgi'
);
-# 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\n";
-my @BZ_URLs;
-# All open Fedora bug reports
-push @BZ_URLs,
- "https://bugzilla.redhat.com/bugzilla/buglist.cgi?query_format=advanced&product=Fedora%20Extras&version=4&version=5&version=6&version=devel&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=MODIFIED&bug_severity=security&bug_severity=high&bug_severity=normal&bug_severity=low&bug_severity=translation&bug_severity=regression&chfieldto=Now&negate0=1&field0-0-0=component&type0-0-0=equals&value0-0-0=Package%20Review&ctype=csv";
-
my %opt;
my @options = ( "help", "repourl=s", "o=s", "d=s", "cvs=s",
"comps=s", "currel=i", "firstrel=i", "u=s", "bu=s", "p=s" );
@@ -143,15 +134,11 @@
local *IN;
my $prev;
open IN, $opt{"o"} or die "Couldn't open $opt{'o'} : $!";
- # Fedora Extras|aalib|An ASCII art library|anvil at livna.org|extras-qa at fedoraproject.org|
while ( <IN> ) {
next if /^#/;
s/\s+$//;
my @F = split /\|/;
next if $F[1] eq "";
- if (lc($F[1]) lt lc($prev)) {
- print STDERR "Sorting problem in owners.list: $F[1] lt $prev\n";
- }
$prev = $F[1];
# Keep only primary owner
$F[3] =~ s/,.*$//;
@@ -314,83 +301,30 @@
}
close IN;
}
-my ($tfh, $tfn) = tempfile();
-print $tfh $BZ_cooky;
-close $tfh;
-system
- "grep Bugzilla_login"
- . " $ENV{'HOME'}/.mozilla/firefox/*default*/cookies.txt"
- . " >>$tfn";
-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;
- }
- 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[4] =~ s/["]//g;
- $F[5] =~ s/["]//g;
- $F[8] =~ s/["]//g;
- $F[1] = ParseDate($F[1]);
- $F[2] = ParseDate($F[2]);
- my @B = split /,/, $F[9];
- next if $F[10] =~ /TESTING-BUGSPAM/;
- $F[11] = $F[10];
- $F[11] =~ s/^["]+//;
- $F[11] =~ s/["]+$//;
- if (defined $OWN{$F[8]}) {
- $COUNT_LIST{"openOPEN-BUGS"} += 1;
- $BZB{$F[0]} = {
- 'bug_id' => $F[0],
- 'opendate' => $F[1],
- 'changeddate' => $F[2],
- 'assigned_to' => $F[4],
- 'reporter' => $F[5],
- 'pkg_name' => $F[8],
- 'short_desc' => $F[10]
- };
- next;
- }
- print STDERR "Not handled: ", join(" ", @F), "\n";
+# Grab open BZ bug report tickets
+my @PKG_L = keys %OWN;
+my $i = 0;
+while ($i <= $#PKG_L) {
+ my @A;
+ for my $j (1 .. 512) {
+ push @A, $PKG_L[$i];
+ $i += 1;
+ last if $i > $#PKG_L;
+ }
+ print STDERR "Running runQueryOpenBugs at $i\n";
+ my $bA = &runQueryOpenBugs($rpc, \@A);
+ foreach my $bug (@$bA) {
+ warn "assigned_to should be an email address: " . $bug->{'assigned_to'}
+ if index($bug->{'assigned_to'}, "@") < 0;
+ warn "reporter should be an email address: " . $bug->{'reporter'}
+ if index($bug->{'reporter'}, "@") < 0;
+ $bug->{'opendate'} = ParseDate($bug->{'opendate'});
+ $bug->{'changeddate'} = ParseDate($bug->{'changeddate'});
+ $bug->{'pkg_name'} = $bug->{'component'};
+ $COUNT_LIST{"openOPEN-BUGS"} += 1;
+ $BZB{$bug->{'bug_id'}} = $bug;
}
- close IN;
}
-unlink $tfn;
&checkOpenInOwners(\%BZR, "FE-REVIEW");
&checkOpenInOwners(\%BZN, "FE-NEW");
&checkOwners;
@@ -483,7 +417,7 @@
$OWNER_STAT{$orphans} = [ 0, 0, 0, 0, {} ];
foreach my $k (keys %OWN) {
my $a = $OWN{$k};
- next if (($$a[0] ne "Fedora Extras") && ($$a[0] ne "Fedora Core"));
+ next if $$a[0] ne "Fedora";
$cnt += 1;
my $s = $OWNER_STAT{$$a[3]};
if (defined $s) {
@@ -1076,9 +1010,10 @@
sub displayNewReviewWiki {
my ($BZ, $cur, $field) = @_;
+ my $cnt = $COUNT_LIST{"open$cur"};
+ return unless $cnt > 0;
print "\n\n== About $cur packages ==\n";
print "\n\n=== Open ticket count ===\n";
- my $cnt = $COUNT_LIST{"open$cur"};
print "\nWe have $cnt open tickets in $cur\n";
if ($COUNT_LIST{"inactive8$cur"} > 0
|| $COUNT_LIST{"inactive4$cur"} > 0) {
@@ -1104,8 +1039,9 @@
sub displayNewReviewMail {
my ($cur) = @_;
- print STDERR "\n$cur packages stats:\n";
my $cnt = $COUNT_LIST{"open$cur"};
+ return unless $cnt > 0;
+ print STDERR "\n$cur packages stats:\n";
print STDERR " - $cnt open tickets\n";
if ($COUNT_LIST{"inactive8$cur"} > 0) {
$cnt = $COUNT_LIST{"inactive8$cur"};
@@ -1364,7 +1300,7 @@
'column_list' => ['opendate', 'changeddate', 'bug_severity', 'alias',
'assigned_to', 'reporter', 'bug_status',
'resolution', 'component', 'blockedby', 'short_desc'],
- 'product' => ['Fedora Extras'],
+ 'product' => ['Fedora'],
'component' => ['Package Review'],
'field0-0-0' => 'flagtypes.name',
'bug_status' => ["NEW", "VERIFIED", "ASSIGNED", "REOPENED", "CLOSED",
@@ -1375,7 +1311,13 @@
};
if ($flag eq " ") {
$querydata->{'type0-0-0'} = 'notregexp';
- $querydata->{'value0-0-0'} = 'fedora-review[-+?]'
+ $querydata->{'value0-0-0'} = 'fedora-review[-+?]';
+ $querydata->{'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"];
} else {
$querydata->{'type0-0-0'} = 'equals';
$querydata->{'value0-0-0'} = "fedora-review$flag";
@@ -1383,6 +1325,28 @@
my $call = $rpc->call('bugzilla.runQuery', $querydata,
$main::BZusername, $main::password);
if ($call->faultstring) {
+ print STDERR "Running runQuery(rpc, '$flag')\n";
+ print STDERR $call->faultstring . "\n";
+ exit 1;
+ }
+ my $result = $call->result;
+ return $result->{'bugs'};
+}
+
+sub runQueryOpenBugs {
+ my ($rpc, $pkg) = @_;
+ my $querydata = {
+ 'column_list' => ['opendate', 'changeddate', 'bug_severity', 'alias',
+ 'assigned_to', 'reporter', 'bug_status',
+ 'resolution', 'component', 'blockedby', 'short_desc'],
+ 'product' => ['Fedora'],
+ 'component' => $pkg,
+ 'bug_status' => ["NEW", "VERIFIED", "ASSIGNED", "REOPENED", "MODIFIED"]
+ };
+ my $call = $rpc->call('bugzilla.runQuery', $querydata,
+ $main::BZusername, $main::password);
+ if ($call->faultstring) {
+ print STDERR "Running runQueryOpenBugs(rpc, pkg_array)\n";
print STDERR $call->faultstring . "\n";
exit 1;
}
More information about the fedora-extras-commits
mailing list