Skip to content
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

Add RPM support to bashbrew-host-arch.sh (via querying RPM's own architecture) #96

Merged
merged 1 commit into from
May 29, 2024

Conversation

tianon
Copy link
Member

@tianon tianon commented May 29, 2024

This should be more reliable/correct than uname -m (because we're almost always looking for the userspace architecture, not the kernel architecture).

(With special thanks to @grooverdan, who I imagine is getting tired of seeing GitHub notifications from my excitement about finally having a clean solution to this that feels so obvious in hindsight 😂 ❤️)

…chitecture)

This should be more reliable/correct than `uname -m` (because we're almost always looking for the *userspace* architecture, not the kernel architecture).
@tianon tianon requested a review from yosifkit as a code owner May 29, 2024 17:40
Copy link

@whalelines whalelines left a comment

Choose a reason for hiding this comment

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

LGTM

@tianon
Copy link
Member Author

tianon commented May 29, 2024

A few example runs:

$ docker run --rm --mount "type=bind,src=$PWD,dst=/foo,ro" -w /foo --platform linux/arm64/v8 oraclelinux:8-slim bash -x ./bashbrew-host-arch.sh
+ set -Eeuo pipefail
+ arch=
+ command -v apk
+ command -v dpkg
+ command -v rpm
++ rpm --query '--queryformat=%{ARCH}' rpm
+ tryArch=aarch64
+ arch=aarch64
+ case "$arch" in
+ found arm64v8
+ echo arm64v8
arm64v8
+ exit

$ docker run --rm --mount "type=bind,src=$PWD,dst=/foo,ro" -w /foo --platform linux/arm64/v8 redhat/ubi9-minimal bash -x ./bashbrew-host-arch.sh
+ set -Eeuo pipefail
+ arch=
+ command -v apk
+ command -v dpkg
+ command -v rpm
++ rpm --query '--queryformat=%{ARCH}' rpm
+ tryArch=aarch64
+ arch=aarch64
+ case "$arch" in
+ found arm64v8
+ echo arm64v8
arm64v8
+ exit

$ docker run --rm --mount "type=bind,src=$PWD,dst=/foo,ro" -w /foo --platform linux/ppc64le redhat/ubi9-minimal bash -x ./bashbrew-host-arch.sh
+ set -Eeuo pipefail
+ arch=
+ command -v apk
+ command -v dpkg
+ command -v rpm
++ rpm --query '--queryformat=%{ARCH}' rpm
+ tryArch=ppc64le
+ arch=ppc64le
+ case "$arch" in
+ found ppc64le
+ echo ppc64le
ppc64le
+ exit

@@ -28,7 +30,8 @@ case "$arch" in
amd64 | x86_64) found 'amd64' ;;
arm64 | aarch64) found 'arm64v8' ;;
armel) found 'arm32v5' ;;
armv7) found 'arm32v7' ;;
armv6*) found 'arm32v6' ;;
Copy link
Member Author

Choose a reason for hiding this comment

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

Technically, I could add arm32v5 here too, but I don't think we want to encourage arm32v5 users -- their time is just shy of completely up. 😅

@tianon
Copy link
Member Author

tianon commented May 29, 2024

(CI failure is the classic Codecov failure we haven't dealt with by excising Codecov in favor of something else yet 🙃)

@yosifkit yosifkit merged commit 10343d3 into docker-library:master May 29, 2024
5 of 6 checks passed
@yosifkit yosifkit deleted the rpm-host-arch branch May 29, 2024 21:31
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.

3 participants