docker-library / busybox

Docker Official Image packaging for Busybox
http://busybox.net
396 stars 127 forks source link

Add riscv64 #106

Closed tianon closed 3 years ago

tianon commented 3 years ago

Closes #87

See also docker-library/official-images#10502 :eyes:

tianon commented 3 years ago

Here's the companion code for https://github.com/docker-library/oi-janky-groovy:

Diff: ```diff diff --git a/tianon/busybox/arch-pipeline.groovy b/tianon/busybox/arch-pipeline.groovy index 97bcfd3..352992f 100644 --- a/tianon/busybox/arch-pipeline.groovy +++ b/tianon/busybox/arch-pipeline.groovy @@ -64,6 +64,11 @@ node(vars.node(env.ACT_ON_ARCH, env.ACT_ON_IMAGE)) { .github/workflows/fake-gsl.sh \\ | awk -F ': ' '$1 == "Directory" { print $2 "/Dockerfile.builder" }' \\ | xargs -rt sed -ri -e "s!^FROM !FROM $TARGET_NAMESPACE/!" + + # Debian Ports means unstable only + if [ "$ACT_ON_ARCH" = 'riscv64' ]; then + sed -ri -e 's!^(FROM [^:]+):[^-]+!\\1:unstable!' */uclibc/Dockerfile.builder + fi ''' } @@ -96,7 +101,9 @@ node(vars.node(env.ACT_ON_ARCH, env.ACT_ON_IMAGE)) { for (variant in variants) { withEnv(['variant=' + variant]) { stage(variant) { - sh ''' + sh '''#!/usr/bin/env bash + set -Eeuo pipefail -x + from="$(gawk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile.builder")" if ! docker inspect --type image "$from" > /dev/null 2>&1; then @@ -107,8 +114,15 @@ node(vars.node(env.ACT_ON_ARCH, env.ACT_ON_IMAGE)) { exit fi + v="$(basename "$variant")" # "uclibc", "glibc", etc + if [ "$v" = 'glibc' ] && [[ "$from" == *unstable* ]]; then + # skip glibc + unstable -> this means Debian Ports, and we don't want glibc from unstable (riscv64 is supported by uclibc) + echo >&2 "warning: $variant is 'FROM $from', which is unstable -- skipping" + rm -rf "$variant" + exit + fi + if ! ./build.sh "$variant"; then - v="$(basename "$variant")" # "uclibc", "glibc", etc case "$ACT_ON_ARCH/$v" in # expected failures (missing toolchain support, etc) ppc64le/uclibc | s390x/uclibc) diff --git a/tianon/busybox/generate-pipeline.groovy b/tianon/busybox/generate-pipeline.groovy index 1cf890c..2d84158 100644 --- a/tianon/busybox/generate-pipeline.groovy +++ b/tianon/busybox/generate-pipeline.groovy @@ -17,6 +17,7 @@ arches = [ 'i386', 'mips64le', 'ppc64le', + 'riscv64', 's390x', ] as Set ```