Part 1
요약·해설
INI 형식의 system·global·local 설정과 override 순서, west config 읽기·쓰기, 내장 option 17개와 정규식 project filter를 설명합니다.
computer-wide
per-user override
workspace override
system · global · local
read · write · override
manifest · update · zephyr
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
22E2078AB53E18091E6A84F4B5A0C7B4F9DCFBCF6A763847AC8BDDC85B2710A5
.. _west-config:
Configuration
#############
This page documents west's configuration file system, the ``west config``
command, and configuration options used by built-in commands. For API
documentation on the ``west.configuration`` module, see
:ref:`west-apis-configuration`.
West Configuration Files
------------------------
West's configuration file syntax is INI-like; here is an example file:
.. code-block:: ini
[manifest]
path = zephyr
[zephyr]
base = zephyr
Above, the ``manifest`` section has option ``path`` set to ``zephyr``. Another
way to say the same thing is that ``manifest.path`` is ``zephyr`` in this file.
There are three types of configuration file:
1. **System**: Settings in this file affect west's behavior for every user
logged in to the computer. Its location depends on the platform:
- Linux: :file:`/etc/westconfig`
- macOS: :file:`/usr/local/etc/westconfig`
- Windows: :file:`%PROGRAMDATA%\\west\\config`
2. **Global** (per user): Settings in this file affect how west behaves when
run by a particular user on the computer.
- All platforms: the default is :file:`.westconfig` in the user's home
directory.
- Linux note: if the environment variable ``XDG_CONFIG_HOME`` is set,
then :file:`$XDG_CONFIG_HOME/west/config` is used.
- Windows note: the following environment variables are tested to find the
home directory: ``%HOME%``, then ``%USERPROFILE%``, then a
combination of ``%HOMEDRIVE%`` and ``%HOMEPATH%``.
3. **Local**: Settings in this file affect west's behavior for the
current :term:`west workspace`. The file is :file:`.west/config`, relative
to the workspace's root directory.
A setting in a file which appears lower down on this list overrides an earlier
setting. For example, if ``color.ui`` is ``true`` in the system's configuration
file, but ``false`` in the workspace's, then the final value is
``false``. Similarly, settings in the user configuration file override system
settings, and so on.
.. _west-config-cmd:
west config
-----------
The built-in ``config`` command can be used to get and set configuration
values. You can pass ``west config`` the options ``--system``, ``--global``, or
``--local`` to specify which configuration file to use. Only one of these can
be used at a time. If none is given, then writes default to ``--local``, and
reads show the final value after applying overrides.
Some examples for common uses follow; run ``west config -h`` for detailed help,
and see :ref:`west-config-index` for more details on built-in options.
To set ``manifest.path`` to :file:`some-other-manifest`:
.. code-block:: console
west config manifest.path some-other-manifest
Doing the above means that commands like ``west update`` will look for the
:term:`west manifest` inside the :file:`some-other-manifest` directory
(relative to the workspace root directory) instead of the directory given to
``west init``, so be careful!
To read ``zephyr.base``, the value which will be used as ``ZEPHYR_BASE`` if it
is unset in the calling environment (also relative to the workspace root):
.. code-block:: console
west config zephyr.base
You can switch to another zephyr repository without changing ``manifest.path``
-- and thus the behavior of commands like ``west update`` -- using:
.. code-block:: console
west config zephyr.base some-other-zephyr
This can be useful if you use commands like ``git worktree`` to create your own
zephyr directories, and want commands like ``west build`` to use them instead
of the zephyr repository specified in the manifest. (You can go back to using
the directory in the upstream manifest by running ``west config zephyr.base
zephyr``.)
To set ``color.ui`` to ``false`` in the global (user-wide) configuration file,
so that west will no longer print colored output for that user when run in any
workspace:
.. code-block:: console
west config --global color.ui false
To undo the above change:
.. code-block:: console
west config --global color.ui true
.. _west-config-index:
Built-in Configuration Options
------------------------------
The following table documents configuration options supported by west's
built-in commands. Configuration options supported by Zephyr's extension
commands are documented in the pages for those commands.
.. NOTE: docs authors: keep this table sorted by section, then option.
.. list-table::
:widths: 10 30
:header-rows: 1
* - Option
- Description
* - ``color.ui``
- Boolean. If ``true`` (the default), then west output is colorized when
stdout is a terminal.
* - ``commands.allow_extensions``
- Boolean, default ``true``, disables :ref:`west-extensions` if ``false``
* - ``grep.color``
- String, default empty. Set this to ``never`` to disable ``west grep``
color output. If set, ``west grep`` passes the value to the grep tool's
``--color`` option.
* - ``grep.tool``
- String, one of ``"git-grep"`` (default), ``"ripgrep"``, or ``"grep"``.
The grep tool that ``west grep`` should use.
* - ``grep.<TOOL>-args``
- String, default empty. The ``<TOOL>`` part is a pattern that can be any
``grep.tool`` value, so ``grep.ripgrep-args`` is an example
configuration option. If set, arguments that ``west grep`` should pass
to the corresponding grep tool. Run ``west help grep`` for details.
* - ``grep.<TOOL>-path``
- String, default empty. The ``<TOOL>`` part is a pattern that can be any
``grep.tool`` value, so ``grep.ripgrep-path`` is an example
configuration option. The path to the corresponding tool that ``west
grep`` should use instead of searching for the command. Run ``west help
grep`` for details.
* - ``manifest.file``
- String, default ``west.yml``. Relative path from the manifest repository
root directory to the manifest file used by ``west init`` and other
commands which parse the manifest.
* - ``manifest.group-filter``
- String, default empty. A comma-separated list of project groups to
enable and disable within the workspace. Prefix enabled groups with
``+`` and disabled groups with ``-``. For example, the value
``"+foo,-bar"`` enables group ``foo`` and disables ``bar``. See
:ref:`west-manifest-groups`.
* - ``manifest.path``
- String, relative path from the :term:`west workspace` root directory
to the manifest repository used by ``west update`` and other commands
which parse the manifest. Set locally by ``west init``.
* - ``manifest.project-filter``
- Comma-separated list of strings.
The option's value is a comma-separated list of regular expressions,
each prefixed with ``+`` or ``-``, like this:
.. code-block:: none
+re1,-re2,-re3
Project names are matched against each regular expression (``re1``,
``re2``, ``re3``, ...) in the list, in order. If the entire project name
matches the regular expression, that element of the list either
deactivates or activates the project. The project is deactivated if the
element begins with ``-``. The project is activated if the element
begins with ``+``. (Project names cannot contain ``,`` if this option is
used, so the regular expressions do not need to contain a literal ``,``
character.)
If a project's name matches multiple regular expressions in the list,
the result from the last regular expression is used. For example,
if ``manifest.project-filter`` is:
.. code-block:: none
-hal_.*,+hal_foo
Then a project named ``hal_bar`` is inactive, but a project named
``hal_foo`` is active.
If a project is made inactive or active by a list element, the project
is active or not regardless of whether any or all of its groups are
disabled. (This is currently the only way to make a project that has no
groups inactive.)
Otherwise, i.e. if a project does not match any regular expressions in
the list, it is active or inactive according to the usual rules related
to its groups (see :ref:`west-project-group-examples` for examples in
that case).
Within an element of a ``manifest.project-filter`` list, leading and
trailing whitespace are ignored. That means these example values
are equivalent:
.. code-block:: none
+foo,-bar
+foo , -bar
Any empty elements are ignored. That means these example values are
equivalent:
.. code-block:: none
+foo,,-bar
+foo,-bar
* - ``update.fetch``
- String, one of ``"smart"`` (the default behavior starting in v0.6.1) or
``"always"`` (the previous behavior). If set to ``"smart"``, the
:ref:`west-update` command will skip fetching
from project remotes when those projects' revisions in the manifest file
are SHAs or tags which are already available locally. The ``"always"``
behavior is to unconditionally fetch from the remote.
* - ``update.name-cache``
- String. If non-empty, ``west update`` will use its value as the
``--name-cache`` option's value if not given on the command line.
* - ``update.narrow``
- Boolean. If ``true``, ``west update`` behaves as if ``--narrow`` was
given on the command line. The default is ``false``.
* - ``update.path-cache``
- String. If non-empty, ``west update`` will use its value as the
``--path-cache`` option's value if not given on the command line.
* - ``update.sync-submodules``
- Boolean. If ``true`` (the default), :ref:`west-update` will synchronize
Git submodules before updating them.
* - ``zephyr.base``
- String, default value to set for the :envvar:`ZEPHYR_BASE` environment
variable while the west command is running. By default, this is set to
the path to the manifest project with path :file:`zephyr` (if there is
one) during ``west init``. If the variable is already set, then this
setting is ignored unless ``zephyr.base-prefer`` is ``"configfile"``.
* - ``zephyr.base-prefer``
- String, one the values ``"env"`` and ``"configfile"``. If set to
``"env"`` (the default), setting :envvar:`ZEPHYR_BASE` in the calling
environment overrides the value of the ``zephyr.base`` configuration
option. If set to ``"configfile"``, the configuration option wins
instead.
Part 3
한국어 전문 번역
설정
이 페이지는 west의 configuration file 체계, west config 명령, 내장 명령이 사용하는 설정 option을 설명합니다. west.configuration module의 API는 West configuration API를 참고합니다.
West 설정 파일
West 설정 파일 문법은 INI와 비슷합니다. 예:
[manifest]
path = zephyr
[zephyr]
base = zephyr위 파일의 manifest section에는 path option이 zephyr로 설정돼 있습니다. 같은 내용을 manifest.path가 zephyr라고 표현할 수도 있습니다.
설정 파일에는 다음 세 종류가 있습니다.
- System: 컴퓨터에 로그인한 모든 사용자의 west 동작에 영향을 줍니다.
Linux:/etc/westconfigmacOS:/usr/local/etc/westconfigWindows:%PROGRAMDATA%\west\config
- Global(사용자별): 특정 사용자가 실행하는 west 동작에 영향을 줍니다.
- 모든 platform의 기본값은 사용자 home directory의
.westconfig입니다. - Linux에서
XDG_CONFIG_HOME이 설정돼 있으면$XDG_CONFIG_HOME/west/config를 사용합니다. - Windows는 home directory를 찾기 위해
%HOME%→%USERPROFILE%→%HOMEDRIVE%와%HOMEPATH%조합 순으로 검사합니다.
- 모든 platform의 기본값은 사용자 home directory의
- Local: 현재 west workspace에만 영향을 줍니다. Workspace root를 기준으로
.west/config에 있습니다.
목록에서 아래쪽에 있는 파일의 설정이 위쪽 파일을 덮어씁니다. 예를 들어 system file의 color.ui가 true여도 workspace local file이 false이면 최종값은 false입니다. 같은 방식으로 사용자 설정은 system 설정보다 우선합니다.
모든 사용자 기본값
현재 사용자가 덮어씀
현재 workspace가 최종 덮어씀
west config 명령
내장 config 명령으로 설정값을 읽고 쓸 수 있습니다. --system, --global, --local 중 하나를 지정해 사용할 설정 파일을 고릅니다. 한 번에 하나만 사용할 수 있습니다.
아무 범위도 지정하지 않으면 쓰기는 --local이 기본이고, 읽기는 모든 우선순위를 적용한 최종값을 보여 줍니다. 자세한 도움말은 west config -h로 확인합니다.
manifest.path 변경
manifest.path를 some-other-manifest로 설정하려면:
west config manifest.path some-other-manifestzephyr.base 읽기와 변경
호출 환경에서 ZEPHYR_BASE가 설정되지 않았을 때 사용할 workspace 상대값인 zephyr.base를 읽으려면:
west config zephyr.basemanifest.path와 west update의 동작은 그대로 두고 다른 Zephyr repository를 사용하려면:
west config zephyr.base some-other-zephyr이 방식은 git worktree로 별도 Zephyr directory를 만들고 west build가 manifest의 repository 대신 그 directory를 사용하게 할 때 유용합니다. Upstream manifest의 directory로 되돌리려면 west config zephyr.base zephyr를 실행합니다.
색상 출력의 사용자 전역 설정
사용자 전역 설정에서 color.ui를 false로 두어 어떤 workspace에서도 색상 출력을 하지 않게 하려면:
west config --global color.ui false이 변경을 되돌리려면:
west config --global color.ui true내장 설정 option
다음 표는 west 내장 명령이 지원하는 설정 option입니다. Zephyr extension 명령의 option은 각 명령 페이지에서 따로 설명합니다.
| Option | 설명 |
|---|---|
color.ui | Boolean. 기본값은 true입니다. stdout이 terminal이면 west output에 색을 입힙니다. |
commands.allow_extensions | Boolean. 기본값은 true이며 false로 두면 west extension을 비활성화합니다. |
grep.color | String. 기본값은 빈 문자열입니다. never로 두면 west grep의 색상 출력을 끕니다. 값이 있으면 grep 도구의 --color option으로 전달합니다. |
grep.tool | String. git-grep(기본값), ripgrep, grep 중 하나이며 west grep가 사용할 도구를 선택합니다. |
grep.<TOOL>-args | String. 기본값은 빈 문자열입니다. <TOOL>에는 grep.tool 값이 들어가며 grep.ripgrep-args가 예입니다. 설정하면 해당 grep 도구에 전달할 argument가 됩니다. |
grep.<TOOL>-path | String. 기본값은 빈 문자열입니다. grep.ripgrep-path처럼 해당 도구의 실행 path를 직접 지정해 command 검색을 대신합니다. |
manifest.file | String. 기본값은 west.yml입니다. Manifest repository root에서 west init과 manifest를 분석하는 명령이 사용할 manifest file까지의 상대 path입니다. |
manifest.group-filter | String. 기본값은 빈 문자열입니다. Workspace에서 project group을 활성화·비활성화하는 comma-separated 목록입니다. 활성화는 +, 비활성화는 - prefix를 붙입니다. 예: +foo,-bar. |
manifest.path | String. West workspace root에서 manifest repository까지의 상대 path입니다. west update와 manifest를 분석하는 명령이 사용하며 west init이 로컬 설정에 기록합니다. |
manifest.project-filter | Comma-separated 정규식 목록입니다. 각 항목은 + 또는 -로 project를 활성화하거나 비활성화합니다. 일치 규칙과 예외 처리는 아래에서 자세히 설명합니다. |
update.fetch | String. smart(v0.6.1부터 기본값) 또는 always. smart는 manifest revision이 이미 로컬에 있는 SHA나 tag이면 remote fetch를 건너뛰고, always는 무조건 fetch합니다. |
update.name-cache | String. 비어 있지 않으면 command line에서 지정하지 않은 --name-cache option의 값으로 사용합니다. |
update.narrow | Boolean. true이면 west update --narrow처럼 동작합니다. 기본값은 false입니다. |
update.path-cache | String. 비어 있지 않으면 command line에서 지정하지 않은 --path-cache option의 값으로 사용합니다. |
update.sync-submodules | Boolean. 기본값은 true이며 project submodule을 갱신하기 전에 Git submodule을 동기화합니다. |
zephyr.base | String. West 명령 실행 중 ZEPHYR_BASE에 사용할 기본값입니다. west init 때 path가 zephyr인 manifest project가 있으면 그 path를 기본으로 사용합니다. 환경 변수가 이미 설정돼 있으면 zephyr.base-prefer=configfile인 경우를 제외하고 이 값은 무시됩니다. |
zephyr.base-prefer | String. env(기본값) 또는 configfile. env는 호출 환경의 ZEPHYR_BASE가 zephyr.base보다 우선하고, configfile은 설정 파일 값을 우선합니다. |
manifest.project-filter 상세
manifest.project-filter 값은 + 또는 - prefix가 붙은 정규식을 comma로 나열합니다.
+re1,-re2,-re3Project 이름을 목록의 각 정규식 re1, re2, re3 순서로 비교합니다. 전체 project 이름이 일치하면 - 항목은 비활성화하고 + 항목은 활성화합니다. 이 option을 쓸 때 project 이름에는 comma를 넣을 수 없으므로 정규식이 literal comma를 처리할 필요가 없습니다.
하나의 project가 여러 정규식에 일치하면 마지막 일치 결과가 적용됩니다. 예:
-hal_.*,+hal_foohal_bar는 -hal_.*에 일치해 비활성화되지만 hal_foo는 마지막 +hal_foo 규칙이 다시 활성화합니다.
Project filter가 project를 활성화 또는 비활성화하면 group의 활성 상태와 관계없이 그 결과가 우선합니다. Group이 하나도 없는 project를 비활성화할 수 있는 방법도 현재는 이 option뿐입니다.
어떤 정규식에도 일치하지 않으면 project group의 일반 규칙에 따라 활성 여부를 결정합니다.
manifest.project-filter 목록의 각 항목은 앞뒤 공백을 무시하므로 다음 두 값은 같습니다.
+foo,-bar
+foo , -bar빈 항목도 무시하므로 다음 두 값은 같습니다.
+foo,,-bar
+foo,-bar
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.