summaryrefslogtreecommitdiffstats
path: root/meta/files
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2015-09-27 23:58:37 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-01 07:43:32 +0100
commitc275627212ffc3c60688cefe7e6652fb76db1756 (patch)
treecbb2792b8496d241ca44e501688629b9d83787f6 /meta/files
parent434665d9334d739e3b8177bdaee83a5b28d6670f (diff)
downloadpoky-c275627212ffc3c60688cefe7e6652fb76db1756.tar.gz
toolchain-shar-relocate.sh: make it faster
Make the extrating faster by: * Merge the two heavy "for .. find" loops into one * Move the commands out of for loop rather than inside, this can reduce the forking amount. As a result, when install: * buildtools-nativesdk-standalone: 14s -> 7s (50% saved) * core-image-minimal-core2-64-toolchain: 56s -> 47s (17% saved) [YOCTO #8404] (From OE-Core rev: a619f8e5fd8b88278d41a3d82aca5a8d03cb2907) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/files')
-rw-r--r--meta/files/toolchain-shar-relocate.sh24
1 files changed, 10 insertions, 14 deletions
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index dfb8e16d7c..4ef2927171 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -26,25 +26,21 @@ if [ $relocate = 1 ] ; then
26 fi 26 fi
27fi 27fi
28 28
29# replace @SDKPATH@ with the new prefix in all text files: configs/scripts/etc 29# replace @SDKPATH@ with the new prefix in all text files: configs/scripts/etc.
30# replace the host perl with SDK perl.
30for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do 31for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do
31 $SUDO_EXEC find $replace -type f -exec file '{}' \; | \ 32 $SUDO_EXEC find $replace -type f
32 grep ":.*\(ASCII\|script\|source\).*text" | \ 33done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \
33 awk -F':' '{printf "\"%s\"\n", $1}' | \ 34 awk -F':' '{printf "\"%s\"\n", $1}' | \
34 grep -v "$target_sdk_dir/environment-setup-*" | \ 35 grep -v "$target_sdk_dir/environment-setup-*" | \
35 $SUDO_EXEC xargs -n32 sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" 36 xargs -n100 $SUDO_EXEC sed -i \
36done 37 -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" \
38 -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \
39 -e "s: /usr/bin/perl: /usr/bin/env perl:g"
37 40
38# change all symlinks pointing to @SDKPATH@ 41# change all symlinks pointing to @SDKPATH@
39for l in $($SUDO_EXEC find $native_sysroot -type l); do 42for l in $($SUDO_EXEC find $native_sysroot -type l); do
40 $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l 43 $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l
41done 44done
42 45
43# find out all perl scripts in $native_sysroot and modify them replacing the
44# host perl with SDK perl.
45for perl_script in $($SUDO_EXEC find $native_sysroot -type f -exec grep -l "^#!.*perl" '{}' \;); do
46 $SUDO_EXEC sed -i -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" -e \
47 "s: /usr/bin/perl: /usr/bin/env perl:g" $perl_script
48done
49
50echo done 46echo done