diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-08-02 04:35:51 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-08-02 04:35:51 +0000 |
commit | 9a3020b6394bff3b3ef50ff75e48bf34eef8fd15 (patch) | |
tree | 95e3ebd91e5feb71de71b394340e31e04d80836b | |
parent | ddee37d57d9c261ab2abdcb802d0810969b676c9 (diff) | |
download | spec-helper-9a3020b6394bff3b3ef50ff75e48bf34eef8fd15.tar spec-helper-9a3020b6394bff3b3ef50ff75e48bf34eef8fd15.tar.gz spec-helper-9a3020b6394bff3b3ef50ff75e48bf34eef8fd15.tar.bz2 spec-helper-9a3020b6394bff3b3ef50ff75e48bf34eef8fd15.tar.xz spec-helper-9a3020b6394bff3b3ef50ff75e48bf34eef8fd15.zip |
factorize code
-rwxr-xr-x | strip_files | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/strip_files b/strip_files index aa72774..3e70d13 100755 --- a/strip_files +++ b/strip_files @@ -18,6 +18,12 @@ use File::Find; my (@shared_libs, @executables, @static_libs); my @exclude_files = (split(' ', $ENV{EXCLUDE_FROM_STRIP}), "/usr/lib/debug"); +# TODO: we should write a binding for libfile... +sub expensive_test { + my ($file) = @_; + my $type = `file $file`; +} + sub testfile() { local $_ = $_; return if -l $_ || -d $_; # Skip directories and symlinks always. @@ -32,9 +38,8 @@ sub testfile() { # Does its filename look like a shared library? if (m/.*\.so.*?/) { # Ok, do the expensive test. - my $type=`file $_`; - if ($type =~ m/.*ELF.*shared/) { - push @shared_libs, $fn; + if (expensive_test($_) =~ m/.*ELF.*shared/) { + push @executables, $fn; return; } } @@ -43,8 +48,7 @@ sub testfile() { my (undef, undef, $mode, undef) = stat(_); if ($mode & 0111) { # Ok, expensive test. - my $type=`file $_`; - if ($type =~ m/.*ELF.*executable/) { + if (expensive_test($_) =~ m/.*ELF.*executable/) { push @executables, $fn; return; } |