]> git.donarmstrong.com Git - debbugs.git/commitdiff
- Add script to split index.db by severities (closes: #422062)
authorDon Armstrong <don@donarmstrong.com>
Sun, 17 Jun 2007 16:53:48 +0000 (17:53 +0100)
committerDon Armstrong <don@donarmstrong.com>
Sun, 17 Jun 2007 16:53:48 +0000 (17:53 +0100)
debian/changelog
examples/debian/misc/split_index.pl [new file with mode: 0644]

index 6b6618264c6d780d39dd53ac102aae3daf0a29a4..8a02f903b416d4b4d2fc1acbaf9403deeca55c95 100644 (file)
@@ -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 <cjwatson@debian.org>  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 (file)
index 0000000..18590b3
--- /dev/null
@@ -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";
+}