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

[lintian] 01/01: c/files: Inline dir_counts and skip some object stringification



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

nthykier pushed a commit to branch master
in repository lintian.

commit 82079eaa0b76621c725a91966eaf53aa2fcde4bc
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Sep 22 12:15:37 2013 +0200

    c/files: Inline dir_counts and skip some object stringification
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/files.pm |   25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/checks/files.pm b/checks/files.pm
index b4b46c3..386d314 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -1645,13 +1645,14 @@ sub run {
     # be empty
     if ($pkg ne 'base-files') {
         foreach my $dir ($info->sorted_index) {
-            next if $dir eq '' or not $info->index($dir)->is_dir;
-            next if ($dir =~ m{^var/} or $dir =~ m{^etc/});
-            if (dir_counts($info, $dir) == 0) {
-                if (    $dir ne 'usr/lib/perl5/'
-                    and $dir ne 'usr/share/perl5/'
-                    and $dir !~ m;^usr/share/python-support/;) {
-                    tag 'package-contains-empty-directory', $dir;
+            next if not $dir->is_dir;
+            my $dirname = $dir->name;
+            next if ($dirname =~ m{^var/} or $dirname =~ m{^etc/});
+            if (scalar($dir->children) == 0) {
+                if (    $dirname ne 'usr/lib/perl5/'
+                    and $dirname ne 'usr/share/perl5/'
+                    and $dirname !~ m;^usr/share/python-support/;) {
+                    tag 'package-contains-empty-directory', $dirname;
                 }
             }
         }
@@ -1689,16 +1690,6 @@ sub run {
     return;
 }
 
-sub dir_counts {
-    my ($info, $dir) = @_;
-
-    if (defined $info->index($dir)) {
-        return scalar $info->index($dir)->children;
-    } else {
-        return 0;
-    }
-}
-
 1;
 
 # Local Variables:

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


Reply to: