fix(toolchain): support ${{ VAR }} syntax in toolchain commands#22
Merged
joabech merged 1 commit intoanalogdevicesinc:mainfrom Apr 13, 2026
Merged
Conversation
Add support for the cim template syntax ${{ VAR }} in the toolchain
variable expansion as well.
This change makes it possible to use something like:
CARGO_HOME=${{ WORKSPACE }}/toolchains/rust/cargo
instead of:
CARGO_HOME=$PWD/cargo
Which likely feels more intuitive for many users.
Two problems are fixed together:
1. expand_toolchain_env_vars did not recognise ${{ VAR }} at all.
A new parsing pass is inserted before the existing ${VAR}/$VAR
handling. Known cim variables (PWD, WORKSPACE, HOME) are resolved
to their absolute paths; all other names are looked up as standard
environment variables and, if not found, the original token is
preserved unchanged.
2. execute_post_install_commands passed command strings verbatim to
the shell without any cim-variable expansion. Only the separate
'environment' section was expanded. Now each command is run through
expand_toolchain_env_vars before being handed to the shell, so
${{ WORKSPACE }}, $WORKSPACE, ${{ PWD }}, $PWD, and any other
supported variable forms work consistently inside commands.
Signed-off-by: Joakim Bech <Joakim.Bech@analog.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for the cim template syntax ${{ VAR }} in the toolchain variable expansion as well.
This change makes it possible to use something like:
CARGO_HOME=${{ WORKSPACE }}/toolchains/rust/cargo
instead of:
CARGO_HOME=$PWD/cargo
Which likely feels more intuitive for many users.
Two problems are fixed together:
expand_toolchain_env_vars did not recognise ${{ VAR }} at all. A new parsing pass is inserted before the existing ${VAR}/$VAR handling. Known cim variables (PWD, WORKSPACE, HOME) are resolved to their absolute paths; all other names are looked up as standard environment variables and, if not found, the original token is preserved unchanged.
execute_post_install_commands passed command strings verbatim to the shell without any cim-variable expansion. Only the separate 'environment' section was expanded. Now each command is run through expand_toolchain_env_vars before being handed to the shell, so ${{ WORKSPACE }},$WORKSPACE, $ {{ PWD }}, $PWD, and any other supported variable forms work consistently inside commands.