summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2013-02-12 05:08:22 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-12 13:11:21 +0000
commit7d023f3b5fd2b562fcdde3c991cf49f35263d1ff (patch)
tree516041636d53fa89961448127bb2deab22dae4f3 /meta
parent3eb70c067cf37a63501345a85e417540776e8b1d (diff)
downloadpoky-7d023f3b5fd2b562fcdde3c991cf49f35263d1ff.tar.gz
populate_sdk_base.bbclass: Improve debugging capabilities for SDK installer
After having to debug the SDK installer a few times in addition to the relocation code the following patch was created to improve the capabilities around debugging the SDK installer. 1) Add a verbose mode -D which set a set -x to see what the SDK installer is doing. 2) Add a mode -S to save the relocation scripts for the purpose of debugging them in conjunction with -D 3) Add a mode -R to not execute the relocation scripts for the purpose of debugging the relocations. (From OE-Core rev: 0e6dd19b9736d2a8ae7c0f0ab124337d579b8f06) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/populate_sdk_base.bbclass48
1 files changed, 42 insertions, 6 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index c025d4083c..923f9257a6 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -136,7 +136,10 @@ DEFAULT_INSTALL_DIR="${SDKPATH}"
136SUDO_EXEC="" 136SUDO_EXEC=""
137target_sdk_dir="" 137target_sdk_dir=""
138answer="" 138answer=""
139while getopts ":yd:" OPT; do 139relocate=1
140savescripts=0
141verbose=0
142while getopts ":yd:DRS" OPT; do
140 case $OPT in 143 case $OPT in
141 y) 144 y)
142 answer="Y" 145 answer="Y"
@@ -145,15 +148,33 @@ while getopts ":yd:" OPT; do
145 d) 148 d)
146 target_sdk_dir=$OPTARG 149 target_sdk_dir=$OPTARG
147 ;; 150 ;;
151 D)
152 verbose=1
153 ;;
154 R)
155 relocate=0
156 savescripts=1
157 ;;
158 S)
159 savescripts=1
160 ;;
148 *) 161 *)
149 echo "Usage: $(basename $0) [-y] [-d <dir>]" 162 echo "Usage: $(basename $0) [-y] [-d <dir>]"
150 echo " -y Automatic yes to all prompts" 163 echo " -y Automatic yes to all prompts"
151 echo " -d <dir> Install the SDK to <dir>" 164 echo " -d <dir> Install the SDK to <dir>"
165 echo "======== Advanced DEBUGGING ONLY OPTIONS ========"
166 echo " -S Save relocation scripts"
167 echo " -R Do not relocate executables"
168 echo " -D use set -x to see what is going on"
152 exit 1 169 exit 1
153 ;; 170 ;;
154 esac 171 esac
155done 172done
156 173
174if [ $verbose = 1 ] ; then
175 set -x
176fi
177
157printf "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): " 178printf "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): "
158if [ "$target_sdk_dir" = "" ]; then 179if [ "$target_sdk_dir" = "" ]; then
159 read target_sdk_dir 180 read target_sdk_dir
@@ -231,10 +252,23 @@ if [ "$dl_path" = "" ] ; then
231 exit 1 252 exit 1
232fi 253fi
233executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm +111) 254executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm +111)
234$SUDO_EXEC ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files 255
235if [ $? -ne 0 ]; then 256tdir=`mktemp -d`
236 echo "SDK could not be set up. Relocate script failed. Abort!" 257if [ x$tdir = x ] ; then
237 exit 1 258 echo "SDK relocate failed, could not create a temporary directory"
259 exit 1
260fi
261echo "#!/bin/bash" > $tdir/relocate_sdk.sh
262echo exec ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files >> $tdir/relocate_sdk.sh
263$SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh
264$SUDO_EXEC chmod 755 ${env_setup_script%/*}/relocate_sdk.sh
265rm -rf $tdir
266if [ $relocate = 1 ] ; then
267 $SUDO_EXEC ${env_setup_script%/*}/relocate_sdk.sh
268 if [ $? -ne 0 ]; then
269 echo "SDK could not be set up. Relocate script failed. Abort!"
270 exit 1
271 fi
238fi 272fi
239 273
240# replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc 274# replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc
@@ -249,7 +283,9 @@ echo done
249 283
250# delete the relocating script, so that user is forced to re-run the installer 284# delete the relocating script, so that user is forced to re-run the installer
251# if he/she wants another location for the sdk 285# if he/she wants another location for the sdk
252$SUDO_EXEC rm ${env_setup_script%/*}/relocate_sdk.py 286if [ $savescripts = 0 ] ; then
287 $SUDO_EXEC rm ${env_setup_script%/*}/relocate_sdk.py ${env_setup_script%/*}/relocate_sdk.sh
288fi
253 289
254echo "SDK has been successfully set up and is ready to be used." 290echo "SDK has been successfully set up and is ready to be used."
255 291