Change the format of the status file to be something much closer to the
authorSteinar H. Gunderson <sesse@rietz>
Thu, 22 Mar 2007 17:55:16 +0000 (17:55 +0000)
committerSteinar H. Gunderson <sesse@rietz>
Thu, 22 Mar 2007 17:55:16 +0000 (17:55 +0000)
new internal structures than something looking like the final report.

bugcounts
bugreport
bugscan
scanlib.pm

index de473a1..038769b 100755 (executable)
--- a/bugcounts
+++ b/bugcounts
@@ -50,9 +50,9 @@ for my $p (keys %scanlib::packagelist) {
        for my $nr (sort @{$scanlib::packagelist{$p}}) {
                next if (defined $bugcfg::exclude{$nr});
                $total++;
-               $pendingcount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/);
-               $patchcount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/);
-               $ignorecount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*I/);
+               $pendingcount++ if ($scanlib::bugs{$nr}->{'pending'});
+               $patchcount++ if ($scanlib::bugs{$nr}->{'patch'});
+               $ignorecount++ if ($scanlib::bugs{$nr}->{'etch-ignore'});
                $worrycount++ if (scanlib::check_worry($scanlib::bugs{$nr}));
                $stablecount++ if (scanlib::check_worry_stable($scanlib::bugs{$nr}));
        }
index 001ce2f..eee96b3 100755 (executable)
--- a/bugreport
+++ b/bugreport
@@ -140,9 +140,9 @@ sub MakeStatistics() {
 
                next if (defined $scanlib::exclude{$p});
                for my $nr (@{$scanlib::packagelist{$p}}) {
-                       $pendingtotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/);
-                       $patchtotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/);
-                       $ignoretotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*I/);
+                       $pendingtotal++ if ($scanlib::bugs{$nr}->{'pending'});
+                       $patchtotal++ if ($scanlib::bugs{$nr}->{'patch'});
+                       $ignoretotal++ if ($scanlib::bugs{$nr}->{'etch-ignore'});
                        $worrytotal++ if (scanlib::check_worry($scanlib::bugs{$nr}));
                        $stabletotal++ if (scanlib::check_worry_stable($scanlib::bugs{$nr}));
 
diff --git a/bugscan b/bugscan
index 2bc7b4d..69b42e3 100755 (executable)
--- a/bugscan
+++ b/bugscan
@@ -24,12 +24,22 @@ for my $p (keys %scanlib::packagelist) {
        } else {
            $section = $scanlib::debbugssection{$p};
        }
-       print "$p $section $scanlib::maintainer{$p}\n";
-       for my $b (@{$scanlib::packagelist{$p}}) {
-               print "$scanlib::bugs{$b}\n";
+       print "package\n";
+       print $p, "\n";
+       print $section, "\n";
+       print $scanlib::maintainer{$p}, "\n";
+       print "\n";
+}
+
+for my $b (keys %scanlib::bugs) {
+       print "bug\n";
+       for my $key (keys %{$scanlib::bugs{$b}}) {
+               print $key, "=", $scanlib::bugs{$b}->{$key}, "\n";
        }
        print "\n";
 }
 
+print "end\n";
+
 exit 0;
 
index a9c5196..a2c378b 100644 (file)
@@ -154,6 +154,12 @@ sub scanspooldir() {
                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'};
@@ -181,7 +187,6 @@ sub scanspooldir() {
                        $disttags{'experimental'} = 1;
                }
                
-               my $bi = {};
                if (defined($section{$bug->{'package'}}) && $section{$bug->{'package'}} eq 'pseudo') {
                        # versioning information makes no sense for pseudo packages,
                        # just use the tags
@@ -236,35 +241,45 @@ sub scanspooldir() {
                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 = <STATUS>);
+               if ($type eq 'package') {
+                       chomp (my $package = <STATUS>);
+                       chomp (my $section = <STATUS>);
+                       chomp (my $maintainer = <STATUS>);
+                       my $blank = <STATUS>;
+
+                       $section{$package} = $section;
+                       $maintainer{$package} = $maintainer;
+               }
+               if ($type eq 'bug') {
+                       my $bug = {};
+                       while (1) {
+                               my $line = <STATUS>;
+                               last if ($line !~ /^(.*?)=(.*)$/);
 
-       $file=shift;
-       open(P, $file) or die "open $file: $!";
-       while (<P>) {
-               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);
 }
 
 
@@ -299,22 +314,15 @@ sub wwwname() {
 }
 
 sub check_worry {
-       my ($status) = @_;
+       my ($bi) = @_;
 
-       if ($status =~ m/^\[[^]]*I/ or
-            $status !~ m/ \[[^]]*T/) {
-               return 0;
-       }
-       return 1;
+       return ($bi->{'testing'} && !$bi->{'etch-ignore'});
 }
 
 sub check_worry_stable {
-       my ($status) = @_;
+       my ($bi) = @_;
 
-       if ($status !~ m/ \[[^]]*S/) {
-               return 0;
-       }
-       return 1;
+       return ($bi->{'stable'});
 }
 
 sub get_taginfo {