# %section - map from packagename to section in the FTP-site
# %packagelist - map from packagename to bugreports
+use warnings;
+use strict;
+
use lib qw(/org/bugs.debian.org/perl);
use LWP::UserAgent;
use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
use Debbugs::Versions;
use Debbugs::Status;
use Fcntl qw(O_RDONLY);
-use strict;
-use warnings;
-require bugcfg;
+use IO::File;
+use IO::Dir;
+
+use File::Basename;
+use lib dirname(__FILE__);
+use bugcfg;
+
package scanlib;
our (%maintainer,%section,%packagelist,%debbugssection,%bugs);
}
-sub readsources() {
- my $root; # Root of archive we are scanning
- my $archive; # Name of archive we are scanning
- my $sect; # Name of current section
+sub readsources {
+ my ($root,$archive) = @_;
- $root=shift;
- $archive=shift;
- for $sect (@bugcfg::sections) {
+ for my $sect (@bugcfg::sections) {
open(P, "zcat $root/$sect/source/Sources.gz|")
or die open "open: $sect sourcelist: $!\n";
while (<P>) {
}
}
-sub readdebbugssources() {
- my $file;
- my $archive;
+sub readdebbugssources {
+ my ($file,$archive) = @_;
- $file=shift;
- $archive=shift;
open(P, $file)
or die "open: $file: $!\n";
while (<P>) {
}
sub scanspooldir {
- my ($dir) = @_;
- my $f; # While we're currently processing
- my @list; # List of files to process
+ my ($dir,$bugs) = @_;
my $skip; # Flow control
my $walk; # index variable
my $taginfo; # Tag info
my @archs_with_source = ( @bugcfg::architectures, 'source' );
- chdir($dir) or die "chdir $dir: $!\n";
+# chdir($dir) or die "chdir $dir: $!\n";
- opendir(DIR, $dir) or die "opendir $dir: $!\n";
- @list = grep { s/\.summary$// }
- grep { m/^\d+\.summary$/ }
- readdir(DIR);
- closedir(DIR);
+ my $d = IO::Dir->new($dir) or die "Unable to opendir: $dir $!\n";
+ my @list = grep { s/\.summary$// }
+ grep { m/^\d+\.summary$/ }
+ $d->read;
+ $d->close;
- for $f (@list) {
+ for my $f (@list) {
my $bug = Debbugs::Status::read_bug(summary => "$f.summary");
next if (!defined($bug));
next if $skip==1;
my %disttags = ();
- for (qw(unstable stable testing unstable)) {
- $disttags{$_} = grep(/^$bug_cfg::debian_releases->{$_}$/, @tags);
+ for my $release (qw(oldstable stable testing unstable)) {
+ $disttags{$release} = grep(/^$bugcfg::debian_releases->{$release}$/, @tags);
}
$disttags{'experimental'} = grep(/^experimental$/, @tags);
}
for my $keyword (qw(pending patch help moreinfo unreproducible security upstream),
- map {$_.$bug_cfg::debian_releases->{testing}.'-ignore'} keys %{$bug_cfg::debian_releases}) {
+ map {$bugcfg::debian_releases->{$_}.'-ignore'} keys %{$bugcfg::debian_releases}) {
$bi->{$keyword} = grep(/^$keyword$/, @tags);
}
my $taginfo = get_taginfo($bi);
my $relinfo = get_relinfo($bi);
- $bugs{$f} = $bi;
+ $bugs->{$f} = $bi;
}
+ return $bugs;
}
or die "$filename: $!";
while (1) {
- chomp (my $type = <STATUS>);
+ my $type = <STATUS>;
+ last if not defined $type;
+ chomp $type;
if ($type eq 'package') {
chomp (my $package = <STATUS>);
chomp (my $section = <STATUS>);
sub check_worry {
my ($bi) = @_;
- return ($bi->{'testing'} && !$bi->{$bug_cfg::debian_releases->{testing}.'-ignore'});
+ return ($bi->{'testing'} && !$bi->{$bugcfg::debian_releases->{testing}.'-ignore'});
}
sub check_worry_stable {
my ($bi) = @_;
- return ($bi->{'stable'} && !$bi->{$bug_cfg::debian_releases->{stable}.'-ignore'});
+ return ($bi->{'stable'} && !$bi->{$bugcfg::debian_releases->{stable}.'-ignore'});
}
sub check_worry_unstable {
$taginfo .= $bi->{'unreproducible'} ? "R" : " ";
$taginfo .= $bi->{'security'} ? "S" : " ";
$taginfo .= $bi->{'upstream'} ? "U" : " ";
- $taginfo .= ($bi->{$bug_cfg::debian_releases->{stable}.'-ignore'} || $bi->{$bug_cfg::debian_releases->{testing}.'-ignore'}) ? "I" : " ";
+ $taginfo .= ($bi->{$bugcfg::debian_releases->{stable}.'-ignore'} || $bi->{$bugcfg::debian_releases->{testing}.'-ignore'}) ? "I" : " ";
return $taginfo;
}