diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2008-02-10 14:05:28 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2008-02-10 14:05:28 +0000 |
commit | 4564130b695297a98b1de74ecbacedcc3f1474f3 (patch) | |
tree | cc19126667024bdace55db7b6efa707a143dafdc /strip_files | |
parent | b893b71ce4263b5f66a763a8fd78155741d0bb68 (diff) | |
download | spec-helper-4564130b695297a98b1de74ecbacedcc3f1474f3.tar spec-helper-4564130b695297a98b1de74ecbacedcc3f1474f3.tar.gz spec-helper-4564130b695297a98b1de74ecbacedcc3f1474f3.tar.bz2 spec-helper-4564130b695297a98b1de74ecbacedcc3f1474f3.tar.xz spec-helper-4564130b695297a98b1de74ecbacedcc3f1474f3.zip |
build a unique exclusion pattern rather than looping around a list of pattern
Diffstat (limited to 'strip_files')
-rwxr-xr-x | strip_files | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/strip_files b/strip_files index af81327..1013c2a 100755 --- a/strip_files +++ b/strip_files @@ -18,10 +18,13 @@ use File::Find; # for use by File::Find. It'll fill the following 3 arrays with anything # it finds: my (@shared_libs, @executables, @static_libs); -my @exclude_files = ( - $ENV{EXCLUDE_FROM_STRIP} ? split(' ', $ENV{EXCLUDE_FROM_STRIP}) : (), - "/usr/lib/debug" +my $exclude_pattern = join('|', + map { '(:?' . quotemeta($_) . ')' } + $ENV{EXCLUDE_FROM_STRIP} ? + split(' ', $ENV{EXCLUDE_FROM_STRIP}) : (), + '/usr/lib/debug' ); +$exclude_pattern = qr/$exclude_pattern/; # TODO: we should write a binding for libfile... sub expensive_test { @@ -32,14 +35,10 @@ sub expensive_test { sub testfile() { local $_ = $_; return if -l $_ || -d $_; # Skip directories and symlinks always. + # reject excluded files + return if $File::Find::name =~ $exclude_pattern; my $fn = "$File::Find::dir/$_"; - # See if we were asked to exclude this file. - # Note that we have to test on the full filename, including directory. - foreach my $f (@exclude_files) { - return if $fn =~ m/\Q$f\E/; - } - # Does its filename look like a shared library? if (m/\.so/) { # Ok, do the expensive test. |