From ab9ac6f58265a529505329cbfbab80763629913e Mon Sep 17 00:00:00 2001 From: ajt <> Date: Thu, 12 Oct 2000 03:07:48 -0800 Subject: [PATCH] [project @ 2000-10-12 04:07:48 by ajt] Make pkgreport support include=tag1,tag2 and exclude=tag3,tag4,tag5 If an include is given only bugs with at least one of the given tags will be displayed; bugs with any of the tags listed for exclude won't be displayed no matter what. --- cgi/common.pl | 30 ++++++++++++++++++++++++------ cgi/pkgreport.cgi | 6 ++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/cgi/common.pl b/cgi/common.pl index fc98cb5..43eafae 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -2,11 +2,15 @@ my $common_archive = 0; my $common_repeatmerged = 1; +my %common_include = (); +my %common_exclude = (); sub set_option { my ($opt, $val) = @_; if ($opt eq "archive") { $common_archive = $val; } if ($opt eq "repeatmerged") { $common_repeatmerged = $val; } + if ($opt eq "exclude") { %common_exclude = %{$val}; } + if ($opt eq "include") { %common_include = %{$val}; } } sub quit { @@ -174,13 +178,27 @@ sub htmlizebugs { my %status = getbugstatus($bug); next unless %status; my @merged = sort {$a<=>$b} ($bug, split(/ /, $status{mergedwith})); - if ($common_repeatmerged || $bug == $merged[0]) { - $section{$status{pending} . "_" . $status{severity}} .= - sprintf "
  • #%d: %s\n
    ", - bugurl($bug), $bug, htmlsanit($status{subject}); - $section{$status{pending} . "_" . $status{severity}} .= - htmlindexentrystatus(\%status) . "\n"; + next unless ($common_repeatmerged || $bug == $merged[0]); + if (%common_include) { + my $okay = 0; + foreach my $t (split /\s+/, $status{tags}) { + $okay = 1, last if (defined $common_include{$t}); + } + next unless ($okay); + } + if (%common_exclude) { + my $okay = 1; + foreach my $t (split /\s+/, $status{tags}) { + $okay = 0, last if (defined $comon_exclude{$t}); + } + next unless ($okay); } + + $section{$status{pending} . "_" . $status{severity}} .= + sprintf "
  • #%d: %s\n
    ", + bugurl($bug), $bug, htmlsanit($status{subject}); + $section{$status{pending} . "_" . $status{severity}} .= + htmlindexentrystatus(\%status) . "\n"; } my $result = ""; diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index b9c854b..882b252 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -51,6 +51,8 @@ if (defined ($pkg = $param{'pkg'})) { my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes"; my $archive = ($param{'archive'} || "no") eq "yes"; +my $include = $param{'include'} || ""; +my $exclude = $param{'exclude'} || ""; my $Archived = $archive ? "Archived" : ""; @@ -83,6 +85,10 @@ if (defined $pkg) { set_option("repeatmerged", $repeatmerged); set_option("archive", $archive); +set_option("include", { map {($_,1)} (split /[\s,]+/, $include) }) + if ($include); +set_option("exclude", { map {($_,1)} (split /[\s,]+/, $exclude) }) + if ($exclude); my @bugs; if (defined $pkg) { -- 2.39.2