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

[lintian] 04/08: c/binaries: Only compute %directories when needed



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

nthykier pushed a commit to branch master
in repository lintian.

commit b4543c6d46e1dd4c08c891394af7be31b5ad853a
Author: Niels Thykier <niels@thykier.net>
Date:   Mon Jan 25 18:35:51 2016 +0000

    c/binaries: Only compute %directories when needed
    
    Only packages with RPATH binaries will need this variable, so there is
    no need to compute it for anything else.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/binaries.pm | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/checks/binaries.pm b/checks/binaries.pm
index ea0437b..72380d3 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -104,7 +104,7 @@ our $ARCH_32_REGEX;
 sub run {
     my ($pkg, $type, $info, $proc, $group) = @_;
 
-    my $madir;
+    my ($madir, %directories, $built_with_golang, %SONAME);
     my $gnu_triplet_re;
     my $ruby_triplet_re;
     my $needs_libc = '';
@@ -118,8 +118,6 @@ sub run {
     my $has_php_ext = 0;
     my $uses_numpy_c_abi = 0;
 
-    my %SONAME;
-
     my $arch = $info->field('architecture', '');
     my $multiarch = $info->field('multi-arch', 'no');
     my $srcpkg = $proc->pkg_src;
@@ -250,16 +248,7 @@ sub run {
     tag 'package-name-doesnt-match-sonames', "@sonames"
       if @sonames && !$match_found;
 
-    my %directories;
-    for my $file ($info->sorted_index) {
-        my $name = $file->name;
-        next unless $file->is_dir || $file->is_symlink;
-        $name =~ s,/\z,,;
-        $directories{"/$name"}++;
-    }
-
     my $src = $group->get_source_processable();
-    my $built_with_golang;
     if (defined($src)) {
         $built_with_golang
           = $src->info->relation('build-depends')->implies('golang-go');
@@ -402,6 +391,16 @@ sub run {
 
         # rpath is disallowed, except in private directories
         if (exists $objdump->{RPATH}) {
+            if (not %directories) {
+                for my $file ($info->sorted_index) {
+                    my $name;
+                    next unless $file->is_dir || $file->is_symlink;
+                    $name = $file->name;
+                    $name =~ s,/\z,,;
+                    $directories{"/$name"}++;
+                }
+            }
+
             foreach my $rpath (
                 map {File::Spec->canonpath($_)}
                 keys %{$objdump->{RPATH}}

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


Reply to: