xx-apt: riscv64 support since debian trixie

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-07-09 10:18:03 +02:00
parent af407bc41d
commit 742154cd81
4 changed files with 48 additions and 11 deletions

View File

@@ -88,7 +88,7 @@ COPY test-windres.bats test_helper.bash ./
RUN --mount=type=cache,target=/pkg-cache,sharing=locked ./test-windres.bats
FROM test-base AS test-apt
COPY test-apt.bats .
COPY test-apt.bats test_helper.bash ./
RUN --mount=type=cache,target=/pkg-cache,sharing=locked [ ! -f /etc/debian_version ] || ./test-apt.bats
FROM test-base AS test-apk

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bats
load 'assert'
load 'test_helper'
@test "no_cmd" {
run xx-apt
@@ -204,6 +205,33 @@ load 'assert'
assert_line "Package: gcc-i686-linux-gnu"
}
@test "riscv64" {
if ! supportRiscV; then
skip "RISC-V not supported"
fi
export TARGETARCH=riscv64
if ! xx-info is-cross; then return; fi
run xx-apt show file
assert_success
assert_line "Package: file:riscv64"
run xx-apt show libc6-dev
assert_success
assert_line "Package: libc6-dev:riscv64"
export XX_APT_PREFER_CROSS=1
run xx-apt show libc6-dev
assert_success
assert_line "Package: libc6-dev-riscv64-cross"
unset XX_APT_PREFER_CROSS
run xx-apt show gcc
assert_success
assert_line "Package: gcc-riscv64-linux-gnu"
}
@test "skip-nolinux" {
export TARGETOS="darwin"
export TARGETARCH="amd64"

View File

@@ -68,13 +68,22 @@ xxrun() {
}
supportRiscV() {
if [ -f /etc/debian_version ]; then
if grep "sid main" /etc/apt/sources.list 2>/dev/null >/dev/null; then
return 0
else
return 1
fi
fi
case "$(. /etc/os-release; echo "$ID")" in
debian)
if [ "$(cut -d. -f 1 /etc/debian_version)" -lt 13 ]; then
return 1
else
return 0
fi
;;
ubuntu)
if ! grep 'VERSION="2' /etc/os-release >/dev/null 2>/dev/null; then
return 1
else
return 0
fi
;;
esac
return 0
}

View File

@@ -74,14 +74,14 @@ case "${TARGETARCH}" in
riscv*)
case "${XX_VENDOR}" in
debian)
if ! grep "sid main" "$(aptsourcesfile)" >/dev/null; then
echo >&2 "skipping packages installation on ${XX_ARCH}. riscv64 currently only supported on sid"
if [ "$(cut -d. -f 1 /etc/debian_version)" -lt 13 ]; then
echo >&2 "skipping packages installation on ${XX_ARCH}. riscv64 requires debian 13+"
exit 0
fi
;;
ubuntu)
if ! grep 'VERSION="2' /etc/os-release >/dev/null 2>/dev/null; then
echo >&2 "skipping packages installation on ${XX_ARCH}. riscv64 requires 20.04+"
echo >&2 "skipping packages installation on ${XX_ARCH}. riscv64 requires ubuntu 20.04+"
exit 0
fi
;;