From d7ff0e4ba4a8ae2523c6c3fa6168c0c5d5979921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 2 Jul 2025 22:21:58 +0200 Subject: [PATCH] doc: develop: gsg: have west init use pinned Zephyr version for releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building the docs for a release, the section of the getting started that lets the user `west init` their workspace now has them check out the version matchin the release. Fixes zephyrproject-rtos/zephyr#92163 Signed-off-by: Benjamin Cabé --- doc/conf.py | 3 +++ doc/develop/getting_started/index.rst | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 16a7c9e958d..60e91d0dd0b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -143,6 +143,9 @@ SDK_URL_BASE="https://github.com/zephyrproject-rtos/sdk-ng/releases/download" rst_epilog = f""" .. include:: /substitutions.txt +.. |zephyr-version| replace:: ``{version}`` +.. |zephyr-version-ltrim| unicode:: {version} + :ltrim: .. |sdk-version-literal| replace:: ``{sdk_version}`` .. |sdk-version-trim| unicode:: {sdk_version} :trim: diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 78f43e70b5f..cda955a3374 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -252,11 +252,25 @@ chosen. You'll also install Zephyr's additional Python dependencies in a #. Get the Zephyr source code: - .. code-block:: bash + .. only:: not release + + .. code-block:: bash + + west init ~/zephyrproject + cd ~/zephyrproject + west update + + .. only:: release + + .. We need to use a parsed-literal here because substitutions do not work in code + blocks. This means users can't copy-paste these lines as easily as other blocks but + should be good enough still :) + + .. parsed-literal:: - west init ~/zephyrproject - cd ~/zephyrproject - west update + west init ~/zephyrproject --mr v |zephyr-version-ltrim| + cd ~/zephyrproject + west update #. Export a :ref:`Zephyr CMake package `. This allows CMake to automatically load boilerplate code required for building Zephyr