The following commit has been merged in the master branch:
commit 581b7b7329cababa2b544a57ea8c05e00153b705
Author: Frank Lichtenheld <[EMAIL PROTECTED]>
Date:   Wed Sep 17 00:35:52 2008 +0200

    frontend/lintian: Add support for ranges to --display-level
    
    You can use >=, >, <, <= to specify ranges of certainties/severities.

diff --git a/debian/changelog b/debian/changelog
index 7b8a81c..f5607e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ lintian (2.0.0) unstable; urgency=low
   * checks/copyright-file:
     + [FL] Also detect v1.1 of CeCILL license, not only v2.0.
       (Closes: #498994)
+  
+  * frontend/lintian:
+    + [FL] Add support for ranges to --display-level.
 
  -- Frank Lichtenheld <[EMAIL PROTECTED]>  Tue, 16 Sep 2008 19:34:29 +0200
 
diff --git a/frontend/lintian b/frontend/lintian
index 73afec2..757f7fe 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -288,10 +288,71 @@ sub reset_display_level {
     }
 }
 
+sub set_display_level_multi {
+    my ($op, $level, $val) = @_;
+
+    my @inc_severities = @severities;
+    my @inc_certainties = @certainties;
+    my $inc_border = ($op =~ /^[<>]=$/) ? 1 : 0;
+    if ($op =~ /^>/) {
+       @inc_severities = reverse @inc_severities;
+       @inc_certainties = reverse @inc_certainties;
+    }
+    my $severity = join("|", @severities);
+    my $certainty = join("|", @certainties);
+    if ($level =~ m/^($severity)$/) {
+       foreach my $s (cut_list($level, $inc_border, @inc_severities)) {
+           map { $display_level{$s}{$_} = $val } @certainties;
+       }
+    } elsif ($level =~ m/^($certainty)$/) {
+       foreach my $c (cut_list($level, $inc_border, @inc_certainties)) {
+           map { $display_level{$_}{$c} = $val } @severities;
+       }
+    } elsif ($level =~ m/^($severity)\/($certainty)$/) {
+       foreach my $s (cut_list($1, $inc_border, @inc_severities)) {
+           foreach my $c (cut_list($2, $inc_border, @inc_certainties)) {
+               $display_level{$s}{$c} = $val;
+           }
+       }
+    } else {
+       die "invalid argument to --display-level: $level\n";
+    }
+
+}
+
+sub cut_list {
+    my ($border, $inc_border, @list) = @_;
+
+    my (@newlist, $found);
+    foreach (@list) {
+       if ($_ eq $border) {
+           push @newlist, $_ if $inc_border;
+           $found = 1;
+           last;
+       } else {
+           push @newlist, $_;
+       }
+    }
+    die "internal error: cut_list did not find border $border\n"
+       unless $found;
+    if (!$inc_border and [EMAIL PROTECTED]
+       and $border eq $list[0]) {
+       warn "warning: display level $border specified with > (or <) is empty 
set, assuming >= (or <=)\n";
+       push @newlist, $list[0];
+    }
+
+    return @newlist;
+}
+
 # Parse input display level to enable (val 1) or disable (val 0) it
 # accordingly
 sub set_display_level {
     my ($level, $val) = @_;
+    if ($level =~ m/^([<>]=?)(.+)/) {
+       set_display_level_multi($1, $2, $val);
+       return;
+    }
+
     my $severity = join("|", @severities);
     my $certainty = join("|", @certainties);
     if ($level =~ m/^($severity)$/) {
diff --git a/man/lintian.1 b/man/lintian.1
index 1601242..8effead 100644
--- a/man/lintian.1
+++ b/man/lintian.1
@@ -168,7 +168,7 @@ Display informational ("I:") tags as well.  They are 
normally suppressed.
 Display experimental ("X:") tags as well.  They are normally suppressed.
 
 .TP
-.BR \-L " [+|-|=][S|C|S/C], " \-\-display\-level " [+|-|=][S|C|S/C]"
+.BR \-L " [+|-|=][>=|>|<|<=][S|C|S/C], " \-\-display\-level " 
[+|-|=][>=|>|<|<=][S|C|S/C]"
 Fine-grained selection of tags to be displayed. It is possible to add, remove
 or set the levels to display, specifying a severity (S: serious, important,
 normal, minor, wishlist), a certainty (C: certain, possible, wild-guess), or

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to