X-Git-Url: https://git.donarmstrong.com/?p=bugscan.git;a=blobdiff_plain;f=scanlib.pm;h=3dca704000de24c6dfc17caa78410b7cde07edaf;hp=65adb6312e18fff97c260f87f311071e49436452;hb=817d5389c87ae35e3dabbcc689d1fd77a339daa2;hpb=4ef8564c7e87c67015de727dbf9bd23a51f927d3 diff --git a/scanlib.pm b/scanlib.pm index 65adb63..3dca704 100644 --- a/scanlib.pm +++ b/scanlib.pm @@ -6,8 +6,6 @@ # which was based on an unknown other script. # # Global variables: -# %premature - list of prematurely closed bugreports -# %exclude - list of bugreports to exclude from the report # %maintainer - map from packagename to maintainer # %section - map from packagename to section in the FTP-site # %packagelist - map from packagename to bugreports @@ -24,7 +22,7 @@ use warnings; require bugcfg; package scanlib; -our (%premature,%exclude,%maintainer,%section,%packagelist,%debbugssection,%bugs); +our (%maintainer,%section,%packagelist,%debbugssection,%bugs); # Read the list of maintainer @@ -153,11 +151,15 @@ sub scanspooldir() { closedir(DIR); for $f (@list) { - next if $exclude{$f}; # Check the list of bugs to skip - my $bug = Debbugs::Status::read_bug(summary => "$f.summary"); next if (!defined($bug)); + my $bi = { + number => $f, + subject => $bug->{'subject'}, + package => $bug->{'package'} + }; + $skip=1; for $walk (@bugcfg::priorities) { $skip=0 if $walk eq $bug->{'severity'}; @@ -185,33 +187,23 @@ sub scanspooldir() { $disttags{'experimental'} = 1; } - my $relinfo = ""; if (defined($section{$bug->{'package'}}) && $section{$bug->{'package'}} eq 'pseudo') { # versioning information makes no sense for pseudo packages, # just use the tags for my $dist qw(oldstable stable testing unstable experimental) { - $relinfo .= uc(substr($dist, 0, 1)) if $disttags{$dist}; + $bi->{$dist} = $disttags{$dist}; } next if (length($bug->{'done'})); } else { + my $affects_any = 0; + # only bother to check the versioning status for the distributions indicated by the tags for my $dist qw(oldstable stable testing unstable experimental) { local $SIG{__WARN__} = sub {}; + $bi->{$dist} = 0; next if (!$disttags{$dist}); - # This is needed for now - my $exists = 0; - for my $arch (@bugcfg::architectures) { - for my $pkg (split /[,\s]+/, $bug->{'package'}) { - my @versions = Debbugs::Packages::getversions($pkg, $dist, $arch); - $exists = 1 if (scalar @versions > 0); - } - last if $exists; - } - - next if !$exists; - my $presence = Debbugs::Status::bug_presence( bug => $f, status => $bug, @@ -224,24 +216,17 @@ sub scanspooldir() { # indicates that no versioning information is present and it's not closed # unversioned) if (!defined($presence) || ($presence ne 'absent' && $presence ne 'fixed')) { - $relinfo .= uc(substr($dist, 0, 1)); + $bi->{$dist} = 1; + $affects_any = 1; } } - next if $relinfo eq '' and not $premature{$f}; - $premature{$f}++ if $relinfo eq ''; + next if !$affects_any; } - $taginfo = "["; - $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 .= "]"; + for my $keyword qw(pending patch help moreinfo unreproducible security upstream sarge-ignore etch-ignore) { + $bi->{$keyword} = ($bug->{'keywords'} =~ /\b$keyword\b/) ? 1 : 0; + } if (length($bug->{'mergedwith'})) { my @merged = split(' ', $bug->{'mergedwith'}); @@ -250,52 +235,51 @@ sub scanspooldir() { for my $package (split /[,\s]+/, $bug->{'package'}) { $_= $package; y/A-Z/a-z/; $_= $` if m/[^-+._a-z0-9]/; - if (not defined $section{$_}) { - if (defined $debbugssection{$_}) { - $relinfo .= "X"; - } else { - next; # Skip unavailable packages - } - } - push @{$packagelist{$_}}, $f; } - if ($relinfo eq "") { # or $relinfo eq "U" # confuses e.g. #210306 - $relinfo = ""; - } else { - $relinfo = " [$relinfo]"; - } + my $taginfo = get_taginfo($bi); + my $relinfo = get_relinfo($bi); - $bugs{$f} = "$f $taginfo$relinfo " . $bug->{'subject'}; + $bugs{$f} = $bi; } } sub readstatus() { - my $bug; # Number of current bug - my $subject; # Subject for current bug - my $pkg; # Name of current package - my $file; # Name of statusfile - my $sect; # Section of current package - my $mnt; # Maintainer of current package + my $filename = shift; + open STATUS, "<", $filename + or die "$filename: $!"; + + while (1) { + chomp (my $type = ); + if ($type eq 'package') { + chomp (my $package = ); + chomp (my $section = ); + chomp (my $maintainer = ); + my $blank = ; + + $section{$package} = $section; + $maintainer{$package} = $maintainer; + } + if ($type eq 'bug') { + my $bug = {}; + while (1) { + my $line = ; + last if ($line !~ /^(.*?)=(.*)$/); - $file=shift; - open(P, $file) or die "open $file: $!"; - while (

) { - chomp; - if (m/^[0-9]+ \[/) { - ($bug,$subject)=split(/ /, $_, 2); - $bugs{$bug}=$subject; - push @{$packagelist{$pkg}}, $bug; - } else { - ($pkg,$sect, $mnt)=split(/ /, $_, 3); - next if (!defined($pkg)); - $section{$pkg}=$sect; - $maintainer{$pkg}=$mnt; + $bug->{$1} = $2; + } + $bugs{$bug->{'number'}} = $bug; + + for my $package (split /[,\s]+/, $bug->{'package'}) { + $_= $package; y/A-Z/a-z/; $_= $` if m/[^-+._a-z0-9]/; + push @{$packagelist{$_}}, $bug->{'number'}; + } } + last if ($type eq 'end'); } - close P; + close(STATUS); } @@ -330,14 +314,43 @@ sub wwwname() { } sub check_worry { - my ($status) = @_; + my ($bi) = @_; + + return ($bi->{'testing'} && !$bi->{'etch-ignore'}); +} + +sub check_worry_stable { + my ($bi) = @_; + + return ($bi->{'stable'} && !$bi->{'sarge-ignore'}); +} + +sub get_taginfo { + my $bi = shift; + + my $taginfo = ""; + $taginfo .= $bi->{'pending'} ? "P" : " "; + $taginfo .= $bi->{'patch'} ? "+" : " "; + $taginfo .= $bi->{'help'} ? "H" : " "; + $taginfo .= $bi->{'moreinfo'} ? "M" : " "; + $taginfo .= $bi->{'unreproducible'} ? "R" : " "; + $taginfo .= $bi->{'security'} ? "S" : " "; + $taginfo .= $bi->{'upstream'} ? "U" : " "; + $taginfo .= ($bi->{'sarge-ignore'} || $bi->{'etch-ignore'}) ? "I" : " "; + + return $taginfo; +} + +sub get_relinfo { + my $bi = shift; - if ($status =~ m/^\[[^]]*I/ or - $status =~ m/ \[[^]]*X/ or - $status !~ m/ \[[^]]*T/) { - return 0; + my $relinfo = ""; + for my $dist qw(oldstable stable testing unstable experimental) { + $relinfo .= uc(substr($dist, 0, 1)) if $bi->{$dist}; } - return 1; + + return $relinfo; } + 1;