[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Script to query wnpp&ftp entries for use in PTS/DDPO



Hi,

Could someone commit the below script to /org/qa.debian.org/data/bts,
after making sure it works of course, and add a suitable cron entry for
it? The fullindex is updated every 15 minutes, and if it doesn't take
too long to run this one on merkel, IMHO it's fine to run it four times
an hour too.

Patch for developer.php to display the data generated by this script
will be forthcoming.

Thanks,
--Jeroen

-- 
Jeroen van Wolffelaar
Jeroen@wolffelaar.nl (also for Jabber & MSN; ICQ: 33944357)
http://Jeroen.A-Eskwadraat.nl
#!/usr/bin/perl

# Summary wnpp and removal request entries for use in QA pages
# Copyright (C) 2004  Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
# $Id$

# 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.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


# Output definition:
# - key-value pairs of source package name and wnpp/rm status
# - the plain text file is <key>:\s+<value>
# - the value is one or more '|'-separated times "<type>\s+<bugnr>[\s+
#   reserved for future expansions]"
# - type is one of O, RFA, RFH, ITA, RM, possibly more later

use Mail::Header;

my $BTS2LDAP = "../bts2ldap/fullindex";
my $OUT = "wnpp_rm";

open INDEX, $BTS2LDAP or die "Couldn't open bts ldap index file";

my %results;
while (1) {
	my $reader = new Mail::Header \*INDEX;
	last unless $reader->get("debbugsID") > 0;
	$package = $reader->get("debbugsPackage");
	chomp($package);
	next unless $package eq "wnpp" or $package eq "ftp.debian.org";
	next unless $reader->get("debbugsState") =~ /^(open|forwarded)$/;
	my $title = $reader->get("debbugsTitle");
	$title =~ /(O|RFA|RFH|ITA|RM):\s+([a-z0-9.+-]+)\s+(?:--.*|)$/ or next;
	my $bugnr = $reader->get("debbugsID");
	chomp($bugnr);
	if (exists $results{$2}) {
		$results{$2} .= "|$1 $bugnr";
	} else {
		$results{$2} = "$1 $bugnr";
	}
}
close INDEX;
open DB, "| db4.2_load -T -t btree $OUT.db" or
	die "Error opening database output file";
open OUT, ">$OUT" or die "Error opening plaintext output file";
while (($k,$v) = each(%results)) {
	print OUT "$k: $v\n";
	print DB "$k\n$v\n";
}
close OUT;
close DB;

Reply to: