Please find attached a newers bugs-summary generating script to be run for QA, which will generate bug summaries for the PTS, DDPO, and potentially further use.
I cannot check whether this runs fine as-is on merkel of course, somebody else would need to check. Please make the generated files available via http. This script runs one time for both PTS and DDPO, it uses the ldap file for generation, and adds a timestamp to the output for use in DDPO/PTS/wherever. I tested it, but couldn't test the src_to_bin part because I couldn't find Sources.all files anywhere, I guess those can only be found on merkel or in any case, only accessible for DD's. If I understand correctly, this script is already used now (via my own computer) to generate bug summaries for the PTS again, thanks to Andreas Barth. --Jeroen -- Jeroen van Wolffelaar [EMAIL PROTECTED] http://jeroen.A-Eskwadraat.nl
#!/usr/bin/perl # {{{ Legalese # Copyright 2002 Raphaël Hertzog # Copyright 2004 Andreas Barth, Jeroen van Wolffelaar # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # # This script generates bug count summaries source-packagewise and # binary-packagewise for use in f.e. the PTS and DDPO # # Idea and first implementation by Raphaël Hertzog, rewritten for the LDAP # interface by Andreas Barth, and generalized for generic use by Jeroen van # Wolffelaar # }}} use strict; no strict 'subs'; use File::stat; # IN my $LDAP_FILE = "/home/mirror/debian/bts2ldap/fullindex"; my $SOURCES_ALL = "/org/qa.debian.org/data/ftp"; # OUT my $PTS = "/tmp/bugs.pts.txt"; my $BINARY_FULL = "/tmp/bugs.bin.full.txt"; my $SOURCE_FULL = "/tmp/bugs.src.full.txt"; my %stats; my $ldap_time; my $time = time(); # {{{ Process the LDAP file to generate bugstats in %stats my %bug; open(IN, "< $LDAP_FILE") or die "Can't open LDAP file: $!"; my $ldap_time = stat(IN)->mtime; while(<IN>) { chomp; if (/^$/) { &add_bug_to_index; %bug = undef; } elsif (/^debbugsState: done/) { $bug{'ignore'} = 1; } elsif (/^debbugsID: (.+)/) { $bug{'id'} = $1; } elsif (/^debbugsPackage: (.+)/) { $bug{'package'} = $1; } elsif (/^debbugsMergedWith: (.+)/) { # Set merged if and only if merged with an older bug $bug{'merged'} = 1 if $1 < $bug{'id'}; } elsif (/^debbugsTag: (fixed|pending)$/) { $bug{'fixed-or-pending'} = "yes"; } elsif (/^debbugsSeverity: (.+)/) { $bug{'severity'}= $1; } } close IN; &add_bug_to_index; sub add_bug_to_index { return if not exists $bug{'package'} or $bug{'ignore'} ; my $severity; $severity = "RC" if (grep { $bug{'severity'} eq $_ } qw(critical grave serious)); $severity = "IN" if (grep { $bug{'severity'} eq $_ } qw(important normal)); $severity = "MW" if (grep { $bug{'severity'} eq $_ } qw(minor wishlist)); die "Unknow severity $bug{severity} at package $bug{package} ($bug{id})" unless $severity; $severity = "FP" if $bug{'fixed-or-pending'}; $stats{$bug{'package'}}{$severity}++; $stats{$bug{'package'}}{$severity."M"}++ unless $bug{'merged'} } # }}} # {{{ Parse Sources.all files to get bin <-> src relations into %bin_to_src my %bin_to_src; foreach my $release ('stable', 'testing', 'unstable') { open(SOURCES, "< $SOURCES_ALL/$release/all/Sources.all") or next; my ($package, $binaries) = (undef, undef); while(<SOURCES>) { chomp; $package = $1 if /^Package: (.+)$/; $binaries = [split /\s*,\s*/, $1] if /^Binary: (.+)$/; if (/^$/ && $package && $binaries) { $bin_to_src{$_} = $package for (@$binaries); ($package, $binaries) = (undef, undef); } } close SOURCES; if ($package && $binaries) { $bin_to_src{$_} = $package for (@$binaries); ($package, $binaries) = (undef, undef); } } # }}} # {{{ Loop over %stats to generate summaries open PTS , "> $PTS.new" or die ("Couldn't open $PTS.new: $!"); open BINARY_FULL, "> $BINARY_FULL.new" or die ("Couldn't open $BINARY_FULL.new: $!"); print PTS "TRACE.debbugs.LDAP.mtime $ldap_time\n"; print PTS "TRACE.qa.data.bugs $time\n"; print BINARY_FULL "TRACE.debbugs.LDAP.mtime: $ldap_time\n"; print BINARY_FULL "TRACE.qa.data.bugs: $time\n"; my %source_stats; foreach my $package (keys %stats) { my $c = $stats{$package}; my (@simple, @full); for my $sev (qw(RC IN MW FP)) { push @simple, 0+$c->{$sev}; push @full, (0+$c->{$sev}).'('.(0+$c->{$sev.'M'}).')'; $source_stats{$bin_to_src{$package}}{$sev} += $c->{$sev}; $source_stats{$bin_to_src{$package}}{$sev.'M'} += $c->{$sev.'M'}; } print PTS "$package @simple\n"; print BINARY_FULL "$package: @full\n"; } rename("$PTS.new", $PTS) or die($!); rename("$BINARY_FULL.new", $BINARY_FULL) or die($!); # }}} # {{{ Loop over %source_stats to generate summaries open SOURCE_FULL, "> $SOURCE_FULL.new" or die ("Couldn't open $SOURCE_FULL.new: $!"); print SOURCE_FULL "TRACE.debbugs.LDAP.mtime: $ldap_time\n"; print SOURCE_FULL "TRACE.qa.data.bugs: $time\n"; foreach my $package (keys %source_stats) { my $c = $source_stats{$package}; my @full; for my $sev (qw(RC IN MW FP)) { push @full, (0+$c->{$sev}).'('.(0+$c->{$sev.'M'}).')'; } print SOURCE_FULL "$package: @full\n"; } rename("$SOURCE_FULL.new", $SOURCE_FULL) or die($!); # }}} # vim: ts=8 fdm=marker