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

Be nicer to non-amd64 hosts #452

Merged
merged 2 commits into from
Dec 30, 2023
Merged

Conversation

a-wai
Copy link
Contributor

@a-wai a-wai commented Dec 1, 2023

With fakemachine now being compatible with arm64 hosts, it is possible to build and run debos on this architecture. However, it will still assume it runs on amd64, hence executing actions in the chroot through qemu and calling debootstrap with the --foreign flag set, even when building for the same architecture.

This PR makes use of runtime architecture detection to avoid those unnecessary tricks.

Currently, we assume `debos` will run only on `amd64` hosts. However,
`fakemachine` recently gained the ability to run on `arm64` hosts, so we
shouldn't make this assumption anymore.

This change only sets the path to `qemu` when building for a foreign
arch, instead of setting it for all architectures except x86 ones.

Signed-off-by: Arnaud Ferraris <[email protected]>
This change marks the target architecture as "foreign" if it differs
from the current host architecture, instead of hardcoding an expected
host architecture.

Due to Debian architectures not translating directly to their Go
equivalents (like `mips*el` being `mips*le` instead, or `i386` being
simply `386` in Go), this will only work for `amd64`, `arm64` and
`riscv64` hosts. However, it seems unlikely running `debos` on a 32-bit
host (or even on `mips64el`) will become a compelling use-case in the
future, making this issue an acceptable limitation.

Signed-off-by: Arnaud Ferraris <[email protected]>
@sjoerdsimons sjoerdsimons added this pull request to the merge queue Dec 30, 2023
@sjoerdsimons sjoerdsimons removed this pull request from the merge queue due to a manual request Dec 30, 2023
@sjoerdsimons sjoerdsimons added this pull request to the merge queue Dec 30, 2023
Merged via the queue into go-debos:main with commit 7c002db Dec 30, 2023
32 checks passed
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.

2 participants