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

[SCM] Debian package checker branch, master, updated. 2.5.4-116-g933c610



The following commit has been merged in the master branch:
commit 933c6104b9f4f1e8c04523042a644dcb060a0ecd
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jan 28 12:06:58 2012 +0100

    Pass LINTIAN_ROOT to constructor of Lintian::Profile
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/frontend/lintian b/frontend/lintian
index aed2cdc..3ea7ba6 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -784,7 +784,7 @@ unless ($opt{'LINTIAN_PROFILE'}){
     # Time to ask dpkg-vendor for a vendor name
     $opt{'LINTIAN_PROFILE'} = find_default_profile(@prof_inc, "$opt{'LINTIAN_ROOT'}/profiles");
 }
-$PROFILE = Lintian::Profile->new ($opt{'LINTIAN_PROFILE'},
+$PROFILE = Lintian::Profile->new ($opt{'LINTIAN_PROFILE'}, $opt{'LINTIAN_ROOT'},
                                   [@prof_inc, "$opt{'LINTIAN_ROOT'}/profiles"]);
 v_msg('Using profile ' . $PROFILE->name . '.');
 
diff --git a/frontend/lintian-info b/frontend/lintian-info
index 7a7da3c..fcce0a7 100755
--- a/frontend/lintian-info
+++ b/frontend/lintian-info
@@ -77,7 +77,7 @@ unless ($prof) {
     $prof = find_default_profile(@proc_inc);
 
 }
-$profile = Lintian::Profile->new($prof, \@proc_inc);
+$profile = Lintian::Profile->new($prof, $ENV{'LINTIAN_ROOT'}, \@proc_inc);
 
 # If tag mode was specified, read the arguments as tags and display the
 # descriptions for each one.  (We don't currently display the severity,
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index 9449fe8..1d11555 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -41,7 +41,7 @@ Lintian::Profile - Profile parser for Lintian
  # Check if the Ubuntu default profile is present.
  my $file = Lintian::Profile->find_profile('ubuntu', @inc);
  # Parse the debian profile (if available)
- my $profile = Lintian::Profile->new('debian', [@inc]);
+ my $profile = Lintian::Profile->new('debian', $ENV{'LINTIAN_ROOT'}, [@inc]);
  foreach my $tag ($profile->tags) {
      print "Enabled tag: $tag\n";
  }
@@ -84,18 +84,18 @@ my %SEC_FIELDS = (
     'severity'    => 1,
     );
 
-=item Lintian::Profile->new($profname, $ppath)
+=item Lintian::Profile->new($profname, $root, $ppath)
 
-Creates a new profile from the profile located by
-using find_profile($profname, @$ppath).  $profname
-is the name of the profile and $ppath is a list
-reference containing the directories to search for
-the profile and (if any) its parents.
+Creates a new profile from the profile located by using
+find_profile($profname, @$ppath).  $profname is the name of the
+profile and $ppath is a list reference containing the directories to
+search for the profile and (if any) its parents.  $root is the
+"LINTIAN_ROOT" and is used for finding checks.
 
 =cut
 
 sub new {
-    my ($type, $name, $ppath) = @_;
+    my ($type, $name, $root, $ppath) = @_;
     my $profile;
     croak "Illegal profile name \"$name\".\n"
         if $name =~ m,^/,o or $name =~ m/\./o;
@@ -109,6 +109,7 @@ sub new {
         'severity-changes'     => {},
         'check-scripts'        => {}, # maps script name to Lintian::CheckScript
         'known-tags'           => {}, # maps tag name to Lintian::Tag::Info
+        'root'         => $root,
     };
     $self = bless $self, $type;
     $profile = $self->find_profile($name);
@@ -130,9 +131,13 @@ Note: This list reference and its contents should not be modified.
 Returns the name of the profile, which may differ from the name used
 to create this instance of the profile (e.g. due to symlinks).
 
+=item $prof->root
+
+Returns the LINTIAN_ROOT associated with the profile.
+
 =cut
 
-Lintian::Profile->mk_ro_accessors (qw(parents name));
+Lintian::Profile->mk_ro_accessors (qw(parents name root));
 
 =item $prof->tags([$known])
 
@@ -480,7 +485,7 @@ sub _check_for_invalid_fields {
 
 sub _load_check {
     my ($self, $profile, $check) = @_;
-    my $root = $ENV{LINTIAN_ROOT} || '/usr/share/lintian';
+    my $root = $self->root;
     my $cf = "$root/checks/${check}.desc";
     croak "$profile references unknown $check.\n" unless -f $cf;
     my $c = Lintian::CheckScript->new ($cf);
@@ -498,7 +503,7 @@ sub _load_check {
 sub _load_checks {
     # NB: testset/runtests uses this directly.
     my ($self, $profile) = @_;
-    my $root = $ENV{LINTIAN_ROOT} || '/usr/share/lintian';
+    my $root = $self->root;
     opendir my $dirfd, "$root/checks" or croak "opendir $root/checks: $!";
     for my $desc (sort readdir $dirfd) {
         next unless $desc =~ s/\.desc$//o;
diff --git a/reporting/html_reports b/reporting/html_reports
index 820f0f3..36f8269 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -57,7 +57,8 @@ use Text_utils;
 use Util;
 
 my $profile = Lintian::Profile->new (find_default_profile ("$LINTIAN_ROOT/profiles"),
-                                    ["$LINTIAN_ROOT/profiles"]);
+                                     $LINTIAN_ROOT,
+                                     ["$LINTIAN_ROOT/profiles"]);
 
 
 # Set the Lintian version, current timestamp, and archive timestamp.

-- 
Debian package checker


Reply to: