Part 1
요약·해설
manifest-rev와 refs/west/*의 소유권, HTTPS·SSH private repository 인증, workspace 안의 project path 제약, 세 가지 repository topology를 설명합니다.
manifest-rev · refs/west/*
HTTPS · PAT · SSH agent
T1 Zephyr · T2 app · T3 forest
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
AC5026366DDF6D69C4C89FDBFBE693EE2C559CE71CADC98BB45903887660594F
.. _west-workspaces:
Workspaces
##########
This page describes the *west workspace* concept introduced in
:ref:`west-basics` in more detail.
.. _west-manifest-rev:
The ``manifest-rev`` branch
***************************
West creates and controls a Git branch named ``manifest-rev`` in each
project. This branch points to the revision that the manifest file
specified for the project at the time :ref:`west-update` was last run.
Other workspace management commands may use ``manifest-rev`` as a reference
point for the upstream revision as of this latest update. Among other
purposes, the ``manifest-rev`` branch allows the manifest file to use SHAs
as project revisions.
Although ``manifest-rev`` is a normal Git branch, west will recreate and/or
reset it on the next update. For this reason, it is **dangerous**
to check it out or otherwise modify it yourself. For instance, any commits
you manually add to this branch may be lost the next time you run ``west
update``. Instead, check out a local branch with another name, and either
rebase it on top of a new ``manifest-rev``, or merge ``manifest-rev`` into
it.
.. note::
West does not create a ``manifest-rev`` branch in the manifest repository,
since west does not manage the manifest repository's branches or revisions.
The ``refs/west/*`` Git refs
****************************
West also reserves all Git refs that begin with ``refs/west/`` (such as
``refs/west/foo``) for itself in local project repositories. Unlike
``manifest-rev``, these refs are not regular branches. West's behavior here is
an implementation detail; users should not rely on these refs' existence or
behavior.
Private repositories
********************
You can use west to fetch from private repositories. There is nothing
west-specific about this.
The ``west update`` command essentially runs ``git fetch YOUR_PROJECT_URL``
when a project's ``manifest-rev`` branch must be updated to a newly fetched
commit. It's up to your environment to make sure the fetch succeeds.
You can either enter the password manually or use any of the `credential
helpers built in to Git`_. Since Git has credential storage built in, there is
no need for a west-specific feature.
The following sections cover common cases for running ``west update`` without
having to enter your password, as well as how to troubleshoot issues.
.. _credential helpers built in to Git:
https://git-scm.com/docs/gitcredentials
Fetching via HTTPS
==================
On Windows when fetching from GitHub, recent versions of Git prompt you for
your GitHub password in a graphical window once, then store it for future use
(in a default installation). Passwordless fetching from GitHub should therefore
work "out of the box" on Windows after you have done it once.
In general, you can store your credentials on disk using the "store" git
credential helper. See the `git-credential-store`_ manual page for details.
To use this helper for all the repositories in your workspace, run:
.. code-block:: shell
west forall -c "git config credential.helper store"
To use this helper on just the projects ``foo`` and ``bar``, run:
.. code-block:: shell
west forall -c "git config credential.helper store" foo bar
To use this helper by default on your computer, run:
.. code-block:: shell
git config --global credential.helper store
On GitHub, you can set up a `personal access token`_ to use in place of your
account password. (This may be required if your account has two-factor
authentication enabled, and may be preferable to storing your account password
in plain text even if two-factor authentication is disabled.)
You can use the Git credential store to authenticate with a GitHub PAT
(Personal Access Token) like so:
.. code-block:: shell
echo "https://x-access-token:[email protected]" >> ~/.git-credentials
If you don't want to store any credentials on the file system, you can store
them in memory temporarily using `git-credential-cache`_ instead.
If you setup fetching via SSH, you can use Git URL rewrite feature. The following
command instructs Git to use SSH URLs for GitHub instead of HTTPS ones:
.. code-block:: shell
git config --global url."[email protected]:".insteadOf "https://github.com/"
.. _git-credential-store:
https://git-scm.com/docs/git-credential-store#_examples
.. _git-credential-cache:
https://git-scm.com/docs/git-credential-cache
.. _personal access token:
https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
Fetching via SSH
================
If your SSH key has no password, fetching should just work. If it does have a
password, you can avoid entering it manually every time using `ssh-agent`_.
On GitHub, see `Connecting to GitHub with SSH`_ for details on configuration
and key creation.
.. _ssh-agent:
https://www.ssh.com/ssh/agent
.. _Connecting to GitHub with SSH:
https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh
Project locations
*****************
Projects can be located anywhere inside the workspace, but they may not
"escape" it.
In other words, project repositories need not be located in subdirectories of
the manifest repository or as immediate subdirectories of the topdir. However,
projects must have paths inside the workspace.
You may replace a project's repository directory within the workspace with a
symbolic link to elsewhere on your computer, but west will not do this for you.
.. _west-topologies:
Topologies supported
********************
The following are example source code topologies supported by west.
- T1: star topology, zephyr is the manifest repository
- T2: star topology, a Zephyr application is the manifest repository
- T3: forest topology, freestanding manifest repository
T1: Star topology, zephyr is the manifest repository
====================================================
- The zephyr repository acts as the central repository and specifies
its :ref:`modules` in its :file:`west.yml`
- Analogy with existing mechanisms: Git submodules with zephyr as the
super-project
This is the default. See :ref:`west-workspace` for how mainline Zephyr is an
example of this topology.
.. _west-t2:
T2: Star topology, application is the manifest repository
=========================================================
- Useful for those focused on a single application
- A repository containing a Zephyr application acts as the central repository
and names other projects required to build it in its :file:`west.yml`. This
includes the zephyr repository and any modules.
- Analogy with existing mechanisms: Git submodules with the application as
the super-project, zephyr and other projects as submodules
A workspace using this topology looks like this:
.. code-block:: none
west-workspace/
│
├── application/ # .git/ │
│ ├── CMakeLists.txt │
│ ├── prj.conf │ never modified by west
│ ├── src/ │
│ │ └── main.c │
│ └── west.yml # main manifest with optional import(s) and override(s)
│ │
├── modules/
│ └── lib/
│ └── zcbor/ # .git/ project from either the main manifest or some import.
│
└── zephyr/ # .git/ project
└── west.yml # This can be partially imported with lower precedence or ignored.
# Only the 'manifest-rev' version can be imported.
Here is an example :file:`application/west.yml` which uses
:ref:`west-manifest-import`, available since west 0.7, to import Zephyr v2.5.0
and its modules into the application manifest file:
.. code-block:: yaml
# Example T2 west.yml, using manifest imports.
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v2.5.0
import: true
self:
path: application
You can still selectively "override" individual Zephyr modules if you use
``import:`` in this way; see :ref:`west-manifest-ex1.3` for an example.
Another way to do the same thing is to copy/paste :file:`zephyr/west.yml`
to :file:`application/west.yml`, adding an entry for the zephyr
project itself, like this:
.. code-block:: yaml
# Equivalent to the above, but with manually maintained Zephyr modules.
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
defaults:
remote: zephyrproject-rtos
projects:
- name: zephyr
revision: v2.5.0
west-commands: scripts/west-commands.yml
- name: net-tools
revision: some-sha-goes-here
path: tools/net-tools
# ... other Zephyr modules go here ...
self:
path: application
(The ``west-commands`` is there for :ref:`west-build-flash-debug` and other
Zephyr-specific :ref:`west-extensions`. It's not necessary when using
``import``.)
The main advantage to using ``import`` is not having to track the revisions of
imported projects separately. In the above example, using ``import`` means
Zephyr's :ref:`module <modules>` versions are automatically determined from the
:file:`zephyr/west.yml` revision, instead of having to be copy/pasted (and
maintained) on their own.
T3: Forest topology
===================
- Useful for those supporting multiple independent applications or downstream
distributions with no "central" repository
- A dedicated manifest repository which contains no Zephyr source code,
and specifies a list of projects all at the same "level"
- Analogy with existing mechanisms: Google repo-based source distribution
A workspace using this topology looks like this:
.. code-block:: none
west-workspace/
├── app1/ # .git/ project
│ ├── CMakeLists.txt
│ ├── prj.conf
│ └── src/
│ └── main.c
├── app2/ # .git/ project
│ ├── CMakeLists.txt
│ ├── prj.conf
│ └── src/
│ └── main.c
├── manifest-repo/ # .git/ never modified by west
│ └── west.yml # main manifest with optional import(s) and override(s)
├── modules/
│ └── lib/
│ └── zcbor/ # .git/ project from either the main manifest or
│ # from some import
│
└── zephyr/ # .git/ project
└── west.yml # This can be partially imported with lower precedence or ignored.
# Only the 'manifest-rev' version can be imported.
Here is an example T3 :file:`manifest-repo/west.yml` which uses
:ref:`west-manifest-import`, available since west 0.7, to import Zephyr
v2.5.0 and its modules, then add the ``app1`` and ``app2`` projects:
.. code-block:: yaml
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
- name: your-git-server
url-base: https://git.example.com/your-company
defaults:
remote: your-git-server
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v2.5.0
import: true
- name: app1
revision: SOME_SHA_OR_BRANCH_OR_TAG
- name: app2
revision: ANOTHER_SHA_OR_BRANCH_OR_TAG
self:
path: manifest-repo
You can also do this "by hand" by copy/pasting :file:`zephyr/west.yml`
as shown :ref:`above <west-t2>` for the T2 topology, with the same caveats.
Part 3
한국어 전문 번역
이 페이지는 West 기본 개념에서 소개한 West workspace를 더 자세히 설명합니다.
manifest-rev branch
West는 각 project에 manifest-rev라는 Git branch를 만들고 관리합니다. 이 branch는 마지막으로 west update를 실행했을 때 manifest file이 그 project에 지정한 revision을 가리킵니다. 다른 workspace 관리 command는 최신 update 시점의 upstream revision을 알아내는 기준으로 이를 사용할 수 있으며, manifest file이 project revision으로 SHA를 지정할 수 있게 해 줍니다.
manifest-rev는 일반 Git branch이지만 다음 update에서 West가 다시 만들거나 reset합니다. 직접 checkout하거나 수정하면 위험합니다. 수동으로 추가한 commit은 다음 west update에서 사라질 수 있습니다. 다른 이름의 local branch를 checkout하고 새 manifest-rev 위로 rebase하거나, manifest-rev를 local branch에 merge해야 합니다.
refs/west/* Git ref
West는 local project repository에서 refs/west/foo처럼 refs/west/로 시작하는 모든 Git ref를 내부 용도로 예약합니다. manifest-rev와 달리 일반 branch가 아닙니다. 존재 여부와 동작은 구현 세부 사항이므로 user code가 이에 의존하면 안 됩니다.
Private repository
West는 별도 전용 방식 없이 private repository를 가져올 수 있습니다. Project의 manifest-rev를 새 commit으로 갱신해야 할 때 west update는 본질적으로 git fetch YOUR_PROJECT_URL을 실행하므로, fetch가 성공하도록 environment의 Git 인증을 준비해야 합니다.
Password를 직접 입력하거나 Git 내장 credential helper를 사용할 수 있습니다. Git 자체가 credential 저장 기능을 제공하므로 West만의 별도 기능은 필요하지 않습니다.
HTTPS로 fetch
Windows에서 GitHub를 fetch하면 최근 Git은 기본 설치 상태에서 처음 한 번 GUI window로 GitHub 인증을 요청한 뒤 이후 사용을 위해 저장합니다. 따라서 한 번 인증하면 일반적으로 추가 설정 없이 passwordless fetch가 동작합니다.
git-credential-store helper를 사용하면 credential을 disk에 저장할 수 있습니다. Workspace의 모든 repository에 설정하려면:
west forall -c "git config credential.helper store"foo와 bar project에만 설정하려면:
west forall -c "git config credential.helper store" foo barComputer의 모든 Git repository에서 기본값으로 사용하려면:
git config --global credential.helper storeGitHub personal access token은 account password 대신 사용할 수 있습니다. 2-factor authentication을 켰다면 필요할 수 있고, 2FA를 끈 경우에도 account password를 평문으로 저장하는 것보다 낫습니다.
Git credential store에서 GitHub PAT를 사용하려면 다음과 같이 credential file에 넣을 수 있습니다.
echo "https://x-access-token:[email protected]" >> ~/.git-credentialsgit-credential-cache를 사용하면 file system에 credential을 남기지 않고 memory에 잠시 보관할 수 있습니다.
SSH fetch를 설정했다면 Git URL rewrite로 GitHub HTTPS URL을 SSH URL로 바꿀 수 있습니다.
git config --global url."[email protected]:".insteadOf "https://github.com/"SSH로 fetch
SSH key에 password가 없으면 별도 입력 없이 fetch됩니다. Password가 있다면 ssh-agent를 사용해 매번 직접 입력하지 않을 수 있습니다. GitHub의 설정과 key 생성은 GitHub SSH 연결 안내를 참고합니다.
Project 위치
Project는 workspace 내부라면 어디에나 둘 수 있지만 workspace 밖으로 빠져나갈 수는 없습니다. Manifest repository의 subdirectory나 topdir 바로 아래일 필요는 없지만 모든 project path는 workspace 안에 있어야 합니다.
Workspace 안의 project repository directory를 computer의 다른 위치를 가리키는 symbolic link로 바꿀 수는 있지만 West가 이를 대신 만들지는 않습니다.
지원 topology
West는 다음 source code 배치를 지원합니다.
- T1: Zephyr가 manifest repository인 star topology.
- T2: Zephyr application이 manifest repository인 star topology.
- T3: source code와 분리된 manifest repository를 사용하는 forest topology.
T1: Zephyr가 manifest repository인 star topology
zephyrrepository가 중앙 repository 역할을 하며west.yml에 module을 지정합니다.- 기존 방식으로 비유하면 Zephyr를 super-project로 삼은 Git submodule 구조입니다.
이 배치가 기본값이며 mainline Zephyr workspace가 실제 예입니다. West workspace 기본 구조에서 초기화와 update 흐름을 확인할 수 있습니다.
T2: Application이 manifest repository인 star topology
- 하나의 application에 집중하는 개발자에게 유용합니다.
west.yml을 가진 Zephyr application repository가 중앙 repository가 되고, build에 필요한 Zephyr와 module project를 모두 명시합니다.- Application을 super-project로, Zephyr와 다른 project를 submodule로 보는 Git submodule 구조와 비슷합니다.
이 topology의 workspace directory는 다음과 같습니다.
west-workspace/
│
├── application/ # .git/ │
│ ├── CMakeLists.txt │
│ ├── prj.conf │ never modified by west
│ ├── src/ │
│ │ └── main.c │
│ └── west.yml # main manifest with optional import(s) and override(s)
│ │
├── modules/
│ └── lib/
│ └── zcbor/ # .git/ project from either the main manifest or some import.
│
└── zephyr/ # .git/ project
└── west.yml # This can be partially imported with lower precedence or ignored.
# Only the 'manifest-rev' version can be imported.중앙 manifest repository · west.yml · application source
main manifest 또는 import가 지정한 project
import 대상 project · 낮은 우선순위 west.yml
West 0.7부터 지원하는 manifest import로 Zephyr v2.5.0과 그 module을 application manifest에 가져오는 application/west.yml 예입니다.
# Example T2 west.yml, using manifest imports.
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v2.5.0
import: true
self:
path: applicationimport:를 사용할 때도 개별 Zephyr module을 선택적으로 override할 수 있습니다. manifest import override 예를 참고합니다.
같은 결과를 얻는 다른 방법은 zephyr/west.yml을 application/west.yml에 복사하고 Zephyr project 자체 entry를 추가하는 것입니다.
# Equivalent to the above, but with manually maintained Zephyr modules.
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
defaults:
remote: zephyrproject-rtos
projects:
- name: zephyr
revision: v2.5.0
west-commands: scripts/west-commands.yml
- name: net-tools
revision: some-sha-goes-here
path: tools/net-tools
# ... other Zephyr modules go here ...
self:
path: applicationwest-commands는 build·flash·debug와 Zephyr 전용 West extension을 위한 항목입니다. import를 사용하면 필요하지 않습니다.
import의 주요 장점은 가져온 project revision을 따로 추적하지 않아도 된다는 점입니다. 위 예에서는 Zephyr west.yml revision이 module version을 자동 결정합니다. 수동 방식은 각 revision을 복사하고 계속 관리해야 합니다.
T3: Forest topology
- 서로 독립적인 여러 application이나 중앙 repository가 없는 downstream distribution을 지원할 때 유용합니다.
- Zephyr source code를 포함하지 않는 전용 manifest repository가 같은 수준의 모든 project를 나열합니다.
- 기존 방식으로 비유하면 Google Repo 기반 source distribution입니다.
이 topology의 workspace directory는 다음과 같습니다.
west-workspace/
├── app1/ # .git/ project
│ ├── CMakeLists.txt
│ ├── prj.conf
│ └── src/
│ └── main.c
├── app2/ # .git/ project
│ ├── CMakeLists.txt
│ ├── prj.conf
│ └── src/
│ └── main.c
├── manifest-repo/ # .git/ never modified by west
│ └── west.yml # main manifest with optional import(s) and override(s)
├── modules/
│ └── lib/
│ └── zcbor/ # .git/ project from either the main manifest or
│ # from some import
│
└── zephyr/ # .git/ project
└── west.yml # This can be partially imported with lower precedence or ignored.
# Only the 'manifest-rev' version can be imported.source가 없는 독립 manifest repository
서로 독립적인 application project
manifest와 import가 같은 수준에 배치한 project
West 0.7 manifest import로 Zephyr v2.5.0과 module을 가져오고 app1, app2를 추가하는 manifest-repo/west.yml 예입니다.
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
- name: your-git-server
url-base: https://git.example.com/your-company
defaults:
remote: your-git-server
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v2.5.0
import: true
- name: app1
revision: SOME_SHA_OR_BRANCH_OR_TAG
- name: app2
revision: ANOTHER_SHA_OR_BRANCH_OR_TAG
self:
path: manifest-repoT2에서 설명한 것처럼 zephyr/west.yml을 복사해 수동으로 구성할 수도 있지만 revision을 따로 유지해야 하는 같은 주의점이 적용됩니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.