Skip to content

Commit

Permalink
Merge pull request #214 from Muscraft/bullseye-lts
Browse files Browse the repository at this point in the history
fix: Remove non-LTS arches from bullseye
  • Loading branch information
Muscraft authored Oct 5, 2024
2 parents 9f28728 + 8c704a6 commit edd6fb8
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions 1.81.0/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
2 changes: 0 additions & 2 deletions 1.81.0/bullseye/slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
2 changes: 0 additions & 2 deletions nightly/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
2 changes: 0 additions & 2 deletions nightly/bullseye/slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
77 changes: 40 additions & 37 deletions x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -59,36 +64,34 @@ 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'

template = read_file("Dockerfile-debian.template")
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'
Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand Down Expand Up @@ -223,33 +226,33 @@ 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")

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 = []
Expand Down

0 comments on commit edd6fb8

Please sign in to comment.