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

Bug#650712: lintian: [PATCH] Respect vendor profiles when generating HTML reports



Package: lintian
Version: 2.5.3ubuntu2
Severity: normal

Currently Lintian does not look at vendor profiles at all when
generating HTML reports.

This patchset changes the html_reports script to look at the default
vendor profile instead of parsing the .desc files in checks on its
own. It's currently deployed at lintian.ubuntuwire.org (for instance,
http://lintian.ubuntuwire.org/tags/data.tar.xz-member-without-dpkg-pre-depends.html
correctly shows up as Severity: serious)

I'm not sure this patch is ideal in its current form, because it means
that if a tag were suppressed in the Debian profile, it wouldn't show
up on lintian.d.o at all, and I know several people who treat
lintian.d.o as an online repository of information about Lintian tags

It's also possible that the profile should be settable from
reporting/config.

Thanks,
 - Evan

-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric-updates
  APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 'oneiric'), (100, 'oneiric-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-13-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils       2.21.53.20110810-0ubuntu5 The GNU assembler, linker and bina
ii  bzip2          1.0.5-6ubuntu1            high-quality block-sorting file co
ii  diffstat       1.54-1                    produces graph of changes introduc
ii  file           5.04-5ubuntu3             Determines file type using "magic"
ii  gettext        0.18.1.1-3ubuntu1         GNU Internationalization utilities
ii  intltool-debia 0.35.0+20060710.1         Help i18n of RFC822 compliant conf
ii  libapt-pkg-per 0.1.24build3              Perl interface to libapt-pkg
ii  libclass-acces 0.34-1                    Perl module that automatically gen
ii  libdpkg-perl   1.16.0.3ubuntu5           Dpkg perl modules
ii  libemail-valid 0.184-1                   Perl module for checking the valid
ii  libipc-run-per 0.90-1                    Perl module for running processes
ii  libparse-debia 1.2.0-1ubuntu1            parse Debian changelogs and output
ii  libtimedate-pe 1.2000-1                  collection of modules to manipulat
ii  liburi-perl    1.58-1                    module to manipulate and access UR
ii  locales        2.13+git20110622-2        common files for locale support
ii  man-db         2.6.0.2-2                 on-line manual pager
ii  patchutils     0.3.2-1                   Utilities to work with patches
ii  perl [libdiges 5.12.4-4                  Larry Wall's Practical Extraction 
ii  unzip          6.0-4ubuntu1              De-archiver for .zip files

lintian recommends no packages.

Versions of packages lintian suggests:
pn  binutils-multiarch       <none>          (no description available)
ii  dpkg-dev                 1.16.0.3ubuntu5 Debian package development tools
ii  libhtml-parser-perl      3.68-1build1    collection of modules that parse H
ii  libtext-template-perl    1.45-2          Text::Template perl module
ii  man-db                   2.6.0.2-2       on-line manual pager
ii  xz-utils                 5.0.0-2         XZ-format compression utilities

-- no debconf information
>From 8f16f3a76717eff9ab4730a632f57dfbf3bb2eb8 Mon Sep 17 00:00:00 2001
From: Evan Broder <evan@ebroder.net>
Date: Fri, 2 Dec 2011 00:18:08 -0800
Subject: [PATCH 1/2] Always use the effective severity in a tag's long-form
 description

Signed-off-by: Evan Broder <evan@ebroder.net>
---
 lib/Lintian/Tag/Info.pm |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index ff2b269..5f871c7 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -283,9 +283,9 @@ sub description {
     if ($self->{ref}) {
         push(@text, '', _format_reference($self->{ref}));
     }
-    if ($self->{severity} and $self->{certainty}) {
-        my $severity = $self->{severity};
-        my $certainty = $self->{certainty};
+    if ($self->severity and $self->certainty) {
+        my $severity = $self->severity;
+        my $certainty = $self->certainty;
         push(@text, '', "Severity: $severity, Certainty: $certainty");
     }
     if ($self->{script} and $self->{'script-type'}){
-- 
1.7.5.4

>From 4c70e2c05cf003e6bc332ad3c663c429d42eeefe Mon Sep 17 00:00:00 2001
From: Evan Broder <evan@ebroder.net>
Date: Fri, 2 Dec 2011 00:18:47 -0800
Subject: [PATCH 2/2] Use profile information about tags in HTML reports

....instead of parsing the tag descriptions independently.

Signed-off-by: Evan Broder <evan@ebroder.net>
---
 reporting/html_reports |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/reporting/html_reports b/reporting/html_reports
index 5815434..a16f0de 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -51,29 +51,28 @@ $ENV{'LINTIAN_ROOT'} = $LINTIAN_ROOT;
 # Import Lintian Perl libraries.
 use lib "$ENV{LINTIAN_ROOT}/lib";
 use Lintian::Lab;
+use Lintian::Profile;
 use Lintian::Tag::Info ();
+use Lintian::Internal::FrontendUtil;
 use Text_utils;
 use Util;
 
 # Get additional tag information.
 our %tag_extra = ();
 
-opendir(CHECKDIR, "$LINTIAN_ROOT/checks")
-    or fail("cannot read directory $LINTIAN_ROOT/checks");
-
-for my $check (readdir CHECKDIR) {
-    next unless $check =~ /\.desc$/;
-    my @tags = read_dpkg_control("$LINTIAN_ROOT/checks/$check");
-    shift(@tags);
-    foreach my $tag (@tags) {
-        next unless $tag->{severity} and $tag->{certainty};
-        my $name = $tag->{tag};
-        $tag_extra{$name}{severity} = $tag->{severity};
-        $tag_extra{$name}{certainty} = $tag->{certainty};
-    }
+my $profile = Lintian::Profile->new(find_default_profile("$LINTIAN_ROOT/profiles"),
+                                    ["$LINTIAN_ROOT/profiles"]);
+
+while ( my ($tagname, $severity) = each(%{$profile->severity_changes}) ) {
+    my $tag = Lintian::Tag::Info->new($tagname);
+    $tag->set_severity($severity);
 }
 
-closedir(CHECKDIR);
+for my $name ($profile->tags) {
+    my $tag = Lintian::Tag::Info->new($name);
+    $tag_extra{$name}{severity} = $tag->{severity};
+    $tag_extra{$name}{certainty} = $tag->{certainty};
+}
 
 # Set the Lintian version, current timestamp, and archive timestamp.
 our $LINTIAN_VERSION = `$LINTIAN_ROOT/frontend/lintian --print-version`;
-- 
1.7.5.4


Reply to: