[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 41457c0703a2ea1f9318004706009ab1daf58de5
Author: Jordà Polo <jorda@ettin.org>
Date:   Thu Jul 3 00:31:25 2008 +0200

    Remove unfinished transition to new tag handling system
    
    In order to avoid confusion between the various tag classification mechanisms,
    the previous unfinished transition (to severity/significance) and its
    compatibility code have been removed.

diff --git a/checks/menus.desc b/checks/menus.desc
index d721748..d337586 100644
--- a/checks/menus.desc
+++ b/checks/menus.desc
@@ -150,8 +150,7 @@ Info: The <tt>prerm</tt> script calls the <tt>install-docs</tt> program
  though no file is installed in <tt>/usr/share/doc-base</tt>.
 
 Tag: bad-menu-file-name
-Severity: 4
-Significance: 3
+Type: error
 Info: The package installs a file <tt>/usr/lib/menu/menu</tt>, which is
  already in use by the <tt>menu</tt> package itself.  The menu file should
  be named after the package that installs it.
diff --git a/frontend/lintian b/frontend/lintian
index 16e2979..0ff61a9 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -813,9 +813,9 @@ while (my $arg = shift) {
 
 	    unless ($exit_code) {
 		my $stats = Tags::get_stats( $arg );
-		if ($stats->{severity}{4}) {
+		if ($stats->{types}{error}) {
 		    $exit_code = 1;
-		} elsif ($fail_on_warnings && $stats->{severity}{2}) {
+		} elsif ($fail_on_warnings && $stats->{types}{warning}) {
 		    $exit_code = 1;
 		}
 	    }
@@ -1005,7 +1005,6 @@ closedir(COLLDIR);
 
 no warnings 'once';
 if (defined $experimental_output_opts) {
-    $Tags::output_formatter = \&Tags::print_tag_new;
     my %opts = map { split(/=/) } split( /,/, $experimental_output_opts );
     foreach (keys %opts) {
 	if ($_ eq 'format') {
@@ -1453,9 +1452,9 @@ for (reverse sort @packages) {
 	}
 	unless ($exit_code) {
 	    my $stats = Tags::get_stats( $file );
-	    if ($stats->{severity}{4}) {
+	    if ($stats->{types}{error}) {
 		$exit_code = 1;
-	    } elsif ($fail_on_warnings && $stats->{severity}{2}) {
+	    } elsif ($fail_on_warnings && $stats->{types}{warning}) {
 		$exit_code = 1;
 	    }
 	}
@@ -1476,9 +1475,9 @@ for (reverse sort @packages) {
 	    my $stats = Tags::get_stats($file);
 	    my $short = $file;
 	    $short =~ s%.*/%%;
-	    my $errors = $stats->{overrides}{by_severity}{4} || 0;
-	    my $warnings = $stats->{overrides}{by_severity}{2} || 0;
-	    my $info = $stats->{overrides}{by_severity}{0} || 0;
+	    my $errors = $stats->{overrides}{types}{error} || 0;
+	    my $warnings = $stats->{overrides}{types}{warning} || 0;
+	    my $info = $stats->{overrides}{types}{info} || 0;
 	    $overrides{errors} += $errors;
 	    $overrides{warnings} += $warnings;
 	    $overrides{info} += $info;
diff --git a/lib/Tags.pm b/lib/Tags.pm
index 1ae2149..c3bdb9e 100644
--- a/lib/Tags.pm
+++ b/lib/Tags.pm
@@ -42,10 +42,6 @@ our $show_info = 0;
 our $show_experimental = 0;
 our $show_overrides = 0;
 our $output_formatter = \&print_tag;
-our $min_severity = 1;
-our $max_severity = 99;
-our $min_significance = 1;
-our $max_significance = 99;
 our $color = 'never';
 our %only_issue_tags;
 
@@ -62,8 +58,7 @@ my %tags;
 # following keys:
 # - overrides
 # - tags
-# - severity
-# - significance
+# - types
 my %stats;
 
 # Info about a specific file. Key is the the filename, value another hash
@@ -78,14 +73,8 @@ my %info;
 # Currently selected file (not package!)
 my $current;
 
-# Compatibility stuff
 my %codes = ( 'error' => 'E' , 'warning' => 'W' , 'info' => 'I' );
-our %type_to_sev = ( error => 4, warning => 2, info => 0 );
-our @sev_to_type = qw( info warning warning error error );
-
-my @sig_to_qualifier = ( '??', '?', '', '!' );
-my @sev_to_code = qw( I W W E E );
-my @sev_to_color = ( 'cyan', 'yellow', 'yellow', 'red', 'red' );
+my %colors = ( 'error' => 'red' , 'warning' => 'yellow' , 'info' => 'cyan' );
 
 # Add a new tag, supplied as a hash reference
 sub add_tag {
@@ -95,12 +84,6 @@ sub add_tag {
 	    return 0;
 	}
 
-	# smooth transition
-	$newtag->{type} = $sev_to_type[$newtag->{severity}]
-	    unless $newtag->{type};
-	$newtag->{significance} = 2 unless exists $newtag->{significance};
-	$newtag->{severity} = $type_to_sev{$newtag->{type}}
-	    unless exists $newtag->{severity};
 	$tags{$newtag->{'tag'}} = $newtag;
 	return 1;
 }
@@ -124,8 +107,7 @@ sub set_pkg {
 	overrides => {},
     };
     $stats{$file} = {
-	severity => {},
-	significance => {},
+	types => {},
 	tags => {},
 	overrides => {},
     };
@@ -232,31 +214,18 @@ sub check_need_to_show {
     my ( $tag_info, $information ) = @_;
     $tag_info->{overridden}{override} = check_overrides( $tag_info,
 							 $information );
-    my $min_sev = $show_info ? 0 : $min_severity; # compat hack
-    $tag_info->{overridden}{severity} = check_range( $tag_info->{severity},
-						     $min_sev,
-						     $max_severity );
-    $tag_info->{overridden}{significance} = check_range( $tag_info->{significance},
-							 $min_significance,
-							 $max_significance );
 }
 
 # records the stats for a given tag_info hash
 sub record_stats {
     my ( $tag_info ) = @_;
 
-    for my $k (qw( severity significance tag )) {
-	$stats{$current}{$k}{$tag_info->{$k}}++
-	    unless $tag_info->{overridden}{override}
-		|| $tag_info->{overridden}{severity}
-		|| $tag_info->{overridden}{significance};
-    }
-    for my $k (qw( severity significance override )) {
-	$stats{$current}{overrides}{$k}{$tag_info->{overridden}{$k}}++
-	    if $tag_info->{overridden}{$k};
-    }
     if ($tag_info->{overridden}{override}) {
-        $stats{$current}{overrides}{by_severity}{$tag_info->{severity}}++;
+        $stats{$current}{overrides}{tags}{$tag_info->{overridden}{override}}++;
+        $stats{$current}{overrides}{types}{$tag_info->{type}}++;
+    } else {
+        $stats{$current}{tags}{$tag_info->{tag}}++;
+        $stats{$current}{types}{$tag_info->{type}}++;
     }
 }
 
@@ -281,7 +250,6 @@ sub print_tag {
     $extra = " @$information" if @$information;
     $extra = '' if $extra eq ' ';
     my $code = $codes{$tag_info->{type}};
-    my $severity = $type_to_sev{$tag_info->{type}};
     $code = 'X' if exists $tag_info->{experimental};
     $code = 'O' if $tag_info->{overridden}{override};
     my $type = '';
@@ -289,41 +257,15 @@ sub print_tag {
 
     my $output = "$code: $pkg_info->{pkg}$type: ";
     if ($color eq 'always' || ($color eq 'auto' && -t STDOUT)) {
-        $output .= colored($tag_info->{tag}, $sev_to_color[$severity]);
+        $output .= colored($tag_info->{tag}, $colors{$tag_info->{type}});
     } elsif ($color eq 'html') {
-        $output .= colored_html($tag_info->{tag}, $sev_to_color[$severity]);
-    } else {
-        $output .= $tag_info->{tag};
-    }
-    $output .= "$extra\n";
-
-    print $output;
-}
-
-sub print_tag_new {
-    my ( $pkg_info, $tag_info, $information ) = @_;
-
-    my $extra = '';
-    $extra = " @$information" if @$information;
-    $extra = '' if $extra eq ' ';
-    my $code = $sev_to_code[$tag_info->{severity}];
-    $code = 'X' if exists $tag_info->{experimental};
-    $code = 'O' if $tag_info->{overridden}{override};
-    my $qualifier = $sig_to_qualifier[$tag_info->{significance}];
-    $qualifier = '' if $code eq 'O';
-    my $type = '';
-    $type = " $pkg_info->{type}" if $pkg_info->{type} ne 'binary';
-
-    my $output = "$code$qualifier: $pkg_info->{pkg}$type: ";
-    if ($color eq 'always' || ($color eq 'auto' && -t STDOUT)) {
-        $output .= colored($tag_info->{tag}, $sev_to_color[$tag_info->{severity}]);
+        $output .= colored_html($tag_info->{tag}, $colors{$tag_info->{type}});
     } else {
         $output .= $tag_info->{tag};
     }
     $output .= "$extra\n";
 
     print $output;
-
 }
 
 sub tag {
@@ -351,11 +293,7 @@ sub tag {
     return 0 if
 	exists $tag_info->{experimental} and !$show_experimental;
 
-    return 1 if
-	$tag_info->{overridden}{severity} != 0
-	|| $tag_info->{overridden}{significance} != 0
-	|| ( $tag_info->{overridden}{override} &&
-	     !$show_overrides);
+    return 1 if $tag_info->{overridden}{override} && !$show_overrides;
 
     &$output_formatter( $info{$current}, $tag_info, \@information );
     return 1;
diff --git a/lib/Tags/ColonSeparated.pm b/lib/Tags/ColonSeparated.pm
index b9088dc..bb1039a 100644
--- a/lib/Tags/ColonSeparated.pm
+++ b/lib/Tags/ColonSeparated.pm
@@ -40,11 +40,8 @@ sub print_tag {
     my $extra = "@$information";
 
     print join(':', quote_char( ':',
-				$tag_info->{severity},
-				$tag_info->{significance},
-				@{$tag_info->{overridden}}{'override',
-							   'severity',
-							   'significance'},
+				$tag_info->{type},
+				$tag_info->{overridden}{override},
 				@{$pkg_info}{'pkg','version','arch','type'},
 				$tag_info->{tag},
 				$extra,
diff --git a/testset/runtests b/testset/runtests
index 0cd13de..9a5bd16 100755
--- a/testset/runtests
+++ b/testset/runtests
@@ -183,8 +183,7 @@ for my $desc_file (<$LINTIAN_ROOT/checks/*.desc>) {
 	    if (exists $i->{'experimental'}) {
 		$tags{$i->{'tag'}}{'desc_type'} = "experimental";
 	    } else {
-		$tags{$i->{'tag'}}{'desc_type'} = $i->{'type'} ||
-		    $Tags::sev_to_type[$i->{'severity'}];
+		$tags{$i->{'tag'}}{'desc_type'} = $i->{'type'};
 	    }
 	}
     }

-- 
Debian package checker


Reply to: