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

britney and version tracking



Hi,

the script below produces two files based on the version tracking
information: impbugs.testing.txt and impbugs.unstable.txt which includes
the number of RC-bugs in the matching distributions, and could be
plugged into britney.


Cheers,
Andi


#! /usr/bin/perl -w

package debbugs;
use strict;
require '/etc/debbugs/config';
use vars qw(@gStrongSeverities);

require '/org/bugs.debian.org/cgi-bin/common.pl';
use vars qw($pkgsrc);

package main;

my %strong = map { $_ => 1 } @debbugs::gStrongSeverities;
#my $pkgsrc = getpkgsrc();

for my $dist ('testing', 'unstable') {
  my %impbugs = debbugs::countbugs(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'};

    # Unfortunately mergedwith isn't indexed.
    my $status = debbugs::getbugstatus($d{bug});
    my @merged = sort split ' ', $status->{mergedwith};
    return () if @merged and $merged[0] < $d{bug};

    debbugs::set_option('dist', $dist);
    my %affected=();

    foreach my $pkg (debbugs::splitpackages($d{pkg})) {
        my @versions = debbugs::getversions($pkg, $dist, 'source');
        if (defined $versions[0]) {
            if (not $debbugs::pkgsrc->{$pkg} or $pkg eq $debbugs::pkgsrc->{$pkg
}) { # if it has source and is source-only, the makesourceversions fails ...
               @versions = map { "$pkg/$_" unless /^\//} @versions;
            } else {
               @versions = makesourceversions($pkg, 'source', @versions);
            }
        } else {
            @versions = debbugs::getversions($pkg, $dist, 'i386');
            ## ^ buggy - we assume that i386 keeps up
            @versions = debbugs::makesourceversions($pkg, 'i386', @versions);
        }
        for my $version (@versions) {
           my $buggy = debbugs::buggyversion($d{bug}, $version, $status);
           if ($buggy eq 'found') {
               $affected{$pkg}=1;
               last;
           }
        }
    }
    return keys %affected;
});

  open IMPBUGS, "> impbugs.$dist.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.ne
w: $!";
  }
  close IMPBUGS or die "can't close impbugs.txt.new: $!";
  rename "/org/bugs.debian.org/www/stats/impbugs.$dist.txt.new", "/org/bugs.deb
ian.org/www/stats/impbugs.$dist.txt"
    or die "can't rename impbugs.txt.new to impbugs.txt: $!";
}



Reply to: