Skip to content

Conversation

thorsten-klein
Copy link
Contributor

@thorsten-klein thorsten-klein commented Sep 23, 2025

build.dir-fmt format string arguments are extended.

New supported format args are:

  • {west_topdir} which is the absolute path to the west workspace directory (west topdir). This is helpful for users when they want to place all build folders under a fix path within the west workspace.

  • {source_dir_workspace} which is the relative path of the source directory to the west workspace (west topdir). If the source directory is outside of the west workspace, {source_dir_workspace} will be relative to the filesystem root. {source_dir_workspace} is helpful to keep builds in separate folders under a specific subfolder. Since the path is relative to west topdir , it does not matter in which working directory the west build command was called.

Background: {source_dir} cannot be used currently since it is relative to the current working directory and it might therefore be a relative path starting with ../. {source_dir_ws} will never start with ../.

E.g. users can now use following dir-fmt in order to store builds under a fix path <west_workspace>/build/:

dir-fmt = {west_ws}/build/{board}/{source_dir_workspace}

Copy link
Contributor

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at all the os.cwd() (which should probably be Path.cwd()), I wonder about people using west outside the west workspace, thanks to the ZEPHYR_BASE variable. How is this going to work for them? Has dir-fmt ever worked for them? It's OK if it does not but then it should fail clearly and "gracefully".

Noob questions sorry.

@thorsten-klein thorsten-klein force-pushed the extend-dir-fmt-format-args branch 14 times, most recently from 4a4bd90 to 1cfc21e Compare September 25, 2025 15:35
@thorsten-klein thorsten-klein force-pushed the extend-dir-fmt-format-args branch 4 times, most recently from 4fbdfa3 to 2b455ec Compare September 26, 2025 17:01
build.dir-fmt format string arguments are extended. New format args are
'west_topdir' (absolute path to the west workspace directory) and
'source_dir_workspace' (relative path of the source directory to
west_topdir).

Signed-off-by: Thorsten Klein <[email protected]>
@thorsten-klein thorsten-klein force-pushed the extend-dir-fmt-format-args branch from 2b455ec to f612541 Compare September 27, 2025 06:29
Copy link

@thorsten-klein
Copy link
Contributor Author

Is there anything else I should provide or address to get this feature merged? 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants