Skip to content

Commit

Permalink
debootstrap_action: don't assume the host is amd64
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
a-wai authored and sjoerdsimons committed Dec 30, 2023
1 parent b11b334 commit ac477e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions actions/debootstrap_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
"os"
"path"
"strings"
"runtime"

"github.com/go-debos/debos"
"github.com/go-debos/fakemachine"
Expand Down Expand Up @@ -212,8 +213,8 @@ func (d *DebootstrapAction) Run(context *debos.DebosContext) error {
cmdline = append(cmdline, fmt.Sprintf("--components=%s", s))
}

/* FIXME drop the hardcoded amd64 assumption" */
foreign := context.Architecture != "amd64"
/* Only works for amd64, arm64 and riscv64 hosts, which should be enough */
foreign := context.Architecture != runtime.GOARCH

if foreign {
cmdline = append(cmdline, "--foreign")
Expand Down

0 comments on commit ac477e6

Please sign in to comment.