Determine releases automatically from Debbugs::Config
authorDon Armstrong <don@donarmstrong.com>
Thu, 5 Dec 2013 23:43:44 +0000 (15:43 -0800)
committerDon Armstrong <don@donarmstrong.com>
Thu, 5 Dec 2013 23:43:44 +0000 (15:43 -0800)
Replace all hard coded release aliases everywhere except for dohtml

bugcfg.pm
bugcounts
bugreport
make-britney-counts
scanlib.pm

index 9293e0d..d23df59 100644 (file)
--- a/bugcfg.pm
+++ b/bugcfg.pm
@@ -16,10 +16,19 @@ $debian_ftproot = $config{package_source};
 $debian_sources = $config{package_source};
 $pseudolist = $config{pseudo_desc_file};
 
-$debian_sources        = "/etc/debbugs/indices/ftp.sources";
-
-$debian_ftproot = "/org/bugs.debian.org/etc/indices/ftp/testing";
-
+# this is just the default, and should always be overriden by the
+# Debbugs::Config; set values
+our $debian_releases = {testing => 'jessie',
+                        stable  => 'wheezy',
+                        unstable => 'sid',
+                        oldstable => 'squeeze',
+                       };
+# figure out debian releases from distribution aliases
+for my $alias (keys %{$config{distribution_aliases}//{}}) {
+    next if $alias eq $config{distribution_aliases}{$alias};
+    $debian_releases->{$config{distribution_aliases}{$alias}} =
+        $alias;
+}
 
 # check out:
 # http://release.debian.org/wheezy/arch_qualify.html
index 1d5fb25..15455ab 100755 (executable)
--- a/bugcounts
+++ b/bugcounts
@@ -49,7 +49,8 @@ for my $bug (values %scanlib::bugs) {
        $total++;
        $pendingcount++ if ($bug->{'pending'});
        $patchcount++ if ($bug->{'patch'});
-       $ignorecount++ if ($bug->{'wheezy-ignore'} || $bug->{'jessie-ignore'});
+       $ignorecount++ if ($bug->{$debian_releases->{stable}.'-ignore'} ||
+                       $bug->{$debian_releases->{testing}.'-ignore'});
        $worrycount++ if (scanlib::check_worry($bug));
        $stablecount++ if (scanlib::check_worry_stable($bug));
 }
index c85f0e6..ff1b0c7 100755 (executable)
--- a/bugreport
+++ b/bugreport
@@ -103,7 +103,7 @@ sub MakeBuglist() {
                                } elsif ($scanlib::bugs{$nr}->{'help'}) {
                                        print '<span style="color: #ffaa30">';
                                }
-                               print "<strike>" if ($scanlib::bugs{$nr}->{'wheezy-ignore'} || $scanlib::bugs{$nr}->{'jessie-ignore'});
+                               print "<strike>" if ($scanlib::bugs{$nr}->{$bugcfg::debian_releases->{stable}.'-ignore'} || $scanlib::bugs{$nr}->{$bugcfg::debian_releases->{testing}.'-ignore'});
                                print "<em class=\"worry\">" if $worry;
                                ($sect=$nr) =~ s/([0-9]{2}).*/$1/;
                                printf "<A NAME=\"$nr\"></A>  %s [%s] [%s] %s\n", scanlib::wwwnumber($nr),
@@ -111,7 +111,7 @@ sub MakeBuglist() {
                                        scanlib::get_relinfo($scanlib::bugs{$nr}), 
                                        scanlib::htmlsanit($scanlib::bugs{$nr}->{'subject'});
                                print "</em>" if $worry;
-                               print "</strike>" if ($scanlib::bugs{$nr}->{'wheezy-ignore'} || $scanlib::bugs{$nr}->{'jessie-ignore'});
+                               print "</strike>" if ($scanlib::bugs{$nr}->{$bugcfg::debian_releases->{stable}.'-ignore'} || $scanlib::bugs{$nr}->{$bugcfg::debian_releases->{testing}.'-ignore'});
                        } else {
                                printf("  %-6d [%s] [%s] %s\n", $nr, scanlib::get_taginfo($scanlib::bugs{$nr}),
                                        scanlib::get_relinfo($scanlib::bugs{$nr}), $scanlib::bugs{$nr}->{'subject'});
@@ -146,7 +146,7 @@ sub MakeStatistics() {
                     $seen_bugs{$nr} = 1;
                        $pendingtotal++ if ($scanlib::bugs{$nr}->{'pending'});
                        $patchtotal++ if ($scanlib::bugs{$nr}->{'patch'});
-                       $ignoretotal++ if ($scanlib::bugs{$nr}->{'wheezy-ignore'} || $scanlib::bugs{$nr}->{'jessie-ignore'});
+                       $ignoretotal++ if ($scanlib::bugs{$nr}->{$bugcfg::debian_releases->{stable}.'-ignore'} || $scanlib::bugs{$nr}->{$bugcfg::debian_releases->{testing}.'-ignore'});
                        $worrytotal++ if (scanlib::check_worry($scanlib::bugs{$nr}));
                        $stabletotal++ if (scanlib::check_worry_stable($scanlib::bugs{$nr}));
 
index 2fc7656..1c57055 100755 (executable)
@@ -48,7 +48,7 @@ while (my ($nr, $bug) = each %scanlib::bugs) {
 
                # this hack is specific to britney counts, and ignores
                # bugs tagged ignore for the next testing release
-               if (scanlib::check_worry_unstable($bug) and not $bug->{'wheezy-ignore'}) {
+               if (scanlib::check_worry_unstable($bug) and not $bug->{$bugcfg::debian_releases->{testing}.'-ignore'}) {
                        push @{$unstablebugs{$package}}, $nr;
                }
                if (scanlib::check_worry($bug)) {
index d11976a..123abb9 100644 (file)
@@ -182,11 +182,10 @@ sub scanspooldir {
                }
                next if $skip==1;
        
-               my %disttags = ();      
-               $disttags{'oldstable'}    = grep(/^squeeze$/, @tags);
-               $disttags{'stable'}       = grep(/^wheezy$/, @tags);
-               $disttags{'testing'}      = grep(/^jessie$/, @tags);
-               $disttags{'unstable'}     = grep(/^sid$/, @tags);
+               my %disttags = ();
+        for (qw(unstable stable testing unstable)) {
+            $disttags{$_}    = grep(/^$bug_cfg::debian_releases->{$_}$/, @tags);
+        }
                $disttags{'experimental'} = grep(/^experimental$/, @tags);
                        
                # default according to vorlon 2007-06-17
@@ -234,7 +233,8 @@ sub scanspooldir {
                        next if !$affects_any;
                }
 
-               for my $keyword (qw(pending patch help moreinfo unreproducible security upstream squeeze-ignore wheezy-ignore jessie-ignore)) {
+               for my $keyword (qw(pending patch help moreinfo unreproducible security upstream),
+                         map {$_.$bug_cfg::debian_releases->{testing}.'-ignore'} keys %{$bug_cfg::debian_releases}) {
                        $bi->{$keyword} = grep(/^$keyword$/, @tags);
                }
 
@@ -326,13 +326,13 @@ sub wwwname() {
 sub check_worry {
        my ($bi) = @_;
 
-       return ($bi->{'testing'} && !$bi->{'jessie-ignore'});
+       return ($bi->{'testing'} && !$bi->{$bug_cfg::debian_releases->{testing}.'-ignore'});
 }
 
 sub check_worry_stable {
        my ($bi) = @_;
 
-       return ($bi->{'stable'} && !$bi->{'wheezy-ignore'});
+       return ($bi->{'stable'} && !$bi->{$bug_cfg::debian_releases->{stable}.'-ignore'});
 }
 
 sub check_worry_unstable {
@@ -352,7 +352,7 @@ sub get_taginfo {
        $taginfo .= $bi->{'unreproducible'} ? "R" : " ";
        $taginfo .= $bi->{'security'}       ? "S" : " ";
        $taginfo .= $bi->{'upstream'}       ? "U" : " ";
-       $taginfo .= ($bi->{'wheezy-ignore'} || $bi->{'jessie-ignore'}) ? "I" : " ";
+       $taginfo .= ($bi->{$bug_cfg::debian_releases->{stable}.'-ignore'} || $bi->{$bug_cfg::debian_releases->{testing}.'-ignore'}) ? "I" : " ";
 
        return $taginfo;
 }