diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2012-01-09 16:15:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2012-01-09 16:15:23 +0000 |
commit | 4614526551b8fe9ac885e727ad1f3f51aa460708 (patch) | |
tree | 3e7ca49aca9c61f6e22110ad7815cc75616c4f68 | |
parent | e018c851f4cd09b392b93515e18e132ebb63d632 (diff) |
More efficient method of building the symlink tree that makes better
use of awk. Slightly faster and works around an apparent namei or
buffer cache related bug on arm. Requested and OK deraadt@
-rw-r--r-- | gnu/usr.bin/perl/Configure | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/gnu/usr.bin/perl/Configure b/gnu/usr.bin/perl/Configure index 653b259d65a..b96a95df810 100644 --- a/gnu/usr.bin/perl/Configure +++ b/gnu/usr.bin/perl/Configure @@ -2724,33 +2724,22 @@ $define|true|[yY]*) *) case "$lns:$issymlink" in *"ln"*" -s:"*"test -"?) echo "Creating the symbolic links..." >&4 - echo "(First creating the subdirectories...)" >&4 cd .. - awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do - read directory - test -z "$directory" && break - mkdir -p $directory - done + awk -v src="$src" '{ + dir=$1; + if (!sub(/\/[^\/]*$/, "", dir)) { dir = "." } + mf[dir] = mf[dir]" "src"/"$1; + } END { + for (d in mf) { + if (d != ".") { system("mkdir -p "d) } + system("ln -sf "mf[d]" "d); + } + }' $src/MANIFEST # Sanity check 1. if test ! -d t/base; then echo "Failed to create the subdirectories. Aborting." >&4 exit 1 fi - echo "(Then creating the symlinks...)" >&4 - awk '{print $1}' $src/MANIFEST | while true; do - read filename - test -z "$filename" && break - if test -f $filename; then - if $issymlink $filename; then - rm -f $filename - fi - fi - if test -f $filename; then - echo "$filename already exists, not symlinking." - else - ln -s $src/$filename $filename - fi - done # Sanity check 2. if test ! -f t/base/lex.t; then echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4 |