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

[lintian] 01/02: checks: Migrate some more checks to use new L::Path API



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

nthykier pushed a commit to branch master
in repository lintian.

commit 7e3a04c7f1783a9a81da9f1619ee89a910e1b40b
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Sep 18 20:19:36 2014 +0200

    checks: Migrate some more checks to use new L::Path API
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/manpages.pm    |  6 +++---
 checks/phppear.pm     |  2 +-
 checks/shared-libs.pm |  7 +++----
 checks/systemd.pm     | 10 +++-------
 4 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/checks/manpages.pm b/checks/manpages.pm
index b5d2a26..11edc53 100644
--- a/checks/manpages.pm
+++ b/checks/manpages.pm
@@ -168,12 +168,12 @@ sub run {
                 }
             }
         } else { # not a symlink
-            my $fs_path = $info->unpacked($file);
+            my $fs_path = $file->fs_path;
             my $fd;
             if ($file_info =~ m/gzip compressed/) {
-                $fd = open_gz($fs_path);
+                $fd = $file->open_gz;
             } else {
-                open($fd, '<', $fs_path);
+                $fd = $file->open;
             }
             my @manfile = <$fd>;
             close $fd;
diff --git a/checks/phppear.pm b/checks/phppear.pm
index ec3918e..e794179 100644
--- a/checks/phppear.pm
+++ b/checks/phppear.pm
@@ -82,7 +82,7 @@ sub run {
             }
             if (defined($package_xml) && $package_xml->is_regular_file) {
           # Wild guess package type as in PEAR_PackageFile_v2::getPackageType()
-                open(my $package_xml_fd, '<', $info->unpacked($package_xml));
+                my $package_xml_fd = $package_xml->open;
                 while (<$package_xml_fd>) {
                     if (
                         m{\A \s* <
diff --git a/checks/shared-libs.pm b/checks/shared-libs.pm
index 1a073c4..1f7ead8 100644
--- a/checks/shared-libs.pm
+++ b/checks/shared-libs.pm
@@ -89,9 +89,8 @@ sub run {
         # shared library?
 
         my $normalized_target;
-        $normalized_target
-          = normalize_pkg_path(join('/', dirname($cur_file), $cur_file->link))
-          if defined $cur_file->link;
+        $normalized_target = $cur_file->link_normalized
+          if defined($cur_file->link);
 
         if (
             exists $SONAME{$cur_file}
@@ -168,7 +167,7 @@ sub run {
             tag 'sharedobject-in-library-directory-missing-soname', $cur_file;
         } elsif ($cur_file =~ m/\.la$/ and not defined $cur_file->link) {
             local $_;
-            open(my $fd, '<', $info->unpacked($cur_file));
+            my $fd = $cur_file->open;
             while(<$fd>) {
                 next
                   unless (m/^(libdir)='(.+?)'$/)
diff --git a/checks/systemd.pm b/checks/systemd.pm
index 8fb5dcd..96fb1cf 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -98,23 +98,20 @@ sub check_init_script {
       or $basename eq 'rc'
       or $basename eq 'rcS';
 
-    my $unpacked_file = $info->unpacked($file);
-
     if ($file->is_symlink) {
         # We cannot test upstart-jobs
         return if $file->link eq '/lib/init/upstart-job';
     }
 
     if (!$file->is_regular_file) {
-        unless (-f $unpacked_file
-            && is_ancestor_of($info->unpacked, $unpacked_file)) {
+        unless ($file->is_open_ok) {
             tag 'init-script-is-not-a-file', $file;
             return;
         }
 
     }
 
-    open(my $fh, '<', $unpacked_file);
+    my $fh = $file->open;
     while (<$fh>) {
         lstrip;
         if ($. == 1 and m{\A [#]! \s*/lib/init/init-d-script}xsm) {
@@ -181,8 +178,7 @@ sub service_file_lines {
 sub extract_service_file_values {
     my ($info, $file, $extract_section, $extract_key) = @_;
 
-    my @values;
-    my $section;
+    my (@values, $section);
 
     my $unpacked_file = $info->unpacked($file);
     unless (

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


Reply to: