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

Bug#563126: [reporting/] code used to group together tags fails in some cases



Raphael Geissert <geissert@debian.org> writes:

> While hunting down some other bugs I noticed the following:

> X init.d-script-missing-dependency-on-local_fs 
> /etc/init.d/mountoverflowtmp: required-start
> X init.d-script-missing-dependency-on-remote_fs 
> /etc/init.d/bootlogs: required-start
> /etc/init.d/killprocs: required-start
> /etc/init.d/stop-bootlogd-single: required-start
> W init.d-script-possible-missing-stop 
> /etc/init.d/urandom 1
> X init.d-script-missing-dependency-on-local_fs 
> /etc/init.d/hostname.sh: required-start
> X init.d-script-missing-dependency-on-remote_fs 
> /etc/init.d/bootlogd: required-start

> It should be (emphasis on the grouped tags):

> X init.d-script-missing-dependency-on-local_fs 
> /etc/init.d/mountoverflowtmp: required-start
> */etc/init.d/hostname.sh: required-start*
> X init.d-script-missing-dependency-on-remote_fs 
> /etc/init.d/bootlogs: required-start
> /etc/init.d/killprocs: required-start
> /etc/init.d/stop-bootlogd-single: required-start
> */etc/init.d/bootlogd: required-start*
> W init.d-script-possible-missing-stop 
> /etc/init.d/urandom 1

> I remember it working on .17

I don't see any code in Lintian that will do that.  It would require
sorting the tags before writing the output page so that all instances of
the same tag are grouped, but everything comes straight out of lintian.log
into an array and that array goes in that order to maintainer.tmpl, which
only combines if the tag is the same as the previous tag.  Since the tags
are being issued in a loop over the init scripts, Lintian outputs all the
tags for a given init script separately.

I think this patch would fix it, but another set of eyes would be great.

diff --git a/reporting/html_reports b/reporting/html_reports
index ea2f836..324914f 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -211,6 +211,7 @@ while (<>) {
     next unless m/^([EWIXO]): (\S+)(?: (\S+))?: (\S+)(?:\s+(.*))?/;
     my ($code, $package, $type, $tag, $extra) = ($1, $2, $3, $4, $5);
     $type = 'binary' unless (defined $type);
+    $extra = '' unless (defined $extra);
     next unless ($type eq 'source' || $type eq 'binary' || $type eq 'udeb');
 
     # Update statistics.
@@ -362,12 +363,16 @@ for my $maintainer (@maintainers) {
     # Determine if the maintainer's page is clean.  Check all packages for
     # which they're either maintainer or uploader and set $error_clean if
     # they have no errors or warnings.
+    #
+    # Also take this opportunity to sort the tags so that all similar tags
+    # will be grouped, which produces better HTML output.
     my $error_clean = 1;
     for my $source (keys %{ $by_maint{$maintainer} },
                     keys %{ $by_uploader{$maintainer} }) {
         my $versions = $by_maint{$maintainer}{$source}
             || $by_uploader{$maintainer}{$source};
         for my $version (keys %$versions) {
+            $versions->{$version} = [ sort by_tag @$tags ];
             my $tags = $versions->{$version};
             for my $tag (@$tags) {
                 $error_clean = 0 if ($tag->{code} eq 'E');
@@ -627,6 +632,17 @@ sub output_template {
     close OUTPUT;
 }
 
+# Sort function for sorting lists of tags.  Sort by package, version, area,
+# type, tag, and then any extra data.  This will produce the best HTML output.
+sub by_tag {
+    return $a->{package} cmp $b->{package}
+        || $a->{version} cmp $b->{version}
+        || $a->{area}    cmp $b->{area}
+        || $a->{type}    cmp $b->{type}
+        || $a->{tag}     cmp $b->{tag}
+        || $a->{extra}   cmp $b->{extra};
+}
+
 # Local Variables:
 # indent-tabs-mode: nil
 # cperl-indent-level: 4

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: