diff options
-rwxr-xr-x | clean_files | 7 | ||||
-rwxr-xr-x | compress_files | 8 | ||||
-rwxr-xr-x | fix-eol | 6 | ||||
-rwxr-xr-x | relink_symlinks | 13 | ||||
-rwxr-xr-x | strip_files | 8 | ||||
-rwxr-xr-x | translate_menu | 7 |
6 files changed, 30 insertions, 19 deletions
diff --git a/clean_files b/clean_files index 7e5d02d..2e7723e 100755 --- a/clean_files +++ b/clean_files @@ -14,9 +14,10 @@ use strict; use warnings; $ENV{DONT_CLEANUP} and exit(0); -my $RPM_BUILD_ROOT = $ENV{RPM_BUILD_ROOT}; -$RPM_BUILD_ROOT or exit(0); # case RPM_BUILD_ROOT is not used -chdir($RPM_BUILD_ROOT) or die "Can't cd to $ENV{RPM_BUILD_ROOT}: $!"; +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: $!"; system(split(/\s+/, "find . -type f -a ( -name #*# -o -name *~ -o -name DEADJOE -o -name .cvsignore diff --git a/compress_files b/compress_files index dffbc63..15249fa 100755 --- a/compress_files +++ b/compress_files @@ -100,8 +100,10 @@ sub find_so_man() { my $ext = $ARGV[0] ||= '.gz'; die "Unknown extension $ext" unless $ext =~ /^\.(?:gz|bz2|lzma)$/; -my $RPM_BUILD_ROOT = $ENV{RPM_BUILD_ROOT}; -chdir($RPM_BUILD_ROOT) or die "Can't cd to $ENV{RPM_BUILD_ROOT}: $!"; +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: $!"; # Now the .so conversion. @sofiles = @sodests = (); @@ -204,7 +206,7 @@ foreach (keys %hardlinks) { # Fix up symlinks that were pointing to the uncompressed files. my $FIND; -open($FIND, "find $RPM_BUILD_ROOT -type l |"); +open($FIND, "find $buildroot -type l |"); while (<$FIND>) { local $_ = $_; chomp; @@ -6,10 +6,10 @@ use warnings; use File::Find; use File::Temp; -die "No build root defined" unless $ENV{RPM_BUILD_ROOT}; - -# normalize build root 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_files = ( diff --git a/relink_symlinks b/relink_symlinks index 4f8dad4..0150899 100755 --- a/relink_symlinks +++ b/relink_symlinks @@ -5,6 +5,12 @@ 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|/$||; + sub relativize { return unless -l $_; @@ -13,14 +19,11 @@ sub relativize { $link =~ s{^/}{}; my $dirname = $File::Find::dir; - $dirname =~ s/^\Q$ENV{RPM_BUILD_ROOT}\E//; + $dirname =~ s/^\Q$buildroot\E//; $dirname =~ s{/[^/]+}{../}g; unlink $_; symlink $dirname . $link, $_; } -die "No build root defined\n" unless $ENV{RPM_BUILD_ROOT}; - -$ENV{RPM_BUILD_ROOT} =~ s{/$}{}; -find(\&relativize, $ENV{RPM_BUILD_ROOT}); +find(\&relativize, $buildroot); diff --git a/strip_files b/strip_files index b994362..03bd460 100755 --- a/strip_files +++ b/strip_files @@ -64,11 +64,13 @@ sub testfile() { } ################################################################################ -my $RPM_BUILD_ROOT = $ENV{RPM_BUILD_ROOT}; -chdir($RPM_BUILD_ROOT) or die "Can't cd to $ENV{RPM_BUILD_ROOT}: $!"; +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: $!"; @shared_libs = @executables = @static_libs = (); -find(\&testfile, $RPM_BUILD_ROOT); +find(\&testfile, $buildroot); # Note that all calls to strip on shared libs *must* include the --strip-unneeded. system("strip", "--remove-section=.comment", "--remove-section=.note", "--strip-unneeded",$_) foreach @shared_libs; diff --git a/translate_menu b/translate_menu index 2fc3f88..4128f8b 100755 --- a/translate_menu +++ b/translate_menu @@ -12,11 +12,14 @@ use strict; use warnings; +my $buildroot = $ENV{RPM_BUILD_ROOT}; +die "No build root defined" unless $buildroot; +die "Invalid build root" unless -d $buildroot; + my $menudir = `rpm --eval %_menudir`; chomp($menudir); -$ENV{RPM_BUILD_ROOT} or exit(0); -! -d "$ENV{RPM_BUILD_ROOT}/$menudir/" || exit(0); +! -d "$buildroot/$menudir/" || exit(0); my @nested = (["Configuration", "System/Configuration"], |