aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2008-02-10 14:36:27 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2008-02-10 14:36:27 +0000
commitb95abf1988a7ba50c19ef14c4a4007e0de02c222 (patch)
treea07aecd29a4c36f43b236f0c9d6e1cf449e2bd5e
parent1cfad3839c59a35976f90258f089ce0fb1708f4f (diff)
downloadspec-helper-b95abf1988a7ba50c19ef14c4a4007e0de02c222.tar
spec-helper-b95abf1988a7ba50c19ef14c4a4007e0de02c222.tar.gz
spec-helper-b95abf1988a7ba50c19ef14c4a4007e0de02c222.tar.bz2
spec-helper-b95abf1988a7ba50c19ef14c4a4007e0de02c222.tar.xz
spec-helper-b95abf1988a7ba50c19ef14c4a4007e0de02c222.zip
use same pattern-based exclusion mecanism as other scripts
-rwxr-xr-xcompress_files25
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;