-
Notifications
You must be signed in to change notification settings - Fork 147
Description
Introduction
We use west to checkout all source files necessary for building a firmware and use the import feature as pictured below. This way we don't need to specify the exact version of the modules we want to use because that information is taken from the imported manifests.
project_repository (internal git server)
├─ west.yml
⇓ imports (filtered by name-allowlist)
company_library_repository (internal git server)
├─ west.yml
⇓ imports
zephyr_repository (https://github.com/zephyrproject-rtos/zephyr)
├─ west.yml
⇓ imports
zephyr_module_1 (https://github.com/zephyrproject-rtos/zephyr_module_1)
zephyr_module_2 (https://github.com/zephyrproject-rtos/zephyr_module_2)
zephyr_module_3 (https://github.com/zephyrproject-rtos/zephyr_module_3)
Requirement
To ensure long term reproducibility we want to mirror all externally hosted repositories on our internal git server and use this mirror server for cloning.
Possible solutions
User/system specific git config
One way to achieve this would be to use the git url.<base>.insteadOf config option (see also #28 (comment)). However, this option is user and/or system specific but we want that the actually used servers are deducible by examining the project_repository and its imports.
Specifying git config options in manifest
Another way would be to introduce a new manifest file key that allows setting arbitrary git config options. However, west probably shouldn't set user or system wide config options so it would have to set the config option in all imported repositories.
Adding a rewrite-url key to the manifest
Probably the cleanest way would be to introduce a new key to the manifest file, e.g. rewrite-url. An example could look like
manifest:
defaults:
remote: zephyr
rewrite-url:
- from: "default from regexp"
to: "default to regexp "
remotes:
- name: zephyr
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
revision: xxxxxx
path: modules/zephyr
import:
rewrite-url:
- from: "from regexp 1"
to: "to regexp 1"
- from: "from regexp 2"
to: "to regexp 2"
- name: module
revision: yyyyyyyyyyy
path: modules/lib/module
import:
true # uses default rewrite-url
rewrite-url are a list of rewrite rules that will be applied to a url in order. If manifests are imported multiple levels deep the rewrite rules on the lowest level are applied first.
Open points:
- Is this full fledged implementation necessary or is there a more simple solution?
- Should we support full regexp or just match the start of the url as git does?
- Do we need project specific rewrite-urls? Would it make the implementation if we supported only rewrite-url in the defaults section?
Suggestions?