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

[lintian] 03/03: dplint: Add load_profile sub that frontends can use



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit e4d9dba755701762f1ebbe558db9dac3cb907887
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Jul 16 17:43:36 2015 +0200

    dplint: Add load_profile sub that frontends can use
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 commands/info.pm        |  4 +---
 commands/spellintian.pm |  2 +-
 frontend/dplint         | 11 +++++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/commands/info.pm b/commands/info.pm
index 26845db..3f053ba 100644
--- a/commands/info.pm
+++ b/commands/info.pm
@@ -84,12 +84,10 @@ EOT
         exit 0;
     }
 
-    $profile = Lintian::Profile->new(
+    $profile = dplint::load_profile(
         $prof,
-        [dplint::include_dirs()],
         {
             'language' => determine_locale(),
-            'restricted-search-dirs' => [dplint::restricted_include_dirs()],
         });
 
     Lintian::Data->set_vendor($profile);
diff --git a/commands/spellintian.pm b/commands/spellintian.pm
index 3715cad..6dd717e 100644
--- a/commands/spellintian.pm
+++ b/commands/spellintian.pm
@@ -57,7 +57,7 @@ sub spellcheck {
 }
 
 sub main {
-    my $profile = Lintian::Profile->new;
+    my $profile = dplint::load_profile();
     my $picky = 0;
     my $exit_code = 0;
     Lintian::Data->set_vendor($profile);
diff --git a/frontend/dplint b/frontend/dplint
index 6876422..008a32e 100755
--- a/frontend/dplint
+++ b/frontend/dplint
@@ -183,6 +183,17 @@ sub restricted_include_dirs {
     return @RESTRICTED_INCLUDE_DIRS;
 }
 
+sub load_profile {
+    my ($profile_name, $options) = @_;
+    my %opt = (
+        'restricted-search-dirs' => \@RESTRICTED_INCLUDE_DIRS,
+        %{$options // {}},
+    );
+    require Lintian::Profile;
+
+    return Lintian::Profile->new($profile_name, \@INCLUDE_DIRS, \%opt);
+}
+
 sub main {
     my $user_dirs = 1;
     my %opthash = (

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: