]> git.donarmstrong.com Git - debbugs.git/blobdiff - examples/debian/postpa/20impbugs
* Add the Debian specific scripts to the debbugs repository so we can
[debbugs.git] / examples / debian / postpa / 20impbugs
diff --git a/examples/debian/postpa/20impbugs b/examples/debian/postpa/20impbugs
new file mode 100755 (executable)
index 0000000..40f21c6
--- /dev/null
@@ -0,0 +1,37 @@
+#! /usr/bin/perl -w
+
+use warnings;
+use strict;
+
+use Debbugs::Config qw(:globals);
+use Debbugs::Common qw(splitpackages);
+use Debbugs::Status qw(get_bug_status);
+use Debbugs::Bugs qw(count_bugs);
+
+my %strong = map { $_ => 1 } @gStrongSeverities;
+
+my %impbugs = count_bugs(function => sub {
+    my %d = @_;
+
+    # Fast checks.
+    return () if $d{status} eq 'done' or not $strong{$d{severity}};
+    my %tags = map { $_ => 1 } split ' ', $d{tags};
+    return () if $tags{fixed} or $tags{'etch-ignore'};
+    return () if ($tags{potato} or $tags{woody} or $tags{sarge} or $tags{etch} or $tags{experimental}) and not $tags{sid};
+
+    # Unfortunately mergedwith isn't indexed.
+    my $status = get_bug_status(bug => $d{bug});
+    my @merged = sort split ' ', $status->{mergedwith};
+    return () if @merged and $merged[0] < $d{bug};
+
+    return splitpackages($d{pkg});
+});
+
+open IMPBUGS, '> /org/bugs.debian.org/www/stats/impbugs.txt.new'
+    or die "can't open impbugs.txt.new: $!";
+for my $pkg (reverse sort keys %impbugs) {
+    print IMPBUGS "$pkg $impbugs{$pkg}\n" or die "can't write to impbugs.txt.new: $!";
+}
+close IMPBUGS or die "can't close impbugs.txt.new: $!";
+rename '/org/bugs.debian.org/www/stats/impbugs.txt.new', '/org/bugs.debian.org/www/stats/impbugs.txt'
+    or die "can't rename impbugs.txt.new to impbugs.txt: $!";