diff options
-rwxr-xr-x | compress_files | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/compress_files b/compress_files index f5d028f..8fc5a1b 100755 --- a/compress_files +++ b/compress_files @@ -16,6 +16,13 @@ die "No build root defined" unless $buildroot; die "Invalid build root" unless -d $buildroot; chdir($buildroot) or die "Can't cd to $buildroot: $!"; +my $exclude_pattern = join('|', + map { '(:?' . quotemeta($_) . ')' } + $ENV{EXCLUDE_FROM_COMPRESS} ? + split(' ', $ENV{EXCLUDE_FROM_COMPRESS}) : () +); +$exclude_pattern = qr/$exclude_pattern/; + # Now the .so conversion. my (@sofiles, @sodests); foreach my $dir (qw{usr/man usr/X11R6/man usr/lib/perl5/man}) { @@ -57,22 +64,6 @@ if ($ext ne '.lzma') { } } -# Exclude files from compression. -if (@files && defined($ENV{EXCLUDE_FROM_COMPRESS})) { - my @new; - foreach (@files) { - my $ok = 1; - foreach my $x (split(' ', $ENV{EXCLUDE_FROM_COMPRESS})) { - if (/\Q$x\E/) { - $ok = ''; - last; - } - } - push @new,$_ if $ok; - } - @files = @new; -} - # Look for files with hard links. If we are going to compress both, # we can preserve the hard link across the compression and save # space in the end. @@ -175,6 +166,8 @@ sub find_so_man() { if (! -f $_ || -s $_ > 1024) { return; } + # skip excluded files + return if $File::Find::name =~ $exclude_pattern; # Test first line of file for the .so thing. my $SOTEST; |