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

[SCM] Debian package checker branch, vendor-profile, updated. 2.5.1-32-gdbc1960



The following commit has been merged in the vendor-profile branch:
commit 44ad568b603a0e6d626a1463954d54e20074b26a
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Jun 23 15:33:28 2011 +0200

    Added profile support for lintian-info

diff --git a/frontend/lintian-info b/frontend/lintian-info
index df4ad6c..881a9fe 100755
--- a/frontend/lintian-info
+++ b/frontend/lintian-info
@@ -37,15 +37,20 @@ BEGIN {
 
 # import perl libraries
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Lintian::Internal::FrontendUtil;
+use Lintian::Profile;
 use Lintian::Tag::Info ();
 use Text_utils;
 
 my %already_displayed = ();
-
-my ($annotate, $tags, $help);
+my ($annotate, $tags, $help, $prof);
 Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
-GetOptions('annotate|a' => \$annotate, 'tags|t' => \$tags, 'help|h' => \$help)
-    or die("error parsing options\n");
+GetOptions(
+    'annotate|a' => \$annotate,
+    'tags|t' => \$tags,
+    'help|h' => \$help,
+    'profile' => \$prof,
+) or die("error parsing options\n");
 
 # help
 if ($help) {
@@ -57,11 +62,19 @@ Usage: lintian-info [log-file...] ...
 Options:
     -a, --annotate    display descriptions of tags in Lintian overrides
     -t, --tags        display tag descriptions
+    --profile X       use vendor profile X to determine severities
 EOT
 
     exit 0;
 }
 
+unless ($prof) {
+    $prof = find_default_profile(
+	"$ENV{HOME}/.lintian/profiles",
+	'/etc/lintian/profiles',
+	"$ENV{'LINTIAN_ROOT'}/profiles");
+}
+load_profile($prof);
 
 # If tag mode was specified, read the arguments as tags and display the
 # descriptions for each one.  (We don't currently display the severity,
@@ -69,12 +82,14 @@ EOT
 my $unknown;
 if ($tags) {
     for my $tag (@ARGV) {
-	print "N: $tag\n";
-	print "N:\n";
 	my $info = Lintian::Tag::Info->new($tag);
 	if ($info) {
+	    print $info->code . ": $tag\n";
+	    print "N:\n";
 	    print $info->description('text', 'N:   ');
 	} else {
+	    print "N: $tag\n";
+	    print "N:\n";
 	    print "N:	Unknown tag.\n";
 	    $unknown = 1;
 	}
@@ -120,6 +135,19 @@ while (<>) {
 
 exit 0;
 
+# load_profile($profname)
+#  Loads the profile called $profname and applies
+#  the relevant changes from it.
+sub load_profile{
+    my ($profname) = @_;
+    my $profile = Lintian::Profile->new($prof);
+    my $severities = $profile->severity_changes;
+    while ( my ($tagname, $severity) = each(%$severities) ){
+	my $tag = Lintian::Tag::Info->new($tagname);
+	$tag->set_severity($severity);
+    }
+}
+
 # Local Variables:
 # indent-tabs-mode: t
 # cperl-indent-level: 4
diff --git a/man/lintian-info.pod b/man/lintian-info.pod
index c44dec0..b13fe74 100644
--- a/man/lintian-info.pod
+++ b/man/lintian-info.pod
@@ -60,6 +60,18 @@ about that tag.
 
 Display usage information and exit.
 
+=item B<--profile> prof
+
+Use the severities from the vendor profile prof when displaying tags.
+If the profile name does not contain a slash, the default profile for
+than vendor is chosen.
+
+If not specified, B<lintian-info> loads the best profile for the
+current vendor.
+
+Please Refer to the Lintian User Manual for the full documentation of
+profiles.
+
 =item B<-t>, B<--tags>
 
 Rather than treating them as log file names, treat any command-line

-- 
Debian package checker


Reply to: