From 2ee73259657d024a84208bc1f056606b668d2f74 Mon Sep 17 00:00:00 2001 From: cjwatson <> Date: Sat, 23 Aug 2003 12:17:32 -0800 Subject: [PATCH] [project @ 2003-08-23 13:17:32 by cjwatson] Create common function to test whether a severity is "strong" (i.e. release-critical, in the case of Debian). --- cgi/bugreport.cgi | 2 +- cgi/common.pl | 2 +- scripts/db2html.in | 4 ++-- scripts/errorlib.in | 9 +++++++-- scripts/process.in | 8 +++----- scripts/service.in | 7 +++---- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index dad91a0c..5fe8db54 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -165,7 +165,7 @@ my @tpacks = splitpackages($tpack); if ($status{severity} eq 'normal') { $showseverity = ''; -#} elsif (grep($status{severity} eq $_, @strongseverities)) { +#} elsif (isstrongseverity($status{severity})) { # $showseverity = "Severity: $status{severity};\n"; } else { $showseverity = "Severity: $status{severity};\n"; diff --git a/cgi/common.pl b/cgi/common.pl index 92738603..7064600c 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -210,7 +210,7 @@ sub htmlindexentrystatus { if ($status{severity} eq 'normal') { $showseverity = ''; - } elsif (grep($status{severity} eq $_, @debbugs::gStrongSeverities)) { + } elsif (isstrongseverity($status{severity})) { $showseverity = "Severity: $status{severity};\n"; } else { $showseverity = "Severity: $status{severity};\n"; diff --git a/scripts/db2html.in b/scripts/db2html.in index df45f848..dab1399c 100755 --- a/scripts/db2html.in +++ b/scripts/db2html.in @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: db2html.in,v 1.19 2003/08/06 10:57:23 cjwatson Exp $ +# $Id: db2html.in,v 1.20 2003/08/23 13:17:32 cjwatson Exp $ # usage: db2html [-diff] [-stampfile=] [-lastrun=] #load the necessary libraries/configuration @@ -142,7 +142,7 @@ for $f (@files) if ($data->{severity} eq '' || $data->{severity} eq 'normal') { $showseverity= ''; $addseverity= $gDefaultSeverity; - } elsif (grep($data->{severity} eq $_, @strongseverities)) + } elsif (isstrongseverity($data->{severity})) { $showseverity= "Severity: $data->{severity};\n"; $addseverity= $data->{severity}; } else diff --git a/scripts/errorlib.in b/scripts/errorlib.in index 1ca19961..cdddadaa 100755 --- a/scripts/errorlib.in +++ b/scripts/errorlib.in @@ -1,5 +1,5 @@ # -*- perl -*- -# $Id: errorlib.in,v 1.35 2003/08/22 01:41:54 cjwatson Exp $ +# $Id: errorlib.in,v 1.36 2003/08/23 13:17:32 cjwatson Exp $ use Mail::Address; @@ -379,11 +379,16 @@ sub escapelog { return \@log; } +sub isstrongseverity { + my $severity = shift; + $severity = $gDefaultSeverity if $severity eq ''; + return grep { $_ eq $severity } @gStrongSeverities; +} + @severities= grep { not exists $gObsoleteSeverities{$_} } @gSeverityList; @showseverities= @severities; grep ($_= $_ eq '' ? $gDefaultSeverity : $_, @showseverities); -@strongseverities= @gStrongSeverities; %displayshowseverities= %gSeverityDisplay; 1; diff --git a/scripts/process.in b/scripts/process.in index d5b2cf57..c340880d 100755 --- a/scripts/process.in +++ b/scripts/process.in @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: process.in,v 1.79 2003/08/20 23:33:54 cjwatson Exp $ +# $Id: process.in,v 1.80 2003/08/23 13:17:32 cjwatson Exp $ # # Usage: process nn # Temps: incoming/Pnn @@ -266,8 +266,7 @@ if ($codeletter eq 'D' || $codeletter eq 'F') $generalcc=''; } } - if (grep { $_ eq $data->{severity} } @strongseverities and - defined $gStrongList) { + if (defined $gStrongList and isstrongseverity($data->{severity})) { $generalcc = join ', ', $generalcc, "$gStrongList\@$gListDomain"; } if ($ref<0) { @@ -622,8 +621,7 @@ END } @bccs = @addsrcaddrs; -if (grep { $_ eq $data->{severity} } @gStrongSeverities and - defined $gStrongList) { +if (defined $gStrongList and isstrongseverity($data->{severity})) { push @bccs, "$gStrongList\@$gListDomain"; } diff --git a/scripts/service.in b/scripts/service.in index 8473e37a..b2b063b8 100755 --- a/scripts/service.in +++ b/scripts/service.in @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: service.in,v 1.86 2003/08/22 01:41:54 cjwatson Exp $ +# $Id: service.in,v 1.87 2003/08/23 13:17:32 cjwatson Exp $ # # Usage: service .nn # Temps: incoming/P.nn @@ -425,8 +425,7 @@ END $action= "Severity set to \`$newseverity'."; do { &addmaintainers($data->{package}, $data->{severity}); - if (defined $gStrongList and - grep { $_ eq $newseverity } @strongseverities) { + if (defined $gStrongList and isstrongseverity($newseverity)) { my $addbcc = "$gStrongList\@$gListDomain"; push @bcc, $addbcc unless grep { $_ eq $addbcc } @bccs; } @@ -1029,7 +1028,7 @@ sub addmaintainers { } } if (defined $_[1] and defined $gStrongList and - grep { $_ eq $_[1] } @strongseverities) { + isstrongseverity($_[1])) { push @bcc, "$gStrongList\@$gListDomain"; } if (defined($maintainerof{$p})) { -- 2.39.5