Feature: configurable Nim upstream repo (#76)

* add tunable repo URL when using NIM_COMMIT

* fix docs

* remove embedded single quotes from repo default

* drop old upstream (if any) before adding a new one

* rename NIM_REPO -> NIM_COMMIT_REPO

* add new remote named "extra" if upstream already exists

* remove previous "extra" remote before trying to reset it

* make extra point to custom repo, upstream to nim-lang's
This commit is contained in:
Giuliano Mega 2024-10-30 06:05:16 -03:00 committed by GitHub
parent 1c6c29b655
commit 0dfdddbef1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View File

@ -169,6 +169,20 @@ You also need to specify it when using this non-default Nim compiler version:
`make -j8 NIM_COMMIT="v1.2.6" nimbus_beacon_node`
### NIM_COMMIT_REPO
`NIM_COMMIT` will try to fetch commits from the
[status-im fork](https://github.com/status-im/Nim), followed by the
[official Nim language repo](https://github.com/nim-lang/Nim). If you want to
use a fork from somewhere else, you can set this to the repo's URL.
`make -j8 NIM_COMMIT="4561f01" NIM_COMMIT_REPO="https://github.com/myorg/my-nim-fork"`
As before, you will need to specify this again when using this non-default Nim
compiler version:
`make -j8 NIM_COMMIT="4561f01" NIM_COMMIT_REPO="https://github.com/myorg/my-nim-fork" nimbus_beacon_node`
### EXCLUDED_NIM_PACKAGES
List of relative paths (incomplete ones also work) to Git submodules that

View File

@ -62,7 +62,14 @@ nim_needs_rebuilding() {
if ! git checkout -q ${NIM_COMMIT} 2>/dev/null; then
# Pay the price for a non-default NIM_COMMIT here, by fetching everything.
# (This includes upstream branches and tags that might be missing from our fork.)
if ! git remote | grep -q "^upstream$"; then
git remote add upstream https://github.com/nim-lang/Nim
fi
# If the user has specified a custom repo, add it here as a remote as well.
if [[ -n "${NIM_COMMIT_REPO}" ]]; then
git remote remove extra 2>/dev/null || true
git remote add extra "${NIM_COMMIT_REPO}"
fi
git fetch --all --tags --quiet
git checkout -q ${NIM_COMMIT}
fi