From: Chen Qi <qi.c...@windriver.com> For now, only that paths added from current project are removed to avoid PATH growing unnecessarily. This is to handle the case of sourcing the init script into different build directories.
However, if we source the init script from different projects into different build directories, the paths added by previous projects are not cleaned up. To avoid this, we record the paths added into OE_ADDED_PATH, and remove it in the next sourcing. Note that the paths, "$OEROOT/scripts:$BITBAKEDIR/bin:", are added as a whole. A previous commit, "oe-buildenv-internal: Add paths to $PATH individually", made the change to treat these two paths separately, the reason was not "assuming the path to the scripts directory always is in $PATH directly before the bitbake directory". But this is exactly the effect of the codes. I see no reason why we should complicate things. Signed-off-by: Chen Qi <qi.c...@windriver.com> --- scripts/oe-buildenv-internal | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal index 485d4c52e1..fdc29bd353 100755 --- a/scripts/oe-buildenv-internal +++ b/scripts/oe-buildenv-internal @@ -92,15 +92,13 @@ fi PYTHONPATH=$BITBAKEDIR/lib:$PYTHONPATH export PYTHONPATH +# Remove old added path +[ -n "$OE_ADDED_PATH" ] && PATH=$(echo $PATH | sed -e "s#$OE_ADDED_PATH##") +OE_ADDED_PATH="$OEROOT/scripts:$BITBAKEDIR/bin:" # Make sure our paths are at the beginning of $PATH -for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do - # Remove any existences of $newpath from $PATH - PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##") - - # Add $newpath to $PATH - PATH="$newpath:$PATH" -done -unset BITBAKEDIR newpath +PATH="$OE_ADDED_PATH$PATH" +export OE_ADDED_PATH +unset BITBAKEDIR # Used by the runqemu script export BUILDDIR -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#181172): https://lists.openembedded.org/g/openembedded-core/message/181172 Mute This Topic: https://lists.openembedded.org/mt/98842319/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-