west: Extension commands silently missing when `git` isn't installed
If you expect to see an extension command like build
, but do not have git
installed, then west
will silently not tell you anything about this on the CLI.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (2 by maintainers)
Commits related to this issue
- doc: west: clarify how ZEPHYR_MODULES is set by CMake https://github.com/zephyrproject-rtos/west/issues/617 — committed to MatthewCroughan/zephyr by MatthewCroughan a year ago
- doc: west: specify how CMake uses west to set ZEPHYR_MODULES https://github.com/zephyrproject-rtos/west/issues/617 — committed to MatthewCroughan/zephyr by MatthewCroughan a year ago
@marc-hb
west init -m https://github.com/nrfconnect/sdk-nrf --mr v2.1-branch
west update
Notice that you can only use the build scripts if the
.git
directory existsIt’s still something west interacts with, that I was misplacing blame on. I later found that West itself is deeply intertwined with
.git
and does similar redundant checks, in addition to the file I linked also being ran when it is sourced.I’m trying to build Zephyr with Nix, a reproducible build system. In order to fetch the source code with
west
, you need to create what is called a “fixed-output-derivation”. This basically means that you fetch the content once, and then record the recursive sha256 of the directory that is created as a result of running thewest
commands. This recursive hash of the resulting directory is called a “NAR” (nix archive) hash. This NAR hash cannot be the same twice if we are fetching the.git
folder, asgit
does not deterministically pack/unpack. so we have to remove it in order to fetch and store it with Nix.This fixed-output-derivation can be thought of as a layer in Docker where you might fetch the source code. You would want that layer to be cryptographically reproducible if you were to run it again, which it cannot be if the
.git
remains in the result. Fixed output derivations in Nix cannot compile source code, they can only fetch data, this is an important distinction, as it prevents all sorts of cheats that would make a build process unreproducible, which is why I cannot fetch and compile in the same step. It is better for caching to fetch the source code in a separate “layer” anyway. But for as long as the.git
directory is required, we cannot store it on a reproducible filesystem like the/nix/store
with Nix, since the content will never be the same twice due to the aforementioned non-determinism in.git