Skip to content

feat: add repo_utils.arch() and use rctx.os.arch where available.#1253

Open
mattyclarkson wants to merge 3 commits intobazel-contrib:mainfrom
mattyclarkson:repo-utils-arch
Open

feat: add repo_utils.arch() and use rctx.os.arch where available.#1253
mattyclarkson wants to merge 3 commits intobazel-contrib:mainfrom
mattyclarkson:repo-utils-arch

Conversation

@mattyclarkson
Copy link
Copy Markdown

Catch failing uname executions rather than returning empty strings.

@mattyclarkson mattyclarkson changed the title Add repo_utils.arch() and use rctx.os.arch where available. feat: add repo_utils.arch() and use rctx.os.arch where available. Apr 22, 2026
Provides the host CPU architecture.

Previously available within `repo_utils.platform()`, now an explicit function.

Review-by: Matthew Clarkson <matthew.clarkson@arm.com> # gatekeeper
Review-by: Matthew Clarkson <matthew.clarkson@arm.com> # gatekeeper
Available in Bazel 5.1.1+, it exposes the JVM `os.arch` string as lower case.

When available this allows avoiding execution of `uname`.

There _could_ be a possibility of `rctx.os.arch` not aligning with `uname -m` in all cases.

For the common CPU architectures, it does.

If there are cases where it diverges, new aliases can be added to align.

Review-by: Matthew Clarkson <matthew.clarkson@arm.com> # gatekeeper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant