From 8c704a64ade6da404029a302020a145be5a0127b Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Sat, 5 Oct 2024 12:39:47 -0600 Subject: [PATCH] fix: Remove non-LTS arches from bullseye --- .github/workflows/nightly.yml | 4 +- 1.81.0/bullseye/Dockerfile | 2 - 1.81.0/bullseye/slim/Dockerfile | 2 - nightly/bullseye/Dockerfile | 2 - nightly/bullseye/slim/Dockerfile | 2 - x.py | 77 +++++++++++++++++--------------- 6 files changed, 42 insertions(+), 47 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 69ebb7f..339c72e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -23,12 +23,12 @@ jobs: #VERSIONS - name: bullseye context: nightly/bullseye - platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386 tags: | nightly-bullseye - name: slim-bullseye context: nightly/bullseye/slim - platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386 tags: | nightly-bullseye-slim - name: bookworm diff --git a/1.81.0/bullseye/Dockerfile b/1.81.0/bullseye/Dockerfile index e89b0e7..2115fcc 100644 --- a/1.81.0/bullseye/Dockerfile +++ b/1.81.0/bullseye/Dockerfile @@ -14,8 +14,6 @@ RUN set -eux; \ armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3c4114923305f1cd3b96ce3454e9e549ad4aa7c07c03aec73d1a785e98388bed' ;; \ arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \ i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0a6bed6e9f21192a51f83977716466895706059afb880500ff1d0e751ada5237' ;; \ - ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='079430f58ad4da1d1f4f5f2f0bd321422373213246a93b3ddb53dad627f5aa38' ;; \ - s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e7f89da453c8ce5771c28279d1a01d5e83541d420695c74ec81a7ec5d287c51c' ;; \ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac; \ url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init"; \ diff --git a/1.81.0/bullseye/slim/Dockerfile b/1.81.0/bullseye/slim/Dockerfile index dd5917a..8f3f708 100644 --- a/1.81.0/bullseye/slim/Dockerfile +++ b/1.81.0/bullseye/slim/Dockerfile @@ -21,8 +21,6 @@ RUN set -eux; \ armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3c4114923305f1cd3b96ce3454e9e549ad4aa7c07c03aec73d1a785e98388bed' ;; \ arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \ i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0a6bed6e9f21192a51f83977716466895706059afb880500ff1d0e751ada5237' ;; \ - ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='079430f58ad4da1d1f4f5f2f0bd321422373213246a93b3ddb53dad627f5aa38' ;; \ - s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e7f89da453c8ce5771c28279d1a01d5e83541d420695c74ec81a7ec5d287c51c' ;; \ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac; \ url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init"; \ diff --git a/nightly/bullseye/Dockerfile b/nightly/bullseye/Dockerfile index 74e9e73..92c778a 100644 --- a/nightly/bullseye/Dockerfile +++ b/nightly/bullseye/Dockerfile @@ -14,8 +14,6 @@ RUN set -eux; \ armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3c4114923305f1cd3b96ce3454e9e549ad4aa7c07c03aec73d1a785e98388bed' ;; \ arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \ i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0a6bed6e9f21192a51f83977716466895706059afb880500ff1d0e751ada5237' ;; \ - ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='079430f58ad4da1d1f4f5f2f0bd321422373213246a93b3ddb53dad627f5aa38' ;; \ - s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e7f89da453c8ce5771c28279d1a01d5e83541d420695c74ec81a7ec5d287c51c' ;; \ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac; \ url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init"; \ diff --git a/nightly/bullseye/slim/Dockerfile b/nightly/bullseye/slim/Dockerfile index e948460..11336c8 100644 --- a/nightly/bullseye/slim/Dockerfile +++ b/nightly/bullseye/slim/Dockerfile @@ -21,8 +21,6 @@ RUN set -eux; \ armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3c4114923305f1cd3b96ce3454e9e549ad4aa7c07c03aec73d1a785e98388bed' ;; \ arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \ i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0a6bed6e9f21192a51f83977716466895706059afb880500ff1d0e751ada5237' ;; \ - ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='079430f58ad4da1d1f4f5f2f0bd321422373213246a93b3ddb53dad627f5aa38' ;; \ - s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e7f89da453c8ce5771c28279d1a01d5e83541d420695c74ec81a7ec5d287c51c' ;; \ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac; \ url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init"; \ diff --git a/x.py b/x.py index e9ebb8d..c0222ef 100755 --- a/x.py +++ b/x.py @@ -12,18 +12,23 @@ DebianArch = namedtuple("DebianArch", ["bashbrew", "dpkg", "qemu", "rust"]) -debian_arches = [ +debian_lts_arches = [ DebianArch("amd64", "amd64", "linux/amd64", "x86_64-unknown-linux-gnu"), DebianArch("arm32v7", "armhf", "linux/arm/v7", "armv7-unknown-linux-gnueabihf"), DebianArch("arm64v8", "arm64", "linux/arm64", "aarch64-unknown-linux-gnu"), DebianArch("i386", "i386", "linux/386", "i686-unknown-linux-gnu"), +] + +debian_non_lts_arches = [ DebianArch("ppc64le", "ppc64el", "linux/ppc64le", "powerpc64le-unknown-linux-gnu"), DebianArch("s390x", "s390x", "linux/s390x", "s390x-unknown-linux-gnu"), ] +DebianVariant = namedtuple("DebianVariant", ["name", "arches"]) + debian_variants = [ - "bullseye", - "bookworm", + DebianVariant("bullseye", debian_lts_arches), + DebianVariant("bookworm", debian_lts_arches + debian_non_lts_arches), ] default_debian_variant = "bookworm" @@ -59,12 +64,6 @@ def write_file(file, contents): f.write(contents) def update_debian(): - arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\\n' - arch_case += ' case "${dpkgArch##*-}" in \\\n' - for arch in debian_arches: - hash = rustup_hash(arch.rust) - arch_case += f" {arch.dpkg}) rustArch='{arch.rust}'; rustupSha256='{hash}' ;; \\\n" - end = ' *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \\\n' end += ' esac' @@ -72,23 +71,27 @@ def update_debian(): slim_template = read_file("Dockerfile-slim.template") for variant in debian_variants: - case = arch_case - case += end + arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\\n' + arch_case += ' case "${dpkgArch##*-}" in \\\n' + for arch in variant.arches: + hash = rustup_hash(arch.rust) + arch_case += f" {arch.dpkg}) rustArch='{arch.rust}'; rustupSha256='{hash}' ;; \\\n" + arch_case += end for rust_version in supported_rust_versions: rendered = template \ .replace("%%RUST-VERSION%%", rust_version) \ .replace("%%RUSTUP-VERSION%%", rustup_version) \ - .replace("%%DEBIAN-SUITE%%", variant) \ - .replace("%%ARCH-CASE%%", case) - write_file(f"{rust_version}/{variant}/Dockerfile", rendered) + .replace("%%DEBIAN-SUITE%%", variant.name) \ + .replace("%%ARCH-CASE%%", arch_case) + write_file(f"{rust_version}/{variant.name}/Dockerfile", rendered) rendered = slim_template \ .replace("%%RUST-VERSION%%", rust_version) \ .replace("%%RUSTUP-VERSION%%", rustup_version) \ - .replace("%%DEBIAN-SUITE%%", variant) \ - .replace("%%ARCH-CASE%%", case) - write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered) + .replace("%%DEBIAN-SUITE%%", variant.name) \ + .replace("%%ARCH-CASE%%", arch_case) + write_file(f"{rust_version}/{variant.name}/slim/Dockerfile", rendered) def update_alpine(): arch_case = 'apkArch="$(apk --print-arch)"; \\\n' @@ -120,10 +123,10 @@ def update_ci(): versions = "" for variant in debian_variants: - versions += f" - name: {variant}\n" - versions += f" variant: {variant}\n" - versions += f" - name: slim-{variant}\n" - versions += f" variant: {variant}/slim\n" + versions += f" - name: {variant.name}\n" + versions += f" variant: {variant.name}\n" + versions += f" - name: slim-{variant.name}\n" + versions += f" variant: {variant.name}/slim\n" for version in alpine_versions: versions += f" - name: alpine{version}\n" @@ -142,23 +145,23 @@ def update_nightly_ci(): versions = "" for variant in debian_variants: platforms = [] - for arch in debian_arches: + for arch in variant.arches: platforms.append(f"{arch.qemu}") platforms = ",".join(platforms) - tags = [f"nightly-{variant}"] - if variant == default_debian_variant: + tags = [f"nightly-{variant.name}"] + if variant.name == default_debian_variant: tags.append("nightly") - versions += f" - name: {variant}\n" - versions += f" context: nightly/{variant}\n" + versions += f" - name: {variant.name}\n" + versions += f" context: nightly/{variant.name}\n" versions += f" platforms: {platforms}\n" versions += f" tags: |\n" for tag in tags: versions += f" {tag}\n" - versions += f" - name: slim-{variant}\n" - versions += f" context: nightly/{variant}/slim\n" + versions += f" - name: slim-{variant.name}\n" + versions += f" context: nightly/{variant.name}/slim\n" versions += f" platforms: {platforms}\n" versions += f" tags: |\n" for tag in tags: @@ -223,25 +226,25 @@ def generate_stackbrew_library(): for variant in debian_variants: tags = [] for version_tag in version_tags(): - tags.append(f"{version_tag}-{variant}") - tags.append(variant) - if variant == default_debian_variant: + tags.append(f"{version_tag}-{variant.name}") + tags.append(variant.name) + if variant.name == default_debian_variant: for version_tag in version_tags(): tags.append(version_tag) tags.append("latest") - arches = debian_arches[:] + arches = variant.arches[:] library += single_library( tags, map(lambda a: a.bashbrew, arches), - os.path.join(stable_rust_version, variant)) + os.path.join(stable_rust_version, variant.name)) tags = [] for version_tag in version_tags(): - tags.append(f"{version_tag}-slim-{variant}") - tags.append(f"slim-{variant}") - if variant == default_debian_variant: + tags.append(f"{version_tag}-slim-{variant.name}") + tags.append(f"slim-{variant.name}") + if variant.name == default_debian_variant: for version_tag in version_tags(): tags.append(f"{version_tag}-slim") tags.append("slim") @@ -249,7 +252,7 @@ def generate_stackbrew_library(): library += single_library( tags, map(lambda a: a.bashbrew, arches), - os.path.join(stable_rust_version, variant, "slim")) + os.path.join(stable_rust_version, variant.name, "slim")) for version in alpine_versions: tags = []