Skip to contentSkip to conversation

toolchain-scripts.bbclass: customize prompt string for SDKs

PATCH Superseded kai 3 participants 6 messages Feb 25, 2021 – Feb 26, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

kai

author
#0 lore raw

PATCH v2 1/1 toolchain-scripts.bbclass: customize prompt string for SDKs

From: Kai Kang <[email protected]>

Introduce a new variable SDK_PS1 to customize prompt string for SDKs when source script environment-setup-script.

The default prompt string of SDKs looks like:

SDK-poky-glibc-x86_64--cortexa57-qemuarm64$

---
v2: not set PS1 for buildtools-tarball

 meta/classes/toolchain-scripts.bbclass | 1 +
 meta/conf/bitbake.conf                 | 1 +
 2 files changed, 2 insertions(+)
meta/classes/toolchain-scripts.bbclass +1 -0
index db1d3215ef..88df373d0b 100644
@@ -45,6 +45,7 @@ toolchain_create_sdk_env_script () {
 		EXTRAPATH="$EXTRAPATH:$sdkpathnative$bindir/${TARGET_ARCH}${TARGET_VENDOR}-$i"
 	done
 	echo "export PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':$PATH' >> $script
+	echo 'export PS1="${SDK_PS1}"' >>$script
 	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script
 	echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig' >> $script
 	echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script
meta/conf/bitbake.conf +1 -0
index 48af17fbf7..6075749a5e 100644
@@ -422,6 +422,7 @@ PKGDATA_DIR = "${TMPDIR}/pkgdata/${MACHINE}"
 
 SDK_NAME_PREFIX ?= "oecore"
 SDK_NAME = "${SDK_NAME_PREFIX}-${SDK_ARCH}-${TUNE_PKGARCH}"
+SDK_PS1 ?= "SDK-${SDK_NAME}:\\\\$ "
 SDKPATH = "/usr/local/${SDK_NAME_PREFIX}-${SDK_ARCH}"
 SDKPATHNATIVE = "${SDKPATH}/sysroots/${SDK_SYS}"
 
Signature · 1 line
2.17.1
#1 lore raw

Are we sure we want to completely override it rather than adding to it? I'd be rather irritated if this blows away my prompt without my asking for it. I think either it should append or have a variable controlling whether this is enabled when building the SDK.

Quoted 55 lines · kai

From: Kai Kang <[email protected]>

Introduce a new variable SDK_PS1 to customize prompt string for SDKs when source script environment-setup-script.

The default prompt string of SDKs looks like:

SDK-poky-glibc-x86_64--cortexa57-qemuarm64$

---
v2: not set PS1 for buildtools-tarball

 meta/classes/toolchain-scripts.bbclass | 1 +
 meta/conf/bitbake.conf                 | 1 +
 2 files changed, 2 insertions(+)
meta/classes/toolchain-scripts.bbclass +0 -0
index db1d3215ef..88df373d0b 100644
@@ -45,6 +45,7 @@ toolchain_create_sdk_env_script () {
 

EXTRAPATH="$EXTRAPATH:$sdkpathnative$bindir/${TARGET_ARCH}${TARGET_VENDOR}-$i"
done
echo "export
PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':$PATH'

Quoted 1 line
Quoted 1 line

$script

+ echo 'export PS1="${SDK_PS1}"' >>$script
echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script
echo 'export
PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig'

Quoted 1 line
Quoted 1 line

$script

echo 'export
CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script

meta/conf/bitbake.conf +1 -1
index 48af17fbf7..6075749a5e 100644
@@ -422,6 +422,7 @@ PKGDATA_DIR = "${TMPDIR}/pkgdata/${MACHINE}"
 
 SDK_NAME_PREFIX ?= "oecore"
 SDK_NAME = "${SDK_NAME_PREFIX}-${SDK_ARCH}-${TUNE_PKGARCH}"
+SDK_PS1 ?= "SDK-${SDK_NAME}:\\\\$ "
 SDKPATH = "/usr/local/${SDK_NAME_PREFIX}-${SDK_ARCH}"
 SDKPATHNATIVE = "${SDKPATH}/sysroots/${SDK_SYS}"
 
--

2.17.1

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
author
#2 lore raw
Quoted 1 line · Christopher Larson

Are we sure we want to completely override it rather than adding to it? I'd be rather irritated if this blows away my prompt without my asking for it. I think either it should append or have a variable controlling whether this is enabled when building the SDK.

The original requirement is that the PS1 after source sdk environment file is as same as the original one. It can not tell whether in a sdk environment.

The default assignment of SDK_PS1 is '?=', you can set it in conf file to override it.

Regards,
Kai

Quoted 67 lines · On Wed, Feb 24, 2021 at 10:59 PM kai <[email protected]…
    From: Kai Kang <[email protected]
    <mailto:[email protected]>>

    Introduce a new variable SDK_PS1 to customize prompt string for SDKs
    when source script environment-setup-script.

    The default prompt string of SDKs looks like:

    SDK-poky-glibc-x86_64--cortexa57-qemuarm64$

    Signed-off-by: Kai Kang <[email protected]
    <mailto:[email protected]>>
    ---
    v2: not set PS1 for buildtools-tarball

     meta/classes/toolchain-scripts.bbclass | 1 +
     meta/conf/bitbake.conf                 | 1 +
     2 files changed, 2 insertions(+)

    diff --git a/meta/classes/toolchain-scripts.bbclass
    b/meta/classes/toolchain-scripts.bbclass
    index db1d3215ef..88df373d0b 100644
    --- a/meta/classes/toolchain-scripts.bbclass
    +++ b/meta/classes/toolchain-scripts.bbclass
    @@ -45,6 +45,7 @@ toolchain_create_sdk_env_script () {
    EXTRAPATH="$EXTRAPATH:$sdkpathnative$bindir/${TARGET_ARCH}${TARGET_VENDOR}-$i"
            done
            echo "export
    PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':$PATH'
    >> $script
    +       echo 'export PS1="${SDK_PS1}"' >>$script
            echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >>
    $script
            echo 'export
    PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig'
    >> $script
            echo 'export
    CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >>
    $script
    diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
    index 48af17fbf7..6075749a5e 100644
    --- a/meta/conf/bitbake.conf
    +++ b/meta/conf/bitbake.conf
    @@ -422,6 +422,7 @@ PKGDATA_DIR = "${TMPDIR}/pkgdata/${MACHINE}"

     SDK_NAME_PREFIX ?= "oecore"
     SDK_NAME = "${SDK_NAME_PREFIX}-${SDK_ARCH}-${TUNE_PKGARCH}"
    +SDK_PS1 ?= "SDK-${SDK_NAME}:\\\\$ "
     SDKPATH = "/usr/local/${SDK_NAME_PREFIX}-${SDK_ARCH}"
     SDKPATHNATIVE = "${SDKPATH}/sysroots/${SDK_SYS}"

    -- 
    2.17.1
Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
Signature · 2 lines
Kai Kang
Wind River Linux
#3 lore raw

There is no way with this patch to prevent it from mucking with the prompt at all. Setting that variable to the empty string will just empty the prompt instead.

Quoted 71 lines · Kai



Quoted 1 line · Christopher Larson

Are we sure we want to completely override it rather than adding to it? I'd be rather irritated if this blows away my prompt without my asking for it. I think either it should append or have a variable controlling whether this is enabled when building the SDK.

The original requirement is that the PS1 after source sdk environment file is as same as the original one. It can not tell whether in a sdk environment. The default assignment of SDK_PS1 is '?=', you can set it in conf file to override it.

Regards,
Kai

Quoted 56 lines · kai
Quoted 47 lines

From: Kai Kang <[email protected]>

Introduce a new variable SDK_PS1 to customize prompt string for SDKs when source script environment-setup-script.

The default prompt string of SDKs looks like:

SDK-poky-glibc-x86_64--cortexa57-qemuarm64$

---
v2: not set PS1 for buildtools-tarball

 meta/classes/toolchain-scripts.bbclass | 1 +
 meta/conf/bitbake.conf                 | 1 +
 2 files changed, 2 insertions(+)
meta/classes/toolchain-scripts.bbclass +1 -0
index db1d3215ef..88df373d0b 100644
@@ -45,6 +45,7 @@ toolchain_create_sdk_env_script () {
                EXTRAPATH="$EXTRAPATH:$sdkpathnative$bindir/${TARGET_ARCH}${TARGET_VENDOR}-$i"
        done
        echo "export PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':$PATH' >> $script
+       echo 'export PS1="${SDK_PS1}"' >>$script
        echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script
        echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig' >> $script
        echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script
meta/conf/bitbake.conf +1 -0
index 48af17fbf7..6075749a5e 100644
@@ -422,6 +422,7 @@ PKGDATA_DIR = "${TMPDIR}/pkgdata/${MACHINE}"
 
 SDK_NAME_PREFIX ?= "oecore"
 SDK_NAME = "${SDK_NAME_PREFIX}-${SDK_ARCH}-${TUNE_PKGARCH}"
+SDK_PS1 ?= "SDK-${SDK_NAME}:\\\\$ "
 SDKPATH = "/usr/local/${SDK_NAME_PREFIX}-${SDK_ARCH}"
 SDKPATHNATIVE = "${SDKPATH}/sysroots/${SDK_SYS}"
 
Signature · 1 line
2.17.1
Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
Signature · 2 lines
Kai Kang
Wind River Linux
#4 lore raw
In reply to kai
Quoted 7 lines · Kai

On 2/25/21 11:29 PM, Christopher Larson wrote:

Quoted 5 lines

Are we sure we want to completely override it rather than adding to it? I'd be rather irritated if this blows away my prompt without my asking for it. I think either it should append or have a variable controlling whether this is enabled when building the SDK.

Quoted 5 lines

The original requirement is that the PS1 after source sdk environment file is as same as the original one.
It can not tell whether in a sdk environment.

The default assignment of SDK_PS1 is '?=', you can set it in conf file to override it.

I've held off this patch for a while since I think its going to *really* annoy a subset of users and as Chris says, it can't be disabled. It would really need to be disablable through configuration and at runtime when sourcing the script which isn't possible.

I appreciate the usability issue it is trying to improve but I think it will cause more complaints than issues it solves. As such I don't think we want to do this...

Cheers,

Richard

author
#5 lore raw
Quoted 13 lines · Richard Purdie
Quoted 7 lines · Kai
Quoted 5 lines · Christopher Larson

Are we sure we want to completely override it rather than adding to it? I'd be rather irritated if this blows away my prompt without my asking for it. I think either it should append or have a variable controlling whether this is enabled when building the SDK.

Quoted 5 lines

The original requirement is that the PS1 after source sdk environment file is as same as the original one.
It can not tell whether in a sdk environment.

The default assignment of SDK_PS1 is '?=', you can set it in conf file to override it.

Quoted 8 lines

I've held off this patch for a while since I think its going to *really* annoy a subset of users and as Chris says, it can't be disabled. It would really need to be disablable through configuration and at runtime when sourcing the script which isn't possible.

I appreciate the usability issue it is trying to improve but I think it will cause more complaints than issues it solves. As such I don't think we want to do this...

I have been working on the issue Chiris says by adding a check for SDK_PS1. If do not want to change the current behavior, it could done by not set SDK_PS1 by default. It is better to have a chance to modify sdk prompt string.

Regards,
Kai

Quoted 8 lines

Cheers,

Richard

Signature · 2 lines
Kai Kang
Wind River Linux