]> code.ossystems Code Review - openembedded-core.git/commitdiff
files/toolchain-shar-extract.sh: Rework PATH cleaning
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 7 Mar 2020 13:43:44 +0000 (13:43 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 6 Sep 2020 15:56:23 +0000 (16:56 +0100)
Trying to create a clean PATH breaks cases where we install a buildtools tarball
on hosts to provide newer versions of gcc. Rework the fix for #8698 to clean up
directories in PATH which don't exist isntead. Do it with python as the shell
version was too fraught with corner cases.

(From OE-Core rev: 7674b63819aa7ca95ca5ca5477a5cce32e9691eb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/files/toolchain-shar-extract.sh

index 4c4b4deb4cf89abb724deda11c2e919579c8a71c..2e0fe94963fa548c467cb9a7cf74a81eaf5b6961 100644 (file)
@@ -1,13 +1,8 @@
 #!/bin/sh
 
-[ -z "$ENVCLEANED" ] && exec /usr/bin/env -i ENVCLEANED=1 HOME="$HOME" \
-       LC_ALL=en_US.UTF-8 \
-       TERM=$TERM \
-       ICECC_PATH="$ICECC_PATH" \
-       http_proxy="$http_proxy" https_proxy="$https_proxy" ftp_proxy="$ftp_proxy" \
-       no_proxy="$no_proxy" all_proxy="$all_proxy" GIT_PROXY_COMMAND="$GIT_PROXY_COMMAND" "$0" "$@"
-[ -f /etc/environment ] && . /etc/environment
-export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
+export LC_ALL=en_US.UTF-8
+# Remove invalid PATH elements first (maybe from a previously setup toolchain now deleted
+PATH=`python3 -c 'import os; print(":".join(e for e in os.environ["PATH"].split(":") if os.path.exists(e)))'`
 
 tweakpath () {
     case ":${PATH}:" in