summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2023-05-15 12:53:35 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-22 10:53:47 +0100
commitfff443cb20440a4df136b3dc689ae06045c71325 (patch)
tree93da445d942312c7c016f4e49305f9c51a0d98b9 /scripts
parent01ab8228c75674554d9af56091c18a63b8096892 (diff)
downloadpoky-fff443cb20440a4df136b3dc689ae06045c71325.tar.gz
oe-buildenv-internal: remove path from previous project
Util now, only paths added for 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_PATHS, and remove it in the next sourcing. The OE_ADDED_PATHS variable is exported mainly for the two reasons: 1. users can clearly see it in the `env' command's output. 2. if the prefixed PATH is carried into the subprocess (e.g., a subshell), so should this OE_ADDED_PATHS variable that prefixes it. 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. (From OE-Core rev: 3405a3221b8f6641a8e42b04bc7acd6e032aeab8) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-buildenv-internal17
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index 485d4c52e1..f856e618aa 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -92,19 +92,20 @@ fi
92PYTHONPATH=$BITBAKEDIR/lib:$PYTHONPATH 92PYTHONPATH=$BITBAKEDIR/lib:$PYTHONPATH
93export PYTHONPATH 93export PYTHONPATH
94 94
95# Remove any paths added by sourcing this script before
96[ -n "$OE_ADDED_PATHS" ] && PATH=$(echo $PATH | sed -e "s#$OE_ADDED_PATHS##") ||
97 PATH=$(echo $PATH | sed -e "s#$OEROOT/scripts:$BITBAKEDIR/bin:##")
98
95# Make sure our paths are at the beginning of $PATH 99# Make sure our paths are at the beginning of $PATH
96for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do 100OE_ADDED_PATHS="$OEROOT/scripts:$BITBAKEDIR/bin:"
97 # Remove any existences of $newpath from $PATH 101PATH="$OE_ADDED_PATHS$PATH"
98 PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##") 102export OE_ADDED_PATHS
99 103
100 # Add $newpath to $PATH 104# This is not needed anymore
101 PATH="$newpath:$PATH" 105unset BITBAKEDIR
102done
103unset BITBAKEDIR newpath
104 106
105# Used by the runqemu script 107# Used by the runqemu script
106export BUILDDIR 108export BUILDDIR
107export PATH
108 109
109BB_ENV_PASSTHROUGH_ADDITIONS_OE="MACHINE DISTRO TCMODE TCLIBC HTTP_PROXY http_proxy \ 110BB_ENV_PASSTHROUGH_ADDITIONS_OE="MACHINE DISTRO TCMODE TCLIBC HTTP_PROXY http_proxy \
110HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \ 111HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \