From: Don Armstrong Date: Sun, 17 Jun 2007 16:53:48 +0000 (+0100) Subject: - Add script to split index.db by severities (closes: #422062) X-Git-Tag: release/2.6.0~546^2~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=1293075f3467c7683a7af31a8c0f1f7ec6b7cc1b;p=debbugs.git - Add script to split index.db by severities (closes: #422062) --- diff --git a/debian/changelog b/debian/changelog index 6b66182..8a02f90 100644 --- a/debian/changelog +++ b/debian/changelog @@ -191,6 +191,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low - Allow ordering bugs by last action (closes: #318898) - Add notfixed/notfound commands (closes: #389634) - Fix soapy insanity (closes: #422062) + - Add script to split index.db by severities (closes: #422062) -- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100 diff --git a/examples/debian/misc/split_index.pl b/examples/debian/misc/split_index.pl new file mode 100644 index 0000000..18590b3 --- /dev/null +++ b/examples/debian/misc/split_index.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Debbugs::Config qw(:config); + +my $index_db = IO::File->new("$config{spool}/index.db",'r') or + die "Unable to open $config{spool}/index.db for reading: $!"; + +my %severity_fh; + +for my $severity (@{$config{severity_list}}) { + my $temp_fh = IO::File->new("$config{spool}/index-${severity}.db",'w') or + die "Unable to open $config{spool}/index-${severity}.db for writing: $!"; + $severity_fh{$severity} = $temp_fh; +} + +while (<$index_db>) { + my $line = $_; + next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/; + my ($pkg,$bug,$time,$status,$submitter,$severity,$tags) = ($1,$2,$3,$4,$5,$6,$7); + print {$severity_fh{$severity}} $line if exists $severity_fh{$severity}; +} + +for my $severity (@{$config{severity_list}}) { + close $severity_fh{$severity}; + system('gzip','-f',"$config{spool}/index-${severity}.db") == 0 or + die "Failure while compressing $config{spool}/index-${severity}.db"; +}