diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-05-07 11:43:36 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-05-07 11:43:36 +0000 |
commit | 5a8741f75efb301880630d1a9221669efcae4999 (patch) | |
tree | 616879f80ca5bf6232b6ca4cdd77b10fe286ad86 /strip_files | |
parent | 88884d287a233a3d26bf860b1b8d6b2723ef640e (diff) | |
download | spec-helper-5a8741f75efb301880630d1a9221669efcae4999.tar spec-helper-5a8741f75efb301880630d1a9221669efcae4999.tar.gz spec-helper-5a8741f75efb301880630d1a9221669efcae4999.tar.bz2 spec-helper-5a8741f75efb301880630d1a9221669efcae4999.tar.xz spec-helper-5a8741f75efb301880630d1a9221669efcae4999.zip |
* replace strip_files with strip_and_check_elf_files which checks for
overlinking (cf http://wiki.mandriva.com/en/Overlinking) and "missing
linking" (need checking if there are too many false positives)
nb: strip_and_check_elf_files is done last in %__spec_helper_post so that the
warning is easier to see in rpmbuild logs
Diffstat (limited to 'strip_files')
-rwxr-xr-x | strip_files | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/strip_files b/strip_files deleted file mode 100755 index 2df2a8b..0000000 --- a/strip_files +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/perl -# $Id$ -# Strip files - -use strict; -use warnings; -use File::Find; - -my $buildroot = $ENV{RPM_BUILD_ROOT}; -die "No build root defined" unless $buildroot; -die "Invalid build root" unless -d $buildroot; -# normalize build root -$buildroot =~ s|/$||; - -my $exclude_pattern = join('|', - map { '(:?' . quotemeta($_) . ')' } - $ENV{EXCLUDE_FROM_STRIP} ? - split(' ', $ENV{EXCLUDE_FROM_STRIP}) : (), - '/usr/lib/debug' -); -$exclude_pattern = qr/$exclude_pattern/; - -my (@shared_libs, @executables, @static_libs); -find(\&keep_wanted, $buildroot); - -system( - "strip", - "--remove-section=.comment", - "--remove-section=.note", - $_) foreach @shared_libs, @executables; - -# TODO: we should write a binding for libfile... -sub expensive_test { - my ($file) = @_; - my $type = `file -- $file`; -} - -# Check if a file is an elf binary, shared library, or static library, -# for use by File::Find. It'll fill the following 3 arrays with anything -# it finds: -sub keep_wanted() { - # skip symlinks - return if -l $_; - # skip directories - return if -d $_; - # skip excluded files - return if $File::Find::name =~ $exclude_pattern; - - # Does its filename look like a shared library? - if (m/\.so/) { - # Ok, do the expensive test. - if (expensive_test($_) =~ m/ELF.*shared/) { - push @shared_libs, $File::Find::name; - return; - } - } - - # Is it executable? -x isn't good enough, so we need to use stat. - my (undef, undef, $mode, undef) = stat(_); - if ($mode & 0111) { - # Ok, expensive test. - if (expensive_test($_) =~ m/ELF.*executable/) { - push @executables, $File::Find::name; - return; - } - } - - # Is it a static library, and not a debug library? - if (m/lib.*\.a/ && ! m/_g\.a/) { - push @static_libs, $File::Find::name; - return; - } -} |