-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Prysm Version Upgrade Script #15992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Prysm Version Upgrade Script #15992
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ### Added | ||
|
|
||
| - Bash script for automating the version upgrade process. |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||
| set -euo pipefail | ||||||||||||||
|
|
||||||||||||||
| # ====== config ====== | ||||||||||||||
| OLD="OffchainLabs/prysm/v6" | ||||||||||||||
| NEW="OffchainLabs/prysm/v7" | ||||||||||||||
|
|
||||||||||||||
| # files by extension (recursive) | ||||||||||||||
| EXTENSIONS=("bazel" "go" "proto") | ||||||||||||||
|
|
||||||||||||||
| # explicit files (relative to project root) | ||||||||||||||
| EXPLICIT_FILES=( | ||||||||||||||
| "hack/update-mockgen.sh" | ||||||||||||||
| "hack/update-go-pbs.sh" | ||||||||||||||
| "go.mod" | ||||||||||||||
| ".deepsource.toml" | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| # commands to run at the end, in order | ||||||||||||||
| COMMANDS=( | ||||||||||||||
| 'bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true' | ||||||||||||||
| 'go mod tidy && go get ./...' | ||||||||||||||
| 'bazel clean --expunge --async' | ||||||||||||||
| './hack/update-go-pbs.sh' | ||||||||||||||
| './hack/update-go-ssz.sh' | ||||||||||||||
| 'go build ./... && bazel build //cmd/beacon-chain //cmd/validator' | ||||||||||||||
| ) | ||||||||||||||
| # ==================== | ||||||||||||||
|
|
||||||||||||||
| # Detect BSD vs GNU sed (macOS vs Linux) | ||||||||||||||
| if sed --version >/dev/null 2>&1; then | ||||||||||||||
| SED_INPLACE=("sed" "-i") | ||||||||||||||
| else | ||||||||||||||
| # macOS / BSD sed needs an empty string after -i | ||||||||||||||
| SED_INPLACE=("sed" "-i" "") | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| escape_sed() { | ||||||||||||||
| # escape / in pattern and replacement so sed doesn't choke | ||||||||||||||
| printf '%s' "$1" | sed 's/[\/&]/\\&/g' | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| OLD_ESCAPED=$(escape_sed "$OLD") | ||||||||||||||
| NEW_ESCAPED=$(escape_sed "$NEW") | ||||||||||||||
|
|
||||||||||||||
| ############################################ | ||||||||||||||
| # 1) walk directory by extensions | ||||||||||||||
| ############################################ | ||||||||||||||
| for ext in "${EXTENSIONS[@]}"; do | ||||||||||||||
| while IFS= read -r -d '' file; do | ||||||||||||||
| "${SED_INPLACE[@]}" "s/${OLD_ESCAPED}/${NEW_ESCAPED}/g" "$file" | ||||||||||||||
| echo "updated (by ext): $file" | ||||||||||||||
| done < <(find . -type f -name "*.${ext}" -print0) | ||||||||||||||
|
||||||||||||||
| done < <(find . -type f -name "*.${ext}" -print0) | |
| done < <(find . -type f -name "*.${ext}" \ | |
| ! -path "*/node_modules/*" \ | |
| ! -path "*/.git/*" \ | |
| ! -path "*/bazel-*/*" \ | |
| -print0) |
Uh oh!
There was an error while loading. Please reload this page.