diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2009-05-08 16:36:18 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2009-05-08 16:36:18 +0000 |
commit | 1b6b1bb07276cb4247e459a1472a5df55b5d6eb2 (patch) | |
tree | 3736843eb2b3d0ae6464463eae77da7b994cca31 /compress_files | |
parent | abf560c2b420583cef3b305037aad1a0614aa76e (diff) | |
download | spec-helper-1b6b1bb07276cb4247e459a1472a5df55b5d6eb2.tar spec-helper-1b6b1bb07276cb4247e459a1472a5df55b5d6eb2.tar.gz spec-helper-1b6b1bb07276cb4247e459a1472a5df55b5d6eb2.tar.bz2 spec-helper-1b6b1bb07276cb4247e459a1472a5df55b5d6eb2.tar.xz spec-helper-1b6b1bb07276cb4247e459a1472a5df55b5d6eb2.zip |
fix exception handling:
- exported string is now a single regexp, as automatic dependencies exceptions
- don't change directory in compress_file, so as to match absolute path easily,
as $File::Find::name will always be relative to $buildroot
Diffstat (limited to 'compress_files')
-rwxr-xr-x | compress_files | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/compress_files b/compress_files index 8894d73..3a05143 100755 --- a/compress_files +++ b/compress_files @@ -15,21 +15,18 @@ die "Unknown extension $ext" unless $ext =~ /^\.(?:gz|bz2|lzma|xz)$/; my $buildroot = $ENV{RPM_BUILD_ROOT}; die "No build root defined" unless $buildroot; die "Invalid build root" unless -d $buildroot; -chdir($buildroot) or die "Can't cd to $buildroot: $!"; +# normalize build root +$buildroot =~ s|/$||; -my $exclude_pattern = join('|', - map { '(:?' . quotemeta($_) . ')' } - $ENV{EXCLUDE_FROM_COMPRESS} ? - split(' ', $ENV{EXCLUDE_FROM_COMPRESS}) : () -); -$exclude_pattern = qr/$exclude_pattern/; +my $exclude_pattern = $ENV{EXCLUDE_FROM_COMPRESS} ? + qr/$ENV{EXCLUDE_FROM_COMPRESS}/ : undef; -my @sodirs = qw{ +my @sodirs = map { "$buildroot/$_" } qw{ usr/man usr/X11R6/man usr/lib/perl5/man }; -my @mandirs = qw{ +my @mandirs = map { "$buildroot/$_" } qw{ usr/info usr/share/info usr/man @@ -49,7 +46,7 @@ my $so_function = sub { # to open every man page. 1024 is arbitrary. return if -s $_ > 1024; # skip excluded files - return if $File::Find::name =~ $exclude_pattern; + return if $exclude_pattern && $File::Find::name =~ $exclude_pattern; # Test first line of file for the .so thing. my $SOTEST; @@ -86,7 +83,7 @@ my $function = sub { # skip directories return if -d $_; # skip excluded files - return if $File::Find::name =~ $exclude_pattern; + return if $exclude_pattern && $File::Find::name =~ $exclude_pattern; # skip compressed files return if $_ =~ /\.(?:gz|bz2|lzma|xz)$/; # skip particular files |