[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 1.24.4-57-gcfdcbc8



The following commit has been merged in the master branch:
commit 58c4e9b6811a32ced220e36771b6c8e95358ee9d
Author: Jordà Polo <jorda@ettin.org>
Date:   Wed Aug 13 21:13:52 2008 +0200

    New experimental output: LetterQualifier
    
    This output is similar to the default output and includes the E|W|I code, but
    also adds a letter+qualifier code based on Severity/Certainty.

diff --git a/frontend/lintian b/frontend/lintian
index 0ff61a9..d5573c2 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1011,6 +1011,9 @@ if (defined $experimental_output_opts) {
 	    if ($opts{$_} eq 'colons') {
 		require Tags::ColonSeparated;
 		$Tags::output_formatter = \&Tags::ColonSeparated::print_tag;
+	    } elsif ($opts{$_} eq 'letterqualifier') {
+		require Tags::LetterQualifier;
+		$Tags::output_formatter = \&Tags::LetterQualifier::print_tag;
 	    }
 	}
 	no strict 'refs';
diff --git a/lib/Tags/LetterQualifier.pm b/lib/Tags/LetterQualifier.pm
new file mode 100644
index 0000000..f2cd852
--- /dev/null
+++ b/lib/Tags/LetterQualifier.pm
@@ -0,0 +1,70 @@
+# Copyright © 2008 Jordà Polo <jorda@ettin.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Tags::LetterQualifier;
+
+use strict;
+use warnings;
+
+use Term::ANSIColor;
+use Tags;
+
+my @codes = (
+    [ 'W?', 'W ', 'W!' ], # wishlist (wild-guess, possible, certain)
+    [ 'M?', 'M ', 'M!' ], # minor
+    [ 'N?', 'N ', 'N!' ], # normal
+    [ 'I?', 'I ', 'I!' ], # important
+    [ 'S?', 'S ', 'S!' ], # serious
+);
+
+my @colors = (
+    [  'green',   'green',    'cyan' ],
+    [  'green',    'cyan',  'yellow' ],
+    [   'cyan',  'yellow',  'yellow' ],
+    [ 'yellow',     'red',     'red' ],
+    [ 'yellow',     'red', 'magenta' ]
+);
+
+sub print_tag {
+    my ( $pkg_info, $tag_info, $information ) = @_;
+
+    my $code = Tags::get_tag_code($tag_info);
+    $code = 'X' if exists $tag_info->{experimental};
+    $code = 'O' if $tag_info->{overridden}{override};
+    my $lq = Tags::get_tag_value($tag_info, \@codes);
+
+    my $pkg = $pkg_info->{pkg};
+    my $type = ($pkg_info->{type} ne 'binary') ? " $pkg_info->{type}" : '';
+
+    my $tag = $tag_info->{tag};
+
+    my $extra = @$information ? " @$information" : '';
+    $extra = '' if $extra eq ' ';
+
+    if ($Tags::color eq 'always' || ($Tags::color eq 'auto' && -t STDOUT)) {
+        my $color = Tags::get_tag_value($tag_info, \@colors);
+        $lq = colored($lq, $color);
+        $tag = colored($tag, $color);
+    }
+
+    print "$code\[$lq\]: $pkg$type: $tag$extra\n";
+}
+
+1;
+
+# vim: sw=4 sts=4 ts=4 et sr

-- 
Debian package checker


Reply to: