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

Other script for creation of /org/qa.debian.org/data/ddpo/results/bugs.txt?



Hi,

I had the idea to create this file on master without the need to open
the summary files, because now all necessary information is stored in
the single file for ldap. Well, the following is a script by me as a
proof of concept; it needs less than 5 seconds for creation of that
file (and is certainly much optimizable ;). This is of course just an
idea, and open to discussion. And, one feature is missing: This code
does it on binary packages, not on source packages, as master is not
an ftp-mirror.


Cheers,
Andi

#! /usr/bin/perl -w

my %c=();

open(IN, "< /debian/home/aba/bts2ldap.new/data/fullindex") || die "Cant open data file";
while(<IN>) {
        chomp ;
        if (/^$/) {
                &addpackage;
                %c=();
                next;
        }
        if (/debbugsID: (.*)/) {
                $c{'id'} = $1;
                next;
        }
        if (/debbugsPackage: (.*)/) {
                $c{'package'} = $1;
                next;
        }
        if (/debbugsMerged: (.*)/) {
                if ((!($c{'m'})) || ($c{'m'} > $1)) {
                        $c{'m'}=$1;
                }
                next;
        }
        if ((/debbugsTag: fixed/) || (/debbugsTag: pending/)) {
                $c{'fp'}=1;
                next;
        }
        if (/debbugsSeverity: (.*)/) {
                $c{'severity'}=$1;
                next;
        }
}

&addpackage;

sub addpackage {
        (%c) || (return);
        if ($c{'severity'}=~ /critical|grave|serious/) {
                $s="RC";
        } elsif ($c{'severity'}=~ /important|normal/) {
                $s="IN";
        } elsif ($c{'severity'}=~ /minor|wishlist/) {
                $s="MW";
        } else {
                die "Unknow severity $c{'severity'} at package $c{'package'} ($c{'id'}";
        }
        if ($c{'fp'}) {
                $s="FP";
        }

        $global{$c{'package'}}{$s}++;
        if ((!($c{'m'})) || ($c{'m'} > $c{'id'})) {
                $global{$c{'package'}}{$s."M"}++;
        }
}


foreach $i (keys %global) {
        print "$i:";
        foreach $j ('RC', 'IN', 'MW', 'FP') {
                $global{$i}{$j} += 0;
                $global{$i}{$j."M"} += 0;
                print $global{$i}{$j}."(".$global{$i}{$j."M"}.")";
                if ($j ne 'FP') {
                        print " ";
                }
        }
        print "\n";
}
-- 
   http://home.arcor.de/andreas-barth/
   PGP 1024/89FB5CE5  DC F1 85 6D A6 45 9C 0F  3B BE F1 D0 C5 D1 D9 0C



Reply to: