More strictifying.
authorSteinar H. Gunderson <sesse@rietz>
Wed, 7 Mar 2007 18:27:10 +0000 (18:27 +0000)
committerSteinar H. Gunderson <sesse@rietz>
Wed, 7 Mar 2007 18:27:10 +0000 (18:27 +0000)
bugreport

index 5749ac2..d05e445 100755 (executable)
--- a/bugreport
+++ b/bugreport
@@ -6,12 +6,14 @@
 use Getopt::Std;
 require scanlib;
 require bugcfg;
 use Getopt::Std;
 require scanlib;
 require bugcfg;
-
-$Version               = "BugReport 1.4\nCopyright (C) 1998-2002 Wichert Akkerman <wakkerma\@debian.org>\n";
-$html                  = 0;
-$statusfile            = "status";
-$commentsfile  = "comments";
-$NMUfile               = "/debian/home/doogie/public_html/incoming/bugs_closed";
+use strict;
+use warnings;
+
+my $Version            = "BugReport 1.4\nCopyright (C) 1998-2002 Wichert Akkerman <wakkerma\@debian.org>\n";
+my $html               = 0;
+my $statusfile         = "status";
+my $commentsfile       = "comments";
+my $NMUfile            = "/debian/home/doogie/public_html/incoming/bugs_closed";
 $NMUfile               = "/debian/home/doogie/chgscan/db/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
 $NMUfile               = "http://auric.debian.org/~doogie/incoming/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
 
 $NMUfile               = "/debian/home/doogie/chgscan/db/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
 $NMUfile               = "http://auric.debian.org/~doogie/incoming/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
 
@@ -39,29 +41,29 @@ EOF
 }
 
 sub PrintPackageHeader() {
 }
 
 sub PrintPackageHeader() {
-       local($p)       = shift;        # Package to print
-       local ($name, $email);  # Name & email of maintainer
+       my $p   = shift;        # Package to print
+       my ($name, $email);     # Name & email of maintainer
 
        if ($html) {
            print "<div class=\"package\"><pre>";
                print "<a name=\"$p\"><strong>Package:</strong></a> " . &wwwname($p);
 
        if ($html) {
            print "<div class=\"package\"><pre>";
                print "<a name=\"$p\"><strong>Package:</strong></a> " . &wwwname($p);
-               print " ($section{$p}).\n";
+               print " ($scanlib::section{$p}).\n";
                print "<strong>Maintainer:</strong> ";
                print "<strong>Maintainer:</strong> ";
-               if (defined($maintainer{$p})) {
-                       $_ = $maintainer{$p};
+               if (defined($scanlib::maintainer{$p})) {
+                       $_ = $scanlib::maintainer{$p};
                        ($name,$email) = m/(.*) <([^>]*)>/;
                        print "$name &lt;<a href=\"http://bugs.debian.org/$email\">$email</A>&gt;\n";
                } else {
                        print "unknown\n";
                }
        } else {
                        ($name,$email) = m/(.*) <([^>]*)>/;
                        print "$name &lt;<a href=\"http://bugs.debian.org/$email\">$email</A>&gt;\n";
                } else {
                        print "unknown\n";
                }
        } else {
-               print "\nPackage: $p ($section{$p})\n";
-               print "Maintainer: " . (defined($maintainer{$p}) ? $maintainer{$p} : "unknown") . "\n";
+               print "\nPackage: $p ($scanlib::section{$p})\n";
+               print "Maintainer: " . (defined($scanlib::maintainer{$p}) ? $scanlib::maintainer{$p} : "unknown") . "\n";
        }
 }
 
 sub PrintPackageFooter() {
        }
 }
 
 sub PrintPackageFooter() {
-       local($p)       = shift;        # Package to print
+       my $p   = shift;        # Package to print
 
        if ($html) {
                print "</pre></div>\n";
 
        if ($html) {
                print "</pre></div>\n";
@@ -69,65 +71,60 @@ sub PrintPackageFooter() {
 }
 
 sub MakeBuglist() {
 }
 
 sub MakeBuglist() {
-       local ($p);                             # Index variable
-       local ($nr);                    # Current bugnumber
-       local ($sect);                  # BTS-subsection for bugnumber
-       local ($header);                # Flag if packagename has already been printed
-       local ($fontset);               # Did we change the font?
-
-       for $p (sort {$a cmp $b} keys %packagelist) {
-               next if (defined $exclude{$p});
+       my $p;                          # Index variable
+       my $nr;                 # Current bugnumber
+       my $sect;                       # BTS-subsection for bugnumber
+       my $header;             # Flag if packagename has already been printed
+       my $fontset;            # Did we change the font?
+
+       for my $p (sort {$a cmp $b} keys %scanlib::packagelist) {
+               next if (defined $bugcfg::exclude{$p});
                $header = 0;
                $fontset = 0;
                $header = 0;
                $fontset = 0;
-               if (defined $comments{$p}) {
-                       if ($html && defined($comments{$p})) {
-                               if ($comments{$p} =~ m/^\[REMOVE\]/) {
+               if (defined $scanlib::comments{$p}) {
+                       if ($html && defined($scanlib::comments{$p})) {
+                               if ($scanlib::comments{$p} =~ m/^\[REMOVE\]/) {
                                        $fontset=1;
                                        print "<span style=\"color: red\">";
                                }
                        }
                        $header=1;
                        &PrintPackageHeader($p);
                                        $fontset=1;
                                        print "<span style=\"color: red\">";
                                }
                        }
                        $header=1;
                        &PrintPackageHeader($p);
-                       print $comments{$p};
+                       print $scanlib::comments{$p};
                }
                }
-               for $nr (sort split(/ /, $packagelist{$p})) {
-                       next if (defined $exclude{$nr});
+               for $nr (sort split(/ /, $scanlib::packagelist{$p})) {
+                       next if (defined $bugcfg::exclude{$nr});
                        if (! $header) {
                                $header = 1;
                                &PrintPackageHeader($p);
                        }
 
                        if ($html) {
                        if (! $header) {
                                $header = 1;
                                &PrintPackageHeader($p);
                        }
 
                        if ($html) {
-                           $worry = 1;
-                               if ($bugs{$nr} =~ m/^\[[^]]*I/ or
-                                       $bugs{$nr} =~ m/ \[[^]]*X/ or
-                                       ($bugs{$nr} =~ m/ \[[^]]*[OSUE]/ and $bugs{$nr} !~ m/ \[[^]]*T/)) {
-                                       $worry = 0;
-                               }
+                               my $worry = scanlib::check_worry($scanlib::bugs{$nr});
                        
                        
-                               if ($bugs{$nr} =~ m/ \[[^]]*X/) {
+                               if ($scanlib::bugs{$nr} =~ m/ \[[^]]*X/) {
                                        print '<span style="color: #808080">';
                                        print '<span style="color: #808080">';
-                               } elsif ($bugs{$nr} =~ m/^\[[^]]*P/) {
+                               } elsif ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/) {
                                        print '<span style="color: #f040d0">';
                                        print '<span style="color: #f040d0">';
-                               } elsif ($bugs{$nr} =~ m/^\[[^]]*\+/) {
+                               } elsif ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/) {
                                        print '<span style="color: #00aa00">';
                                        print '<span style="color: #00aa00">';
-                               } elsif ($bugs{$nr} =~ m/^\[[^]]*H/) {
+                               } elsif ($scanlib::bugs{$nr} =~ m/^\[[^]]*H/) {
                                        print '<span style="color: #ffaa30">';
                                }
                                        print '<span style="color: #ffaa30">';
                                }
-                               print "<strike>" if ($bugs{$nr} =~ m/^\[.......I\]/);
+                               print "<strike>" if ($scanlib::bugs{$nr} =~ m/^\[.......I\]/);
                                print "<em class=\"worry\">" if $worry;
                                ($sect=$nr) =~ s/([0-9]{2}).*/$1/;
                                print "<A NAME=\"$nr\"></A>  " . &wwwnumber($nr) . ' ' .
                                print "<em class=\"worry\">" if $worry;
                                ($sect=$nr) =~ s/([0-9]{2}).*/$1/;
                                print "<A NAME=\"$nr\"></A>  " . &wwwnumber($nr) . ' ' .
-                                         htmlsanit($bugs{$nr}) . "\n";
+                                         htmlsanit($scanlib::bugs{$nr}) . "\n";
                                print "</em>" if $worry;
                                print "</em>" if $worry;
-                               print "</strike>" if ($bugs{$nr} =~ m/^\[.......I\]/);
+                               print "</strike>" if ($scanlib::bugs{$nr} =~ m/^\[.......I\]/);
                        } else {
                        } else {
-                               printf("  %-6d %s\n", $nr, $bugs{$nr});
+                               printf("  %-6d %s\n", $nr, $scanlib::bugs{$nr});
                        }
                        }
-                       print $comments{$nr} if (defined($comments{$nr}));
-                       print "[FIX] Fixed by package " . $NMU{$nr, "source"} . ", version " . $NMU{$nr, "version"} . " in Incoming\n" if (defined $NMU{$nr});
-                       print "</span>" if ($html && ($bugs{$nr} =~ m/^\[[^]]*[H+P]/ ||
-                                                     $bugs{$nr} =~ m/ \[[^]]*X/));
+                       print $scanlib::comments{$nr} if (defined($scanlib::comments{$nr}));
+                       print "[FIX] Fixed by package " . $scanlib::NMU{$nr, "source"} . ", version " . $scanlib::NMU{$nr, "version"} . " in Incoming\n" if (defined $scanlib::NMU{$nr});
+                       print "</span>" if ($html && ($scanlib::bugs{$nr} =~ m/^\[[^]]*[H+P]/ ||
+                                                     $scanlib::bugs{$nr} =~ m/ \[[^]]*X/));
                }
                print "</span>" if ($fontset);
                if ($header) {
                }
                print "</span>" if ($fontset);
                if ($header) {
@@ -138,37 +135,37 @@ sub MakeBuglist() {
 
 
 sub MakeStatistics() {
 
 
 sub MakeStatistics() {
-       local($bugcount);               # Total number of bugs so far
-       local($count);                  # Number of bugs for this package
-       local($remtotal);               # Total number of bugs for packages marked REMOVE
-       local($patchtotal);             # Total number of bugs marked patch
-       local($pendingtotal);           # Total number of bugs marked pending
-       local($ignoretotal);            # Total number of bugs marked ignore
-       local($nottestingtotal);        # Total number of bugs on packages not in testing
-       local($worrytotal);             # Total number of bugs we're actually worried about
-       local($p);                              # Index variable
-       local(%list);                   # List of bugnumber associated with package
+       my $bugcount;           # Total number of bugs so far
+       my $count;              # Number of bugs for this package
+       my $remtotal;           # Total number of bugs for packages marked REMOVE
+       my $patchtotal;         # Total number of bugs marked patch
+       my $pendingtotal;       # Total number of bugs marked pending
+       my $ignoretotal;        # Total number of bugs marked ignore
+       my $nottestingtotal;    # Total number of bugs on packages not in testing
+       my $worrytotal;         # Total number of bugs we're actually worried about
+       my $p;                  # Index variable
+       my %list;               # List of bugnumber associated with package
 
        $bugcount=0;
 
        $bugcount=0;
-       for $p (sort keys %packagelist) {
-               next if (defined $exclude{$p});
+       for my $p (sort keys %scanlib::packagelist) {
+               next if (defined $scanlib::exclude{$p});
                $count=0;
                $count=0;
-               for $nr (split(/ /, $packagelist{$p})) {
-                       $pendingtotal++ if ($bugs{$nr} =~ m/^\[[^]]*P/);
-                       $patchtotal++ if ($bugs{$nr} =~ m/^\[[^]]*\+/);
-                       $ignoretotal++ if ($bugs{$nr} =~ m/^\[[^]]*I/);
-                       $nottestingtotal++ if ($bugs{$nr} =~ m/ \[[^]]*X/);
+               for my $nr (split(/ /, $scanlib::packagelist{$p})) {
+                       $pendingtotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/);
+                       $patchtotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/);
+                       $ignoretotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*I/);
+                       $nottestingtotal++ if ($scanlib::bugs{$nr} =~ m/ \[[^]]*X/);
                        $worrytotal++ unless (
                        $worrytotal++ unless (
-                               $bugs{$nr} =~ m/^\[[^]]*I/ or
-                               $bugs{$nr} =~ m/ \[[^]]*X/ or
-                               ($bugs{$nr} =~ m/ \[[^]]*[OSUE]/ and $bugs{$nr} !~ m/ \[[^]]*T/));
+                               $scanlib::bugs{$nr} =~ m/^\[[^]]*I/ or
+                               $scanlib::bugs{$nr} =~ m/ \[[^]]*X/ or
+                               ($scanlib::bugs{$nr} =~ m/ \[[^]]*[OSUE]/ and $scanlib::bugs{$nr} !~ m/ \[[^]]*T/));
 
 
-                       if (not defined($exclude{$nr})) {
+                       if (not defined($scanlib::exclude{$nr})) {
                                $bugcount++;
                                $count++;
                        } 
                }
                                $bugcount++;
                                $count++;
                        } 
                }
-               $remtotal+=$count if (defined($comments{$p}) && $comments{$p} =~ m/^\[REMOVE\]/);
+               $remtotal+=$count if (defined($scanlib::comments{$p}) && $scanlib::comments{$p} =~ m/^\[REMOVE\]/);
        }
 
        if ($html) {
        }
 
        if ($html) {
@@ -192,20 +189,22 @@ sub MakeStatistics() {
 
 
 sub FilterPackages() {
 
 
 sub FilterPackages() {
-       local($filter) = shift;         # Distribution we want to keep
+       my $filter = shift;             # Distribution we want to keep
 
 
-       for $p (sort keys %packagelist) {
-               delete $packagelist{$p} unless ($section{$p} =~ m/^$filter/);
+       for my $p (sort keys %scanlib::packagelist) {
+               delete $scanlib::packagelist{$p} unless ($scanlib::section{$p} =~ m/^$filter/);
        }
 }
 
 sub FilterBugs() {
        }
 }
 
 sub FilterBugs() {
-       for $p (sort keys %packagelist) {
-               $packagelist{$p} = join(' ', grep { check_worry($bugs{$_}) } split / /, $packagelist{$p});
-               delete $packagelist{$p} if ($packagelist{$p} eq '');
+       for my $p (sort keys %scanlib::packagelist) {
+               $scanlib::packagelist{$p} = join(' ', grep { check_worry($scanlib::bugs{$_}) } split / /, $scanlib::packagelist{$p});
+               delete $scanlib::packagelist{$p} if ($scanlib::packagelist{$p} eq '');
        }
 }
 
        }
 }
 
+my ($opt_h,$opt_V,$opt_S,$opt_C,$opt_H,$opt_d,$opt_t,$opt_s,$opt_l);
+
 getopts('VhHlstd:S:C:');
 ShowUsage if ($opt_h);
 ShowVersion if ($opt_V);
 getopts('VhHlstd:S:C:');
 ShowUsage if ($opt_h);
 ShowVersion if ($opt_V);
@@ -213,9 +212,9 @@ $statusfile=$opt_S if ($opt_S);
 $commentsfile=$opt_C if ($opt_C);
 $html=1 if ($opt_H);
 
 $commentsfile=$opt_C if ($opt_C);
 $html=1 if ($opt_H);
 
-&readstatus($statusfile);
-&readcomments($commentsfile);
-&readNMUstatus($NMUfile);
+scanlib::readstatus($statusfile);
+scanlib::readcomments($commentsfile);
+scanlib::readNMUstatus($NMUfile);
 
 &FilterPackages($opt_d) if ($opt_d);
 &FilterBugs() if ($opt_t);
 
 &FilterPackages($opt_d) if ($opt_d);
 &FilterBugs() if ($opt_t);