All of lore.kernel.org
 help / color / mirror / Atom feed
* Extensible SDK install patch fixes
@ 2015-08-19 13:32 brendan.le.foll
  2015-08-19 13:32 ` [PATCH 1/3] toolchain-shar-extract.sh: ensure extensible SDK install path obeys restrictions brendan.le.foll
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: brendan.le.foll @ 2015-08-19 13:32 UTC (permalink / raw)
  To: openembedded-core

This makes the default SDK install path a bit more usable and fixes YP Bug 6744
- https://bugzilla.yoctoproject.org/show_bug.cgi?id=6744 by validating
  submitted paths do not contain ' @+'



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] toolchain-shar-extract.sh: ensure extensible SDK install path obeys restrictions
  2015-08-19 13:32 Extensible SDK install patch fixes brendan.le.foll
@ 2015-08-19 13:32 ` brendan.le.foll
  2015-08-19 13:32 ` [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK brendan.le.foll
  2015-08-19 13:32 ` [PATCH 3/3] toolchain-shar-extract.sh: explain why we cannot use sudo in " brendan.le.foll
  2 siblings, 0 replies; 8+ messages in thread
From: brendan.le.foll @ 2015-08-19 13:32 UTC (permalink / raw)
  To: openembedded-core

From: Brendan Le Foll <brendan.le.foll@intel.com>

There are some characters that cannot appear in the installation path, so we
need to check for these

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
---
 meta/files/toolchain-shar-extract.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 0a33ee8..6984e11 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -85,9 +85,12 @@ else
 	target_sdk_dir=$(readlink -m "$target_sdk_dir")
 fi
 
-if [ -n "$(echo $target_sdk_dir|grep ' ')" ]; then
-	echo "The target directory path ($target_sdk_dir) contains spaces. Abort!"
-	exit 1
+if [ "$SDK_EXTENSIBLE" = "1" ]; then
+	if [[ "$target_sdk_dir" =~ [+\ @] ]]; then
+		echo "The target directory path ($target_sdk_dir) contains illegal" \
+		     "characters such as spaces, @ or +. Abort!"
+		exit 1
+	fi
 fi
 
 if [ -e "$target_sdk_dir/environment-setup-@REAL_MULTIMACH_TARGET_SYS@" ]; then
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK
  2015-08-19 13:32 Extensible SDK install patch fixes brendan.le.foll
  2015-08-19 13:32 ` [PATCH 1/3] toolchain-shar-extract.sh: ensure extensible SDK install path obeys restrictions brendan.le.foll
@ 2015-08-19 13:32 ` brendan.le.foll
  2015-08-19 17:52   ` Christopher Larson
  2015-08-19 13:32 ` [PATCH 3/3] toolchain-shar-extract.sh: explain why we cannot use sudo in " brendan.le.foll
  2 siblings, 1 reply; 8+ messages in thread
From: brendan.le.foll @ 2015-08-19 13:32 UTC (permalink / raw)
  To: openembedded-core

From: Brendan Le Foll <brendan.le.foll@intel.com>

Extensible SDK cannot be installed as root so by default offer to install it in
user's home directory under distro/distro_version replacing the normal SDK
version '+' char with a '_' as that's a restricted character for bitbake

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
---
 meta/files/toolchain-shar-extract.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 6984e11..c4c2a70 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -73,6 +73,19 @@ fi
 
 @SDK_PRE_INSTALL_COMMAND@
 
+# SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above
+if [ "$SDK_EXTENSIBLE" = "1" ]; then
+        if [ ! -w "$DEFAULT_INSTALL_DIR" ]; then
+		# if we can't write to dir then make a new default in /home/$(whoami)
+		# replace any illegal chars with a sensible one
+		DEFAULT_INSTALL_DIR="~/$(echo "@SDK_TITLE@" | cut -d " " -f1)/$(echo $(basename $DEFAULT_INSTALL_DIR) | tr "+ @" _)"
+		# reset target_sdk_dir in case of answer="Y"
+		if [ "$answer" = "Y" ]; then
+			target_sdk_dir="$DEFAULT_INSTALL_DIR"
+		fi
+	fi
+fi
+
 if [ "$target_sdk_dir" = "" ]; then
 	read -e -p "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): " target_sdk_dir
 	[ "$target_sdk_dir" = "" ] && target_sdk_dir=$DEFAULT_INSTALL_DIR
@@ -149,7 +162,7 @@ echo "done"
 printf "Setting it up..."
 # fix environment paths
 for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do
-	$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script
+	$SUDO_EXEC sed -e "s:@SDKPATH@:$target_sdk_dir:g" -i $env_setup_script
 done
 
 @SDK_POST_INSTALL_COMMAND@
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] toolchain-shar-extract.sh: explain why we cannot use sudo in extensible SDK
  2015-08-19 13:32 Extensible SDK install patch fixes brendan.le.foll
  2015-08-19 13:32 ` [PATCH 1/3] toolchain-shar-extract.sh: ensure extensible SDK install path obeys restrictions brendan.le.foll
  2015-08-19 13:32 ` [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK brendan.le.foll
@ 2015-08-19 13:32 ` brendan.le.foll
  2015-08-20 19:30   ` Randy Witt
  2 siblings, 1 reply; 8+ messages in thread
From: brendan.le.foll @ 2015-08-19 13:32 UTC (permalink / raw)
  To: openembedded-core

From: Brendan Le Foll <brendan.le.foll@intel.com>

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
---
 meta/files/toolchain-shar-extract.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index c4c2a70..d8e714a 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -135,7 +135,7 @@ mkdir -p $target_sdk_dir >/dev/null 2>&1
 # if don't have the right to access dir, gain by sudo 
 if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; then 
 	if [ "$SDK_EXTENSIBLE" = "1" ]; then
-		echo "Unable to access \"$target_sdk_dir\"."
+		echo "Unable to access \"$target_sdk_dir\", can\'t install extensible SDK as root."
 		exit 1
 	fi
 
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK
  2015-08-19 13:32 ` [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK brendan.le.foll
@ 2015-08-19 17:52   ` Christopher Larson
  2015-08-20  7:34     ` Brendan Le Foll
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher Larson @ 2015-08-19 17:52 UTC (permalink / raw)
  To: brendan.le.foll; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On Wed, Aug 19, 2015 at 6:32 AM, <brendan.le.foll@intel.com> wrote:

> From: Brendan Le Foll <brendan.le.foll@intel.com>
>
> Extensible SDK cannot be installed as root so by default offer to install
> it in
> user's home directory under distro/distro_version replacing the normal SDK
> version '+' char with a '_' as that's a restricted character for bitbake
>
> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
>

Why not use a metadata variable for the default, replacing with @@ as with
the other metadata variables, rather than hardcoding the default in the .sh
where it can't be easily overridden by the distro or user?
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1370 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK
  2015-08-19 17:52   ` Christopher Larson
@ 2015-08-20  7:34     ` Brendan Le Foll
  2015-08-20 16:47       ` Christopher Larson
  0 siblings, 1 reply; 8+ messages in thread
From: Brendan Le Foll @ 2015-08-20  7:34 UTC (permalink / raw)
  To: Christopher Larson; +Cc: Patches and discussions about the oe-core layer

On Wed, Aug 19, 2015 at 06:52:49PM +0100, Christopher Larson wrote:
>    On Wed, Aug 19, 2015 at 6:32 AM, <[1]brendan.le.foll@intel.com> wrote:
> 
>    From: Brendan Le Foll <[2]brendan.le.foll@intel.com>
>    Extensible SDK cannot be installed as root so by default offer to
>    install it in
>    user's home directory under distro/distro_version replacing the normal
>    SDK
>    version '+' char with a '_' as that's a restricted character for
>    bitbake
>    Signed-off-by: Brendan Le Foll <[3]brendan.le.foll@intel.com>
> 
>    Why not use a metadata variable for the default, replacing with @@ as
>    with the other metadata variables, rather than hardcoding the default
>    in the .sh where it can't be easily overridden by the distro or user?

'~' seemed like a good option for all SDKs/distros seemed like a
decent 'default' to me and the rest is fairly customisable with
SDK_TITLE which has to be set anyways. Or do you mean a different var?

Thanks,
Brendan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK
  2015-08-20  7:34     ` Brendan Le Foll
@ 2015-08-20 16:47       ` Christopher Larson
  0 siblings, 0 replies; 8+ messages in thread
From: Christopher Larson @ 2015-08-20 16:47 UTC (permalink / raw)
  To: Brendan Le Foll; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

On Thu, Aug 20, 2015 at 12:34 AM, Brendan Le Foll <brendan.le.foll@intel.com
> wrote:

> On Wed, Aug 19, 2015 at 06:52:49PM +0100, Christopher Larson wrote:
> >    On Wed, Aug 19, 2015 at 6:32 AM, <[1]brendan.le.foll@intel.com>
> wrote:
> >
> >    From: Brendan Le Foll <[2]brendan.le.foll@intel.com>
> >    Extensible SDK cannot be installed as root so by default offer to
> >    install it in
> >    user's home directory under distro/distro_version replacing the normal
> >    SDK
> >    version '+' char with a '_' as that's a restricted character for
> >    bitbake
> >    Signed-off-by: Brendan Le Foll <[3]brendan.le.foll@intel.com>
> >
> >    Why not use a metadata variable for the default, replacing with @@ as
> >    with the other metadata variables, rather than hardcoding the default
> >    in the .sh where it can't be easily overridden by the distro or user?
>
> '~' seemed like a good option for all SDKs/distros seemed like a
> decent 'default' to me and the rest is fairly customisable with
> SDK_TITLE which has to be set anyways. Or do you mean a different var?
>

I don't really see the point of making something "fairly customizable",
personally, when it's trivial to make it completely customizable by using a
metadata variable, the way we do for nearly everything else.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 2240 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] toolchain-shar-extract.sh: explain why we cannot use sudo in extensible SDK
  2015-08-19 13:32 ` [PATCH 3/3] toolchain-shar-extract.sh: explain why we cannot use sudo in " brendan.le.foll
@ 2015-08-20 19:30   ` Randy Witt
  0 siblings, 0 replies; 8+ messages in thread
From: Randy Witt @ 2015-08-20 19:30 UTC (permalink / raw)
  To: brendan.le.foll, openembedded-core

On 08/19/2015 06:32 AM, brendan.le.foll@intel.com wrote:
> From: Brendan Le Foll <brendan.le.foll@intel.com>
>
> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
> ---
>   meta/files/toolchain-shar-extract.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
> index c4c2a70..d8e714a 100644
> --- a/meta/files/toolchain-shar-extract.sh
> +++ b/meta/files/toolchain-shar-extract.sh
> @@ -135,7 +135,7 @@ mkdir -p $target_sdk_dir >/dev/null 2>&1
>   # if don't have the right to access dir, gain by sudo
>   if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; then
>   	if [ "$SDK_EXTENSIBLE" = "1" ]; then
> -		echo "Unable to access \"$target_sdk_dir\"."
> +		echo "Unable to access \"$target_sdk_dir\", can\'t install extensible SDK as root."

This is a bit unclear since it makes it sound like the user was trying to 
install as root, which would have already failed if that were the case. Perhaps 
wording it as: "Unable to access $dir, will not attempt to install using sudo, 
because the extensible sdk can't be installed as root."

>   		exit 1
>   	fi
>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-20 19:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-19 13:32 Extensible SDK install patch fixes brendan.le.foll
2015-08-19 13:32 ` [PATCH 1/3] toolchain-shar-extract.sh: ensure extensible SDK install path obeys restrictions brendan.le.foll
2015-08-19 13:32 ` [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK brendan.le.foll
2015-08-19 17:52   ` Christopher Larson
2015-08-20  7:34     ` Brendan Le Foll
2015-08-20 16:47       ` Christopher Larson
2015-08-19 13:32 ` [PATCH 3/3] toolchain-shar-extract.sh: explain why we cannot use sudo in " brendan.le.foll
2015-08-20 19:30   ` Randy Witt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.