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

lintian: r1096 - in trunk: debian frontend lib man



Author: rra
Date: 2008-01-03 07:02:44 +0100 (Thu, 03 Jan 2008)
New Revision: 1096

Modified:
   trunk/debian/changelog
   trunk/frontend/lintian
   trunk/frontend/lintian-info
   trunk/lib/Tags.pm
   trunk/man/lintian.1
Log:
  + [RA] Check that the argument to --color is valid.
  + [RA] Warn about no package arguments unless --setup-lab or
    --remove-lab are given.  Thanks, Damyan Ivanov.  (Closes: #455732)
  + [RA] Add support for HTML coloring.  (Closes: #458376)
* frontend/lintian-info:
  + [RA] Allow for HTML color tags.
* lib/Tags.pm:
  + [RA] Add support for HTML coloring.
* man/lintian.1:
  + [RA] Document the --color=html option.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-01-03 04:50:40 UTC (rev 1095)
+++ trunk/debian/changelog	2008-01-03 06:02:44 UTC (rev 1096)
@@ -46,7 +46,13 @@
   * frontend/lintian:
     + [RA] Allow + and . in tag names in overrides.  Thanks, Stefan
       Fritsch.  (Closes: #454790)
-  
+    + [RA] Check that the argument to --color is valid.
+    + [RA] Warn about no package arguments unless --setup-lab or
+      --remove-lab are given.  Thanks, Damyan Ivanov.  (Closes: #455732)
+    + [RA] Add support for HTML coloring.  (Closes: #458376)
+  * frontend/lintian-info:
+    + [RA] Allow for HTML color tags.
+
   * lib/Dep.pm:
     + [RA] Allow substvars instead of package names so that dependency
       checks against the source debian/control file don't treat all
@@ -58,7 +64,12 @@
       where we're more sure of the contents.
     + [RA] Expand the picky capitalization checks to catch Debian, GNOME,
       KDE, and Linux.  (Closes: #456582)
+  * lib/Tags.pm:
+    + [RA] Add support for HTML coloring.
 
+  * man/lintian.1:
+    + [RA] Document the --color=html option.
+
   * reporting/html_reports:
     + [RA] Rewritten.
       - Include info, experimental, and overridden tags in the tag pages.

Modified: trunk/frontend/lintian
===================================================================
--- trunk/frontend/lintian	2008-01-03 04:50:40 UTC (rev 1095)
+++ trunk/frontend/lintian	2008-01-03 06:02:44 UTC (rev 1096)
@@ -103,11 +103,6 @@
 # reset locale definition (necessary for tar)
 $ENV{'LC_ALL'} = 'C';
 
-# check for arguments
-if ($#ARGV == -1) {
-    syntax();
-}
-
 # }}}
 
 # {{{ Process Command Line
@@ -319,9 +314,19 @@
     undef $packages_file;
 }
 
+# check permitted values for --color
+if ($color and $color !~ /^(never|always|auto|html)$/) {
+    die "invalid argument to --color: $color\n";
+}
+
 # check specified action
 $action = 'check' if not $action;
 
+# check for arguments
+if ($action =~ /^(check|unpack|remove)$/ and $#ARGV == -1) {
+    syntax();
+}
+
 # }}}
 
 # {{{ Setup Configuration
@@ -1638,4 +1643,8 @@
 }
 # }}}
 
+# Local Variables:
+# indent-tabs-mode: t
+# cperl-indent-level: 4
+# End:
 # vim: sw=4 ts=8 noet fdm=marker

Modified: trunk/frontend/lintian-info
===================================================================
--- trunk/frontend/lintian-info	2008-01-03 04:50:40 UTC (rev 1095)
+++ trunk/frontend/lintian-info	2008-01-03 06:02:44 UTC (rev 1096)
@@ -68,11 +68,13 @@
 
 # Otherwise, read input files or STDIN, watch for tags, and add descriptions
 # whenever we see one, can, and haven't already explained that tag.  Strip off
-# color sequences.
+# color and HTML sequences.
 while (<>) {
     print;
     chomp;
-    s/\e[[\d;]*m//g;
+    s/\e[\[\d;]*m//g;
+    s/<span style=\"[^\"]+\">//g;
+    s,</span>,,g;
 
     my $tag;
     my ($type, $pkg, @pieces) = split(/:\s+/);
@@ -89,3 +91,9 @@
 }
 
 exit 0;
+
+# Local Variables:
+# indent-tabs-mode: t
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 ts=8

Modified: trunk/lib/Tags.pm
===================================================================
--- trunk/lib/Tags.pm	2008-01-03 04:50:40 UTC (rev 1095)
+++ trunk/lib/Tags.pm	2008-01-03 06:02:44 UTC (rev 1096)
@@ -266,6 +266,12 @@
     return \%stats;
 }
 
+# Color tags with HTML.  Takes the tag and the color name.
+sub colored_html {
+    my ($tag, $color) = @_;
+    return qq(<span style="color: $color">$tag</span>);
+}
+
 sub print_tag {
     my ( $pkg_info, $tag_info, $information ) = @_;
 
@@ -281,6 +287,8 @@
     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]);
+    } elsif ($color eq 'html') {
+        $output .= colored_html($tag_info->{tag}, $sev_to_color[$severity]);
     } else {
         $output .= $tag_info->{tag};
     }
@@ -345,4 +353,8 @@
 
 1;
 
+# Local Variables:
+# indent-tabs-mode: t
+# cperl-indent-level: 4
+# End:
 # vim: ts=4 sw=4 noet

Modified: trunk/man/lintian.1
===================================================================
--- trunk/man/lintian.1	2008-01-03 04:50:40 UTC (rev 1095)
+++ trunk/man/lintian.1	2008-01-03 06:02:44 UTC (rev 1096)
@@ -158,11 +158,12 @@
 Output tags that have been overriden.
 
 .TP
-.BR \-\-color " (never|always|auto)"
+.BR \-\-color " (never|always|auto|html)"
 Whether to colorize tags in lintian output based on their severity.  The
 default is "never", which never uses color.  "always" will always use
-color, while "auto" will use color only if the output is going to a
-terminal.
+color, "auto" will use color only if the output is going to a terminal,
+and "html" will use HTML <span> tags with a color style attribute (instead
+of ANSI color escape sequences).
 
 .TP
 .BR \-U " info1,info2,..., " \-\-unpack\-info " info1,info2,..."


Reply to: