aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xstrip_files17
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.