X-Git-Url: https://git.donarmstrong.com/?p=bugscan.git;a=blobdiff_plain;f=scanlib.pm;h=3680b10f2a65a7804693a6d5ca3bdd8d689392cf;hp=faee90cddb7c412dfac1a84022f5f91881c8c201;hb=086ede49f3aef03abe22686dd67dd4d2012b3440;hpb=d5a0b74a3ddd8ad47fb594e890dfd0f454627655 diff --git a/scanlib.pm b/scanlib.pm index faee90c..3680b10 100644 --- a/scanlib.pm +++ b/scanlib.pm @@ -14,7 +14,13 @@ # %packagelist - map from packagename to bugreports # %NMU - map with NMU information +use lib qw(/org/bugs.debian.org/perl/); use LWP::UserAgent; +use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522); +use Debbugs::Packages; +use Debbugs::Versions; +use Debbugs::Status; +use Fcntl qw(O_RDONLY); require bugcfg; sub readcomments() { @@ -167,8 +173,6 @@ sub scanspooldir() { local($dir) = @_; local($f); # While we're currently processing local(@list); # List of files to process - local($s_originator, $s_date, $s_subject, $s_msgid, $s_package, $s_keywords); - local($s_done, $s_forwarded, $s_mergedwith, $s_severity); local($skip); # Flow control local($walk); # index variable local($taginfo); # Tag info @@ -176,70 +180,77 @@ sub scanspooldir() { chdir($dir) or die "chdir $dir: $!\n"; opendir(DIR, $dir) or die "opendir $dir: $!\n"; - @list = grep { s/\.status$// } - grep { m/^\d+\.status$/ } + @list = grep { s/\.summary$// } + grep { m/^\d+\.summary$/ } readdir(DIR); closedir(DIR); for $f (@list) { next if $exclude{$f}; # Check the list of bugs to skip - next if (!open(S,"$f.status")); # Check bugs without a status (?) - - chomp($s_originator = ); - chomp($s_date = ); - chomp($s_subject = ); - chomp($s_msgid = ); - chomp($s_package = ); - chomp($s_tags = ); - chomp($s_done = ); - chomp($s_forwarded = ); - chomp($s_mergedwith = ); - chomp($s_severity = ); - close(S); - - next if length($s_done) and not $premature{$f}; - $premature{$f}++ if length($s_done); - - $s_severity =~ y/A-Z/a-z/; - $s_tags =~ y/A-Z/a-z/; - + + my $bug = Debbugs::Status::read_bug(summary => "$f.summary"); + next if (!defined($bug)); + $skip=1; for $walk (@priorities) { - $skip=0 if $walk eq $s_severity; + $skip=0 if $walk eq $bug->{'severity'}; } - for $tag (split(' ', $s_tags)) { + my @tags = split(' ', $bug->{'keywords'}); + for $tag (@tags) { for $s (@skiptags) { $skip=1 if $tag eq $s; } } next if $skip==1; + + my $oldstable_tag = grep(/^woody$/, @tags); + my $stable_tag = grep(/^sarge$/, @tags); + my $testing_tag = grep(/^etch$/, @tags); + my $unstable_tag = grep(/^sid$/, @tags); + my $experimental_tag = grep(/^experimental$/, @tags); + + # default according to dondelelcaro 2006-11-11 + if (!$oldstable_tag && !$stable_tag && !$testing_tag && !$unstable_tag && !$experimental_tag) { + $testing_tag = 1; + $unstable_tag = 1; + $experimental_tag = 1; + } + + # only bother to check the versioning status for the distributions indicated by the tags + $status_oldstable = get_status($f, $bug, 'oldstable') if ($oldstable_tag); + $status_stable = get_status($f, $bug, 'stable') if ($stable_tag); + $status_testing = get_status($f, $bug, 'testing') if ($testing_tag); + $status_unstable = get_status($f, $bug, 'unstable') if ($unstable_tag); + $status_experimental = get_status($f, $bug, 'experimental') if ($experimental_tag); $relinfo = ""; - $relinfo .= ($s_tags =~ /\bwoody\b/ ? "O" : ""); - $relinfo .= ($s_tags =~ /\bsarge(|\s.*)%/ ? "S" : ""); - $relinfo .= ($s_tags =~ /\betch(|\s.*)$/ ? "T" : ""); - # etch-ignore matches \betch\b :( - $relinfo .= ($s_tags =~ /\bsid\b/ ? "U" : ""); - $relinfo .= ($s_tags =~ /\bexperimental\b/ ? "E" : ""); + $relinfo .= (($oldstable_tag && $status_oldstable->{'pending'} eq 'pending') ? "O" : ""); + $relinfo .= (($stable_tag && $status_stable->{'pending'} eq 'pending') ? "S" : ""); + $relinfo .= (($testing_tag && $status_testing->{'pending'} eq 'pending') ? "T" : ""); + $relinfo .= (($unstable_tag && $status_unstable->{'pending'} eq 'pending') ? "U" : ""); + $relinfo .= (($experimental_tag && $status_experimental->{'pending'} eq 'pending') ? "E" : ""); + + next if $relinfo eq '' and not $premature{$f}; + $premature{$f}++ if $relinfo eq ''; $taginfo = "["; - $taginfo .= ($s_tags =~ /\bpending\b/ ? "P" : " "); - $taginfo .= ($s_tags =~ /\bpatch\b/ ? "+" : " "); - $taginfo .= ($s_tags =~ /\bhelp\b/ ? "H" : " "); - $taginfo .= ($s_tags =~ /\bmoreinfo\b/ ? "M" : " "); - $taginfo .= ($s_tags =~ /\bunreproducible\b/ ? "R" : " "); - $taginfo .= ($s_tags =~ /\bsecurity\b/ ? "S" : " "); - $taginfo .= ($s_tags =~ /\bupstream\b/ ? "U" : " "); - $taginfo .= ($s_tags =~ /\betch-ignore\b/ ? "I" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bpending\b/ ? "P" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bpatch\b/ ? "+" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bhelp\b/ ? "H" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bmoreinfo\b/ ? "M" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bunreproducible\b/ ? "R" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bsecurity\b/ ? "S" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\bupstream\b/ ? "U" : " "); + $taginfo .= ($bug->{'keywords'} =~ /\betch-ignore\b/ ? "I" : " "); $taginfo .= "]"; - if ($s_mergedwith) { # Only show the first package if things are merged - my @merged = split(' ', $s_mergedwith); + if (length($bug->{'mergedwith'})) { + my @merged = split(' ', $bug->{'mergedwith'}); next if ($merged[0] < $f); } - for $package (split /[,\s]+/, $s_package) { + for $package (split /[,\s]+/, $bug->{'package'}) { $_= $package; y/A-Z/a-z/; $_= $` if m/[^-+._a-z0-9]/; if (not defined $section{$_}) { if (defined $debbugssection{$_}) { @@ -258,7 +269,7 @@ sub scanspooldir() { $relinfo = " [$relinfo]"; } - $bugs{$f} = "$f $taginfo$relinfo $s_subject"; + $bugs{$f} = "$f $taginfo$relinfo " . $bug->{'subject'}; } } @@ -356,5 +367,28 @@ sub wwwname() { # "$name"; } -1; +my $_version_cache = {}; +sub get_status() { + my ($bugnr, $bug, $dist) = @_; + my @versions = Debbugs::Status::getversions($bug->{'package'}, $dist, undef); + my @sourceversions = Debbugs::Status::makesourceversions($bug->{'package'}, $dist, @versions); + + return Debbugs::Status::max_buggy(bug => $bugnr, + sourceversions => \@sourceversions, + found => $bug->{'found_versions'}, + fixed => $bug->{'fixed_versions'}, + version_cache => $_version_cache, + package => $bug->{'package'}); +} + +sub check_worry { + my ($status) = @_; + + if ($status =~ m/^\[[^]]*I/ or + $status =~ m/ \[[^]]*X/ or + ($status =~ m/ \[[^]]*[OSUE]/ and $status !~ m/ \[[^]]*T/)) { + return 0; + } + return 1; +}