Update Spacemit toolchain download URL and centralize versioning - #3618
Conversation
Agent-Logs-Url: https://github.com/spacemit-com/sherpa-onnx/sessions/eb998fb7-04c9-4c67-a2a5-b140725573d9 Co-authored-by: alex-spacemit <213897846+alex-spacemit@users.noreply.github.com>
…url-again Update Spacemit toolchain source and centralize versioning
📝 WalkthroughWalkthroughThe PR parameterizes the Spacemit RISC-V64 toolchain version and migrates the download source from ChangesSpacemit Toolchain Version Parameterization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Updates the Spacemit RISC-V toolchain download source from archive.spacemit.com to the GitHub Releases mirror at github.com/spacemit-com/toolchain, and centralizes the toolchain version into a single variable in both the build script and the CI workflow.
Changes:
- Introduce
SPACEMIT_TOOLCHAIN_VERSIONvariable inbuild-riscv64-linux-gnu-spacemit.shand use it to compose the toolchain archive name and URL. - Switch download URL from
archive.spacemit.comto the GitHub Releases location. - Mirror the same version variable in the CI workflow via job-level
env, and reuse it in the cache key, download, and extract steps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| build-riscv64-linux-gnu-spacemit.sh | Adds SPACEMIT_TOOLCHAIN_VERSION and updates URL/filename to use the GitHub Releases mirror; download file name now correctly ends in .tar.xz. |
| .github/workflows/riscv64-spacemit-linux.yaml | Adds job-level SPACEMIT_TOOLCHAIN_VERSION env, parameterizes the cache key and the wget/tar commands accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@build-riscv64-linux-gnu-spacemit.sh`:
- Around line 4-7: The script currently unconditionally sets
SPACEMIT_TOOLCHAIN_VERSION to v1.1.2; change the assignment so it only uses that
default when the environment hasn't provided a value (use shell parameter
expansion on SPACEMIT_TOOLCHAIN_VERSION). Keep the subsequent variables
SPACEMIT_TOOLCHAIN, DOWNLOAD_URL, and DOWNLOAD_FILE intact so they derive from
SPACEMIT_TOOLCHAIN_VERSION; this lets CI or callers override
SPACEMIT_TOOLCHAIN_VERSION externally while preserving the default.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 92686363-5fdc-4b5d-bae9-82c5552b5c99
📒 Files selected for processing (2)
.github/workflows/riscv64-spacemit-linux.yamlbuild-riscv64-linux-gnu-spacemit.sh
| SPACEMIT_TOOLCHAIN_VERSION=v1.1.2 | ||
| SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION} | ||
| DOWNLOAD_URL="https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${SPACEMIT_TOOLCHAIN}.tar.xz" | ||
| DOWNLOAD_FILE="./${SPACEMIT_TOOLCHAIN}.tar.xz" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== build script header =="
sed -n '1,12p' build-riscv64-linux-gnu-spacemit.sh
echo
echo "== all version declarations in reviewed files =="
rg -n 'SPACEMIT_TOOLCHAIN_VERSION' \
.github/workflows/riscv64-spacemit-linux.yaml \
build-riscv64-linux-gnu-spacemit.shRepository: k2-fsa/sherpa-onnx
Length of output: 1680
🏁 Script executed:
rg -n 'SPACEMIT_TOOLCHAIN_VERSION' --type-list | head -20Repository: k2-fsa/sherpa-onnx
Length of output: 452
🏁 Script executed:
fd -type f -name '*.sh' -o -name '*.yaml' -o -name '*.yml' | xargs rg -l 'build-riscv64-linux-gnu-spacemit' 2>/dev/null || echo "No files found calling this script"Repository: k2-fsa/sherpa-onnx
Length of output: 286
🏁 Script executed:
rg -n 'build-riscv64-linux-gnu-spacemit\.sh' --type-listRepository: k2-fsa/sherpa-onnx
Length of output: 452
🏁 Script executed:
grep -r "build-riscv64-linux-gnu-spacemit" . --include="*.md" --include="*.txt" 2>/dev/null | head -20Repository: k2-fsa/sherpa-onnx
Length of output: 44
🏁 Script executed:
rg "build-riscv64-linux-gnu-spacemit" . 2>/dev/nullRepository: k2-fsa/sherpa-onnx
Length of output: 44
Honor externally provided toolchain version instead of overriding it.
Line 4 currently forces v1.1.2, preventing environment-based customization. Wrap the assignment with parameter expansion to apply the default only when the variable is unset:
-SPACEMIT_TOOLCHAIN_VERSION=v1.1.2
+SPACEMIT_TOOLCHAIN_VERSION="${SPACEMIT_TOOLCHAIN_VERSION:-v1.1.2}"This preserves the default behavior while allowing CI or other external callers to override the version without script modification.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| SPACEMIT_TOOLCHAIN_VERSION=v1.1.2 | |
| SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION} | |
| DOWNLOAD_URL="https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${SPACEMIT_TOOLCHAIN}.tar.xz" | |
| DOWNLOAD_FILE="./${SPACEMIT_TOOLCHAIN}.tar.xz" | |
| SPACEMIT_TOOLCHAIN_VERSION="${SPACEMIT_TOOLCHAIN_VERSION:-v1.1.2}" | |
| SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION} | |
| DOWNLOAD_URL="https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${SPACEMIT_TOOLCHAIN}.tar.xz" | |
| DOWNLOAD_FILE="./${SPACEMIT_TOOLCHAIN}.tar.xz" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@build-riscv64-linux-gnu-spacemit.sh` around lines 4 - 7, The script currently
unconditionally sets SPACEMIT_TOOLCHAIN_VERSION to v1.1.2; change the assignment
so it only uses that default when the environment hasn't provided a value (use
shell parameter expansion on SPACEMIT_TOOLCHAIN_VERSION). Keep the subsequent
variables SPACEMIT_TOOLCHAIN, DOWNLOAD_URL, and DOWNLOAD_FILE intact so they
derive from SPACEMIT_TOOLCHAIN_VERSION; this lets CI or callers override
SPACEMIT_TOOLCHAIN_VERSION externally while preserving the default.
There was a problem hiding this comment.
Code Review
This pull request updates the build-riscv64-linux-gnu-spacemit.sh script to download the Spacemit toolchain from GitHub instead of the archive site. It also introduces a version variable for better maintainability and updates the local download filename to match the source archive. I have no feedback to provide.
csukuangfj
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
Update Spacemit toolchain download URL (k2-fsa#3618)
https://github.com/spacemit-com/sherpa-onnx/actions/runs/25903004405 checked
Summary by CodeRabbit