Skip to content

Fix package name format for ort url - #3489

Merged
csukuangfj merged 1 commit into
k2-fsa:masterfrom
spacemit-com:fix-spacemit-ort-url
Apr 8, 2026
Merged

csukuangfj merged 1 commit into
k2-fsa:masterfrom
spacemit-com:fix-spacemit-ort-url

Conversation

@alex-spacemit

@alex-spacemit alex-spacemit commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Fixed ONNX Runtime package handling to properly support special characters in version identifiers during builds, ensuring reliable package download and configuration.

Copilot AI review requested due to automatic review settings April 8, 2026 13:43
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 8, 2026
@coderabbitai

coderabbitai Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR updates the ONNX Runtime package filename in the CMake configuration for RISC-V64 SpacemiT builds by URL-encoding the + character to %2B in the version string, ensuring compatibility with download URL construction.

Changes

Cohort / File(s) Summary
ONNX Runtime Package Configuration
cmake/onnxruntime-linux-riscv64-spacemit.cmake
Updated package filename from spacemit-ort.riscv64.2.0.2+rc1.tar.gz to spacemit-ort.riscv64.2.0.2%2Brc1.tar.gz, ensuring the + character is URL-encoded in all derived variable references.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested labels

size:S

Suggested reviewers

  • csukuangfj

Poem

🐰 A + sign caused quite a fuss,
In URLs, it stirred up muss,
So %2B now takes its place,
Encoded proper, with style and grace!
The paths are fixed, the builds will soar,
SpacemiT downloads, forevermore!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing URL encoding of the package name by replacing '+' with '%2B' in the ONNX Runtime CMake configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the onnxruntime_pkg_name in the RISC-V CMake configuration to use URL encoding for the '+' character. A review comment points out that this change will likely break local file detection, as the filesystem expects a literal '+' rather than '%2B', and suggests encoding the character only for the URL.

endif()

set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2+rc1.tar.gz")
set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2%2Brc1.tar.gz")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Changing the + character to %2B in onnxruntime_pkg_name will fix the download URL, but it will break the local file detection logic in lines 23-29. The if(EXISTS ${f}) check (line 32) will look for a file literally named with %2B on the disk, whereas the file is likely stored with a literal + character.

To support both the URL and local file detection, consider keeping the literal + in onnxruntime_pkg_name and only using the encoded version for the URL. For example, you could hardcode the encoded filename in the onnxruntime_URL definition on line 17, or use string(REPLACE "+" "%2B" ...) to create a separate variable for the URL.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cmake/onnxruntime-linux-riscv64-spacemit.cmake (1)

16-29: ⚠️ Potential issue | 🟠 Major

Keep the local archive filename unescaped; escape only the URL segment.

Using %2B in onnxruntime_pkg_name also changes possible_file_locations, so offline lookup now expects a literal %2B filename. Manually downloaded archives are commonly saved as ...+rc1.tar.gz, which will be missed, causing unnecessary network fetch/failure in offline builds.

💡 Proposed fix
-set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2%2Brc1.tar.gz")
-set(onnxruntime_URL  "https://archive.spacemit.com/spacemit-ai/onnxruntime/${onnxruntime_pkg_name}")
+set(onnxruntime_pkg_file "spacemit-ort.riscv64.2.0.2+rc1.tar.gz")
+string(REPLACE "+" "%2B" onnxruntime_pkg_url_path "${onnxruntime_pkg_file}")
+set(onnxruntime_URL  "https://archive.spacemit.com/spacemit-ai/onnxruntime/${onnxruntime_pkg_url_path}")
@@
-  $ENV{HOME}/Downloads/${onnxruntime_pkg_name}
-  ${CMAKE_SOURCE_DIR}/${onnxruntime_pkg_name}
-  ${CMAKE_BINARY_DIR}/${onnxruntime_pkg_name}
-  /tmp/${onnxruntime_pkg_name}
-  /star-fj/fangjun/download/github/${onnxruntime_pkg_name}
+  $ENV{HOME}/Downloads/${onnxruntime_pkg_file}
+  ${CMAKE_SOURCE_DIR}/${onnxruntime_pkg_file}
+  ${CMAKE_BINARY_DIR}/${onnxruntime_pkg_file}
+  /tmp/${onnxruntime_pkg_file}
+  /star-fj/fangjun/download/github/${onnxruntime_pkg_file}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmake/onnxruntime-linux-riscv64-spacemit.cmake` around lines 16 - 29, The
package filename variable onnxruntime_pkg_name should contain the unescaped '+'
(e.g., spacemit-ort.riscv64.2.0.2+rc1.tar.gz) so possible_file_locations matches
locally downloaded archives; update onnxruntime_pkg_name to use the literal '+'
and change onnxruntime_URL to use an encoded form for the URL segment (e.g.,
derive an encoded_pkg_name for the URL or URL-encode only when constructing
onnxruntime_URL) so network fetch still uses %2B while offline file lookup uses
the actual '+' filename.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@cmake/onnxruntime-linux-riscv64-spacemit.cmake`:
- Around line 16-29: The package filename variable onnxruntime_pkg_name should
contain the unescaped '+' (e.g., spacemit-ort.riscv64.2.0.2+rc1.tar.gz) so
possible_file_locations matches locally downloaded archives; update
onnxruntime_pkg_name to use the literal '+' and change onnxruntime_URL to use an
encoded form for the URL segment (e.g., derive an encoded_pkg_name for the URL
or URL-encode only when constructing onnxruntime_URL) so network fetch still
uses %2B while offline file lookup uses the actual '+' filename.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3370824c-5835-4611-8088-4e74e7785449

📥 Commits

Reviewing files that changed from the base of the PR and between 90f3020 and b97ec01.

📒 Files selected for processing (1)
  • cmake/onnxruntime-linux-riscv64-spacemit.cmake

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the Spacemit RISC-V64 ONNX Runtime package filename to use URL-encoded formatting so the download URL resolves correctly.

Changes:

  • URL-encode the + character in the ONNX Runtime tarball name (%2B).
  • Keep the computed download URL consistent with the new package name format.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

endif()

set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2+rc1.tar.gz")
set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2%2Brc1.tar.gz")

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encoding + as %2B changes the downloaded artifact bytes if the server previously served the unencoded + filename; the onnxruntime_HASH may no longer match. Please verify the URL resolves to the intended tarball and update onnxruntime_HASH to the SHA256 of the artifact actually fetched from this URL.

Suggested change
set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2%2Brc1.tar.gz")
set(onnxruntime_pkg_name "spacemit-ort.riscv64.2.0.2+rc1.tar.gz")

Copilot uses AI. Check for mistakes.
@alex-spacemit

Copy link
Copy Markdown
Contributor Author

@csukuangfj csukuangfj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@csukuangfj
csukuangfj merged commit 5b1822f into k2-fsa:master Apr 8, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants