aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2008-05-08 16:43:58 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2008-05-08 16:43:58 +0000
commit63fb6398455347084df0a39dd488bb94f84a96e9 (patch)
tree47dc5712d87e500215e26ae6d60e5f37e61a93f8
parent3e4ce5e61cd8636c9a0197d6d19148a3a13de416 (diff)
downloadspec-helper-63fb6398455347084df0a39dd488bb94f84a96e9.tar
spec-helper-63fb6398455347084df0a39dd488bb94f84a96e9.tar.gz
spec-helper-63fb6398455347084df0a39dd488bb94f84a96e9.tar.bz2
spec-helper-63fb6398455347084df0a39dd488bb94f84a96e9.tar.xz
spec-helper-63fb6398455347084df0a39dd488bb94f84a96e9.zip
no more usage of external find command
-rwxr-xr-xcompress_files22
1 files changed, 11 insertions, 11 deletions
diff --git a/compress_files b/compress_files
index 9dcbddc..d95000e 100755
--- a/compress_files
+++ b/compress_files
@@ -145,22 +145,22 @@ foreach (keys %hardlinks) {
}
# Fix up symlinks that were pointing to the uncompressed files.
-my $FIND;
-open($FIND, "find $buildroot -type l |");
-while (<$FIND>) {
- local $_ = $_;
- chomp;
- my ($directory) = m!(.*)/!;
+my $link_function = sub {
+ # skip everything but symlinks
+ return unless -l $_;
+ # skip non-dangling symlinks
my $linkval = readlink($_);
- if (! -e "$directory/$linkval" && -e "$directory/$linkval$ext") {
+ return if -e "$File::Find::dir/$linkval";
+
+ if (-e "$File::Find::dir/$linkval$ext") {
unlink $_;
symlink "$linkval$ext", "$_$ext";
- } elsif (! -e "$directory/$linkval" && ! -e "$directory/$linkval$ext" && $directory =~ m|man/|) {
- #Bad link go on nowhere (any better idea) ?
+ } elsif ($File::Find::dir =~ m|man/|) {
+ # Bad link go on nowhere (any better idea) ?
unlink $_;
}
-
-}
+};
+find($link_function, $buildroot);
# Run a command that may have a huge number of arguments, like xargs does.
# Pass in a reference to an array containing the arguments, and then other