[Buildroot] [git commit branch/2021.02.x] package/environment-setup: Fix incorrect order of the `sed` expressions

Peter Korsgaard peter at korsgaard.com
Thu May 20 09:38:14 UTC 2021


commit: https://git.buildroot.net/buildroot/commit/?id=a24df585b9239b8e8ec9c94fdcae3b131c636f07
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2021.02.x

Order of the `sed` expressions is important; when this was commited
to master, the order of the expressions from the original patch [1] was
changed, rendering the second expression to noop.

This made all the environment variables from the script to contain
absolute paths: long absolute paths makes verbose builds difficult
to read/follow.
We can take advantage of the fact that the PATH is updated and we
don't have to use absolute paths.

Fixed by reordering the `sed` expresions:
* first update the path of the binaries: e.g. 's%$(HOST_DIR)/bin/%%g'
* only then update remaining paths: e.g. 's%$(HOST_DIR)%\$$SDK_PATH%g'

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20201027140140.47982-1-matthew.weber@rockwellcollins.com/

Signed-off-by: Mircea GLIGA <mgliga at bitdefender.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
(cherry picked from commit d0ed2725e9816677ab395334fdb7ec2559bce878)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/environment-setup/environment-setup.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
index fcad013f0d..f4c52921f7 100644
--- a/package/environment-setup/environment-setup.mk
+++ b/package/environment-setup/environment-setup.mk
@@ -26,8 +26,8 @@ define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
 	printf "alias cmake=\"cmake \
 		-DCMAKE_TOOLCHAIN_FILE=$(HOST_DIR)/share/buildroot/toolchainfile.cmake \
 		-DCMAKE_INSTALL_PREFIX=/usr\"\n" >> $(ENVIRONMENT_SETUP_FILE)
-	$(SED) 's%$(HOST_DIR)%\$$SDK_PATH%g' \
-		-e 's%$(HOST_DIR)/bin/%%g' \
+	$(SED) 's%$(HOST_DIR)/bin/%%g' \
+		-e 's%$(HOST_DIR)%\$$SDK_PATH%g' \
 		-e '/^export "PATH=/c\' \
 		$(ENVIRONMENT_SETUP_FILE)
 	printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \


More information about the buildroot mailing list