X-Git-Url: https://git.donarmstrong.com/?p=bugscan.git;a=blobdiff_plain;f=scanlib.pm;h=068b9b4fbc6e07e95469a7ed2c1b8dde3b261975;hp=a24785ae3e873f20a593c1a04e81f464584b56b5;hb=a0159341c72ebaf4df5d7603a6e7c56e0320b559;hpb=ebb39cbbec146fa4f431b0a5ced772280ceb6f48 diff --git a/scanlib.pm b/scanlib.pm index a24785a..068b9b4 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() { @@ -182,7 +188,7 @@ sub scanspooldir() { for $f (@list) { next if $exclude{$f}; # Check the list of bugs to skip - my $bug = readbug("$f.summary"); + my $bug = Debbugs::Status::read_bug(summary => "$f.summary"); next if (!defined($bug)); $skip=1; @@ -212,18 +218,18 @@ sub scanspooldir() { } # only bother to check the versioning status for the distributions indicated by the tags - $status_oldstable = getbugstatus($bug, undef, 'oldstable') if ($oldstable_tag); - $status_stable = getbugstatus($bug, undef, 'stable') if ($stable_tag); - $status_testing = getbugstatus($bug, undef, 'testing') if ($testing_tag); - $status_unstable = getbugstatus($bug, undef, 'unstable') if ($unstable_tag); - $status_experimental = getbugstatus($bug, undef, 'experimental') if ($experimental_tag); + $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 .= (($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" : ""); + $relinfo .= (($oldstable_tag && $status_oldstable eq 'pending') ? "O" : ""); + $relinfo .= (($stable_tag && $status_stable eq 'pending') ? "S" : ""); + $relinfo .= (($testing_tag && $status_testing eq 'pending') ? "T" : ""); + $relinfo .= (($unstable_tag && $status_unstable eq 'pending') ? "U" : ""); + $relinfo .= (($experimental_tag && $status_experimental eq 'pending') ? "E" : ""); next if $relinfo eq '' and not $premature{$f}; $premature{$f}++ if $relinfo eq ''; @@ -361,5 +367,43 @@ sub wwwname() { # "$name"; } -1; +my $_version_cache = {}; +sub get_status() { + my ($bugnr, $bug, $dist) = @_; + + my $status = 'pending'; + + my @versions = Debbugs::Status::getversions($bug->{'package'}, $dist, undef); + my @sourceversions = Debbugs::Status::makesourceversions($bug->{'package'}, undef, @versions); + + if (@sourceversions) { + my $max_buggy = Debbugs::Status::max_buggy(bug => $bugnr, + sourceversions => \@sourceversions, + found => $bug->{'found_versions'}, + fixed => $bug->{'fixed_versions'}, + version_cache => $_version_cache, + package => $bug->{'package'}); + if ($max_buggy eq 'absent') { + $status = 'absent'; + } elsif ($max_buggy eq 'fixed') { + $status = 'done'; + } + } + if (length($bug->{'done'}) and + (not @sourceversions or not @{$bug->{'fixed_versions'}})) { + $status = 'done'; + } + + return $status; +} + +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; +}