Skip to contentSkip to conversation

meta-toolchain-arago: Allow relocate script to hard code SDK_PATH value

PATCH In review Franklin S. Cooper Jr 2 participants 5 messages May 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta-toolchain-arago: Allow relocate script to hard code SDK_PATH value

* SDK_PATH was previously dynamically determined by using BASHISMS when environment-setup was sourced.
* Relocate_sdk.py is required to be ran and the script knows the location of the toolchain SDK.
* By having the relocate_sdk script set SDK_PATH we remove the need for bashisms from environment-setup.

---
 .../meta/meta-toolchain-arago-tisdk.bb             |    2 +-
 .../recipes-core/meta/meta-toolchain-arago-qte.bb  |    2 +-
 .../recipes-core/meta/meta-toolchain-arago.bb      |   17 +++++------------
 3 files changed, 7 insertions(+), 14 deletions(-)
meta-arago-distro/recipes-core/meta/meta-toolchain-arago-tisdk.bb +1 -1
index 114ae1c..68df1bf 100644
@@ -4,7 +4,7 @@ TOOLCHAIN_CLEANUP_PACKAGES ?= "libgnutls-dev libgnutls-extra26 libgnutls-openssl
 
 require recipes-core/meta/meta-toolchain-arago-qte.bb
 
-PR = "r2"
+PR = "r3"
 
 toolchain_create_sdk_env_script_append() {
     echo -e 'export PS1="\[\\e[32;1m\][linux-devkit]\[\\e[0m\]:\w> "' >> $script
meta-arago-extras/recipes-core/meta/meta-toolchain-arago-qte.bb +1 -1
index 136ebca..207df4f 100644
@@ -5,7 +5,7 @@ TOOLCHAIN_SUFFIX ?= "-qte-sdk"
 
 require meta-toolchain-arago.bb
 
-PR = "r13"
+PR = "r14"
 
 QT_DIR_NAME = "qtopia"
 
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +5 -12
index 699ada7..7f70c42 100644
@@ -7,7 +7,7 @@ TOOLCHAIN_CLEANUP_PACKAGES ?= ""
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r23"
+PR = "r24"
 
 # This function creates an environment-setup-script for use in a deployable SDK
 toolchain_create_sdk_env_script () {
@@ -15,17 +15,7 @@ toolchain_create_sdk_env_script () {
 	script=${SDK_OUTPUT}/${SDKPATH}/environment-setup
 	rm -f $script
 	touch $script
-	echo 'SDK_PATH="${SDKPATH}"' >> $script
-	echo 'if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./environment-setup" ]; then' >> $script
-	echo '    echo "Error: This script needs to be sourced. Please run as \". ./environment-setup\""' >> $script
-	echo '    exit 1' >> $script
-	echo 'else' >> $script
-	echo '    if [ -n "$BASH_SOURCE" ]; then' >> $script
-	echo '        SDK_PATH="`dirname $BASH_SOURCE`"' >> $script
-	echo '    fi' >> $script
-	echo '    SDK_PATH=`readlink -f "$SDK_PATH"`' >> $script
-	echo '    export SDK_PATH' >> $script
-	echo 'fi' >> $script
+	echo 'export SDK_PATH="${SDKPATH}"' >> $script
 	echo 'export SDK_SYS=${SDK_SYS}' >> $script
 	echo 'export TARGET_SYS=${REAL_MULTIMACH_TARGET_SYS}' >> $script
 	echo 'export TOOLCHAIN_SYS=${TOOLCHAIN_SYS}' >> $script
@@ -234,6 +224,9 @@ for env_setup_script in `ls $target_sdk_dir/environment-setup*`; do
 	$SUDO_EXEC sed -e "s:$TMPSDKPATH:$target_sdk_dir:g" -i $env_setup_script
 done
 
+# Correct SDK_PATH since the exact installation path is now known
+$SUDO_EXEC sed -i -e "s|export SDK_PATH\=.*|export SDK_PATH=$target_sdk_dir|g" $target_sdk_dir/environment-setup*
+
 # fix dynamic loader paths in all ELF SDK binaries
 native_sysroot=$target_sdk_dir/sysroots/${SDK_SYS}
 dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*")
Signature · 1 line
1.7.0.4
#1 lore raw

Franklin,

Well, I think I already used up all my weekly quota for reviewing patches yesterday... :) But, Ok.

Quoted 2 lines

* SDK_PATH was previously dynamically determined by using BASHISMS when environment-setup was sourced.

But there was still a known good fallback for when not run under bash.

Quoted 4 lines

* Relocate_sdk.py is required to be ran and the script knows the location of the toolchain SDK.
* By having the relocate_sdk script set SDK_PATH we remove the need for bashisms from environment-setup.

It is already doing that, no need to change it.

Quoted 14 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -1
index 699ada7..7f70c42 100644
@@ -7,7 +7,7 @@ TOOLCHAIN_CLEANUP_PACKAGES ?= ""
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r23"
+PR = "r24"
 
 # This function creates an environment-setup-script for use in a deployable SDK
 toolchain_create_sdk_env_script () {

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 21

Quoted 7 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -4
@@ -15,17 +15,7 @@ toolchain_create_sdk_env_script () {
 	script=${SDK_OUTPUT}/${SDKPATH}/environment-setup
 	rm -f $script
 	touch $script
-	echo 'SDK_PATH="${SDKPATH}"' >> $script
-	echo 'if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./environment-setup" ]; then' >> $script
-	echo '    echo "Error: This script needs to be sourced. Please run as \". ./environment-setup\""' >> $script
-	echo '    exit 1' >> $script

This portion above may stay - it's a nice safeguard. And there's nothing bashisms about it.

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 25

Quoted 4 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -4
-	echo 'else' >> $script
-	echo '    if [ -n "$BASH_SOURCE" ]; then' >> $script
-	echo '        SDK_PATH="`dirname $BASH_SOURCE`"' >> $script
-	echo '    fi' >> $script

I can see potentially removing this portion, since devkit is not relocatable on its own w/o re-installing it in a different location. BTW, this is the only bash-related piece of code here, it just uses bash-specific env variable. If not run under bash, it will safely skip it, so it's not really a bashism.

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 28

Quoted 3 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -3
-	echo '    SDK_PATH=`readlink -f "$SDK_PATH"`' >> $script
-	echo '    export SDK_PATH' >> $script
-	echo 'fi' >> $script

And this portion is another nice safeguard - in case you install it in a location that is a symlink.

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls $target_sdk_dir/environment-setup*`; do · line 228

Quoted 10 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +3 -0
+	echo 'export SDK_PATH="${SDKPATH}"' >> $script
 	echo 'export SDK_SYS=${SDK_SYS}' >> $script
 	echo 'export TARGET_SYS=${REAL_MULTIMACH_TARGET_SYS}' >> $script
 	echo 'export TOOLCHAIN_SYS=${TOOLCHAIN_SYS}' >> $script
@@ -234,6 +224,9 @@ for env_setup_script in `ls $target_sdk_dir/environment-setup*`; do
 	$SUDO_EXEC sed -e "s:$TMPSDKPATH:$target_sdk_dir:g" -i $env_setup_script
 done
 
+# Correct SDK_PATH since the exact installation path is now known
+$SUDO_EXEC sed -i -e "s|export SDK_PATH\=.*|export SDK_PATH=$target_sdk_dir|g" $target_sdk_dir/environment-setup*

Why do you need this line? It's already happening anyway.

Signature · 1 line
Denys
#2 lore raw
Quoted 54 lines

-----Original Message-----
From: Dmytriyenko, Denys
Sent: Wednesday, May 08, 2013 8:59 AM
To: Cooper Jr., Franklin
Cc: [email protected]
Subject: Re: [meta-arago] [PATCH] meta-toolchain-arago: Allow relocate script to hard code SDK_PATH value

Franklin,

Well, I think I already used up all my weekly quota for reviewing patches yesterday... :) But, Ok.

Quoted 1 line

* SDK_PATH was previously dynamically determined by using BASHISMS

when

Quoted 1 line

environment-setup was sourced.

But there was still a known good fallback for when not run under bash.

Quoted 1 line

* Relocate_sdk.py is required to be ran and the script knows the location of

the

Quoted 3 lines

toolchain SDK.
* By having the relocate_sdk script set SDK_PATH we remove the need for bashisms from environment-setup.

It is already doing that, no need to change it.

Review

Quoted 1 line
(quoted diff) +0 -0

b/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb TOOLCHAIN_CLEANUP_PACKAGES ?= "" · line 12

Quoted 11 lines

index 699ada7..7f70c42 100644

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -1
@@ -7,7 +7,7 @@ TOOLCHAIN_CLEANUP_PACKAGES ?= ""
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r23"
+PR = "r24"
 
 # This function creates an environment-setup-script for use in a deployable

SDK

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 19

Quoted 7 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -2
 toolchain_create_sdk_env_script () {
@@ -15,17 +15,7 @@ toolchain_create_sdk_env_script () {
 	script=${SDK_OUTPUT}/${SDKPATH}/environment-setup
 	rm -f $script
 	touch $script
-	echo 'SDK_PATH="${SDKPATH}"' >> $script
-	echo 'if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./environment-setup" ];

then' >> $script

Quoted 6 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 20

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -1
-	echo '    echo "Error: This script needs to be sourced. Please run as \".

./environment-setup\""' >> $script

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 21

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -1
-	echo '    exit 1' >> $script

This portion above may stay - it's a nice safeguard. And there's nothing bashisms about it.

Your right. I must of gotten delete happy :).

Quoted 11 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 25

Quoted 6 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -4
-	echo 'else' >> $script
-	echo '    if [ -n "$BASH_SOURCE" ]; then' >> $script
-	echo '        SDK_PATH="`dirname $BASH_SOURCE`"' >> $script
-	echo '    fi' >> $script

I can see potentially removing this portion, since devkit is not relocatable on its own w/o re-installing it in a different location. BTW, this is the only bash-related piece of code here, it just uses bash-specific env variable. If not run under bash, it will safely skip it, so it's not really a bashism.

True but the SDK_PATH would not be the correct value.
Current value of SDK_PATH:
SDK_PATH=/tmp/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..../yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy...../

So although no error will be shown the remaining code and variables will be using the incorrect SDK_PATH which results in a lot of issues.

Quoted 8 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 28

Quoted 5 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -3
-	echo '    SDK_PATH=`readlink -f "$SDK_PATH"`' >> $script
-	echo '    export SDK_PATH' >> $script
-	echo 'fi' >> $script

And this portion is another nice safeguard - in case you install it in a location that is a symlink.

That makes sense. This can stay also.

Quoted 10 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () {

Quoted 5 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -0
+	echo 'export SDK_PATH="${SDKPATH}"' >> $script
 	echo 'export SDK_SYS=${SDK_SYS}' >> $script
 	echo 'export TARGET_SYS=${REAL_MULTIMACH_TARGET_SYS}' >>

$script

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls

Quoted 2 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -0
 	echo 'export TOOLCHAIN_SYS=${TOOLCHAIN_SYS}' >> $script
@@ -234,6 +224,9 @@ for env_setup_script in `ls

$target_sdk_dir/environment-setup*`; do

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls · line 224

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -0
 	$SUDO_EXEC sed -e "s:$TMPSDKPATH:$target_sdk_dir:g" -i
Quoted 8 lines

$env_setup_script

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls $target_sdk_dir/environment-setup*`; do

Quoted 4 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +2 -0
 done
 
+# Correct SDK_PATH since the exact installation path is now known
+$SUDO_EXEC sed -i -e "s|export SDK_PATH\=.*|export

SDK_PATH=$target_sdk_dir|g" $target_sdk_dir/environment-setup*

Why do you need this line? It's already happening anyway.

The only way we get the proper value for SDK_PATH is if the following is executed.

       SDK_PATH="`dirname $BASH_SOURCE`"' >> $script

Since I want to remove that logic the above is required. Although the sed statement would change slightly since "SDK_PATH=" will need to be modified instead of "export SDK_PATH=" since I won't be removing a lot of the safe guard logic.

Quoted 3 lines

--
Denys

#3 lore raw
Quoted 73 lines · Franklin
Quoted 54 lines

-----Original Message-----
From: Dmytriyenko, Denys
Sent: Wednesday, May 08, 2013 8:59 AM
To: Cooper Jr., Franklin
Cc: [email protected]
Subject: Re: [meta-arago] [PATCH] meta-toolchain-arago: Allow relocate script to hard code SDK_PATH value

Franklin,

Well, I think I already used up all my weekly quota for reviewing patches yesterday... :) But, Ok.

Quoted 1 line

* SDK_PATH was previously dynamically determined by using BASHISMS

when

Quoted 1 line

environment-setup was sourced.

But there was still a known good fallback for when not run under bash.

Quoted 1 line

* Relocate_sdk.py is required to be ran and the script knows the location of

the

Quoted 3 lines

toolchain SDK.
* By having the relocate_sdk script set SDK_PATH we remove the need for bashisms from environment-setup.

It is already doing that, no need to change it.

Review

Quoted 1 line
(quoted diff) +0 -0

b/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb TOOLCHAIN_CLEANUP_PACKAGES ?= "" · line 12

Quoted 11 lines

index 699ada7..7f70c42 100644

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -1
@@ -7,7 +7,7 @@ TOOLCHAIN_CLEANUP_PACKAGES ?= ""
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r23"
+PR = "r24"
 
 # This function creates an environment-setup-script for use in a deployable

SDK

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 19

Quoted 7 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -2
 toolchain_create_sdk_env_script () {
@@ -15,17 +15,7 @@ toolchain_create_sdk_env_script () {
 	script=${SDK_OUTPUT}/${SDKPATH}/environment-setup
 	rm -f $script
 	touch $script
-	echo 'SDK_PATH="${SDKPATH}"' >> $script
-	echo 'if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./environment-setup" ];

then' >> $script

Quoted 6 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 20

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -1
-	echo '    echo "Error: This script needs to be sourced. Please run as \".

./environment-setup\""' >> $script

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 21

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -1
-	echo '    exit 1' >> $script

This portion above may stay - it's a nice safeguard. And there's nothing bashisms about it.

Your right. I must of gotten delete happy :).

Quoted 11 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 25

Quoted 6 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -4
-	echo 'else' >> $script
-	echo '    if [ -n "$BASH_SOURCE" ]; then' >> $script
-	echo '        SDK_PATH="`dirname $BASH_SOURCE`"' >> $script
-	echo '    fi' >> $script

I can see potentially removing this portion, since devkit is not relocatable on its own w/o re-installing it in a different location. BTW, this is the only bash-related piece of code here, it just uses bash-specific env variable. If not run under bash, it will safely skip it, so it's not really a bashism.

Quoted 6 lines

True but the SDK_PATH would not be the correct value.
Current value of SDK_PATH:
SDK_PATH=/tmp/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..../yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy...../

So although no error will be shown the remaining code and variables will be using the incorrect SDK_PATH which results in a lot of issues.

Nope, it will be updated to the correct install path by relocate_sdk.py, as I already have the necessary sed line in there - your host-setup script was just messing with it... That is what happens when you have too many "smart" scripts :) JK

Try it yourself - grab a linux-devkit.sh and install it manually in /tmp, see what SDK_PATH in environment-setup is. Don't run any other host-setup scripts to update environment-setup any further.

Quoted 20 lines
Quoted 6 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 28

Quoted 3 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -3
-	echo '    SDK_PATH=`readlink -f "$SDK_PATH"`' >> $script
-	echo '    export SDK_PATH' >> $script
-	echo 'fi' >> $script

And this portion is another nice safeguard - in case you install it in a location that is a symlink.

That makes sense. This can stay also.

Quoted 13 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () {

Quoted 5 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -0
+	echo 'export SDK_PATH="${SDKPATH}"' >> $script
 	echo 'export SDK_SYS=${SDK_SYS}' >> $script
 	echo 'export TARGET_SYS=${REAL_MULTIMACH_TARGET_SYS}' >>

$script

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls

Quoted 2 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -0
 	echo 'export TOOLCHAIN_SYS=${TOOLCHAIN_SYS}' >> $script
@@ -234,6 +224,9 @@ for env_setup_script in `ls

$target_sdk_dir/environment-setup*`; do

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls · line 224

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -0
 	$SUDO_EXEC sed -e "s:$TMPSDKPATH:$target_sdk_dir:g" -i

$env_setup_script

Quoted 2 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -0
 done
 
Quoted 7 lines
Quoted 5 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb for env_setup_script in `ls · line 228

Quoted 2 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +2 -0
+# Correct SDK_PATH since the exact installation path is now known
+$SUDO_EXEC sed -i -e "s|export SDK_PATH\=.*|export

SDK_PATH=$target_sdk_dir|g" $target_sdk_dir/environment-setup*

Why do you need this line? It's already happening anyway.

The only way we get the proper value for SDK_PATH is if the following is executed.

       SDK_PATH="`dirname $BASH_SOURCE`"' >> $script

Even w/o this code, SDK_PATH is set to the final installation location in the first line of the script.

Quoted 4 lines

Since I want to remove that logic the above is required. Although the sed statement would change slightly since "SDK_PATH=" will need to be modified instead of "export SDK_PATH=" since I won't be removing a lot of the safe guard logic.

Again, no changes are required. And the sed line I already have there for updating SDK_PATH doesn't care about "export" portion.

Signature · 1 line
Denys
#4 lore raw
Quoted 139 lines

-----Original Message-----
From: Dmytriyenko, Denys
Sent: Wednesday, May 08, 2013 9:21 AM
To: Cooper Jr., Franklin
Cc: [email protected]
Subject: Re: [meta-arago] [PATCH] meta-toolchain-arago: Allow relocate script to hard code SDK_PATH value

Quoted 57 lines · Franklin
Quoted 57 lines

-----Original Message-----
From: Dmytriyenko, Denys
Sent: Wednesday, May 08, 2013 8:59 AM
To: Cooper Jr., Franklin
Cc: [email protected]
Subject: Re: [meta-arago] [PATCH] meta-toolchain-arago: Allow relocate script to hard code SDK_PATH value

Franklin,

Well, I think I already used up all my weekly quota for reviewing patches yesterday... :) But, Ok.

Quoted 1 line

* SDK_PATH was previously dynamically determined by using BASHISMS

when

Quoted 1 line

environment-setup was sourced.

But there was still a known good fallback for when not run under bash.

Quoted 2 lines

* Relocate_sdk.py is required to be ran and the script knows the location of

the

Quoted 3 lines

toolchain SDK.
* By having the relocate_sdk script set SDK_PATH we remove the need for bashisms from environment-setup.

It is already doing that, no need to change it.

Quoted 2 lines

diff --git a/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb

b/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb

Quoted 11 lines

index 699ada7..7f70c42 100644

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -1
@@ -7,7 +7,7 @@ TOOLCHAIN_CLEANUP_PACKAGES ?= ""
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r23"
+PR = "r24"
 
 # This function creates an environment-setup-script for use in a
Quoted 1 line

deployable

SDK

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () {

Quoted 7 lines

toolchain_create_sdk_env_script () { @@ -15,17 +15,7 @@
toolchain_create_sdk_env_script () {

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -2
 	script=${SDK_OUTPUT}/${SDKPATH}/environment-setup
 	rm -f $script
 	touch $script
-	echo 'SDK_PATH="${SDKPATH}"' >> $script
-	echo 'if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./environment-setup" ];

then' >> $script

Quoted 19 lines
Quoted 6 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -1
-	echo '    echo "Error: This script needs to be sourced. Please run as \".

./environment-setup\""' >> $script

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 21

Quoted 1 line
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -1
-	echo '    exit 1' >> $script

This portion above may stay - it's a nice safeguard. And there's nothing bashisms about it.

Your right. I must of gotten delete happy :).

Quoted 11 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 25

Quoted 6 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -4
-	echo 'else' >> $script
-	echo '    if [ -n "$BASH_SOURCE" ]; then' >> $script
-	echo '        SDK_PATH="`dirname $BASH_SOURCE`"' >> $script
-	echo '    fi' >> $script

I can see potentially removing this portion, since devkit is not relocatable on its own w/o re-installing it in a different location. BTW, this is the only bash-related piece of code here, it just uses bash-specific env variable. If not run under bash, it will safely skip it, so it's

not really a bashism.

Quoted 7 lines

True but the SDK_PATH would not be the correct value. Current value of SDK_PATH:
SDK_PATH=/tmp/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..../ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy...../

So although no error will be shown the remaining code and variables will be using the incorrect SDK_PATH which results in a lot of issues.

Nope, it will be updated to the correct install path by relocate_sdk.py, as I already have the necessary sed line in there - your host-setup script was just messing with it... That is what happens when you have too many "smart" scripts :) JK

Try it yourself - grab a linux-devkit.sh and install it manually in /tmp, see what SDK_PATH in environment-setup is. Don't run any other host-setup scripts to update environment-setup any further.

Quoted 18 lines
Quoted 6 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () { · line 28

Quoted 3 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +0 -3
-	echo '    SDK_PATH=`readlink -f "$SDK_PATH"`' >> $script
-	echo '    export SDK_PATH' >> $script
-	echo 'fi' >> $script

And this portion is another nice safeguard - in case you install it in a location that is a symlink.

That makes sense. This can stay also.

Quoted 11 lines

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb toolchain_create_sdk_env_script () {

Quoted 5 lines
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +1 -0
+	echo 'export SDK_PATH="${SDKPATH}"' >> $script
 	echo 'export SDK_SYS=${SDK_SYS}' >> $script
 	echo 'export TARGET_SYS=${REAL_MULTIMACH_TARGET_SYS}' >>

$script

Quoted 2 lines

echo 'export TOOLCHAIN_SYS=${TOOLCHAIN_SYS}' >> $script @@
-234,6 +224,9 @@ for env_setup_script in `ls

$target_sdk_dir/environment-setup*`; do

Quoted 1 line

$SUDO_EXEC sed -e "s:$TMPSDKPATH:$target_sdk_dir:g" -i

$env_setup_script

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

done

+# Correct SDK_PATH since the exact installation path is now known +$SUDO_EXEC sed -i -e "s|export SDK_PATH\=.*|export

SDK_PATH=$target_sdk_dir|g" $target_sdk_dir/environment-setup*

Why do you need this line? It's already happening anyway.

The only way we get the proper value for SDK_PATH is if the following is

executed.

Quoted 1 line
       SDK_PATH="`dirname $BASH_SOURCE`"' >> $script

Even w/o this code, SDK_PATH is set to the final installation location in the first line of the script.

Quoted 7 lines
Quoted 4 lines

Since I want to remove that logic the above is required. Although the sed statement would change slightly since "SDK_PATH=" will need to be modified instead of "export SDK_PATH=" since I won't be removing a lot of the safe guard logic.

Again, no changes are required. And the sed line I already have there for updating SDK_PATH doesn't care about "export" portion.

Quick test shows that your right. So is there any reason not to remove SDK_PATH="dirname $BASH_SOURCE"' >> $script? At the very least since it serves no purpose even if it doesn't harm anything.

Quoted 3 lines

--
Denys