diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9360db..9a17340 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,6 @@ jobs: steps: - uses: actions/checkout@v4 - run: git clone https://github.com/docker-library/official-images.git ~/official-images - - run: docker build -t rust:$RUST_VERSION-${{ matrix.name }} $RUST_VERSION/${{ matrix.variant }} + - run: docker build -t rust:$RUST_VERSION-${{ matrix.name }} stable/${{ matrix.variant }} - run: ~/official-images/test/run.sh rust:$RUST_VERSION-${{ matrix.name }} - run: docker images diff --git a/1.81.0/alpine3.19/Dockerfile b/stable/alpine3.19/Dockerfile similarity index 100% rename from 1.81.0/alpine3.19/Dockerfile rename to stable/alpine3.19/Dockerfile diff --git a/1.81.0/alpine3.20/Dockerfile b/stable/alpine3.20/Dockerfile similarity index 100% rename from 1.81.0/alpine3.20/Dockerfile rename to stable/alpine3.20/Dockerfile diff --git a/1.81.0/bookworm/Dockerfile b/stable/bookworm/Dockerfile similarity index 100% rename from 1.81.0/bookworm/Dockerfile rename to stable/bookworm/Dockerfile diff --git a/1.81.0/bookworm/slim/Dockerfile b/stable/bookworm/slim/Dockerfile similarity index 100% rename from 1.81.0/bookworm/slim/Dockerfile rename to stable/bookworm/slim/Dockerfile diff --git a/1.81.0/bullseye/Dockerfile b/stable/bullseye/Dockerfile similarity index 100% rename from 1.81.0/bullseye/Dockerfile rename to stable/bullseye/Dockerfile diff --git a/1.81.0/bullseye/slim/Dockerfile b/stable/bullseye/slim/Dockerfile similarity index 100% rename from 1.81.0/bullseye/slim/Dockerfile rename to stable/bullseye/slim/Dockerfile diff --git a/x.py b/x.py index e9ebb8d..b05027b 100755 --- a/x.py +++ b/x.py @@ -6,10 +6,16 @@ import subprocess import sys -stable_rust_version = "1.81.0" -supported_rust_versions = [stable_rust_version, "nightly"] rustup_version = "1.27.1" +Channel = namedtuple("Channel", ["name", "rust_version"]) +stable = Channel("stable", "1.81.0") +nightly = Channel("nightly", "nightly") +supported_channels = [ + stable, + nightly +] + DebianArch = namedtuple("DebianArch", ["bashbrew", "dpkg", "qemu", "rust"]) debian_arches = [ @@ -75,20 +81,20 @@ def update_debian(): case = arch_case case += end - for rust_version in supported_rust_versions: + for channel in supported_channels: rendered = template \ - .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUST-VERSION%%", channel.rust_version) \ .replace("%%RUSTUP-VERSION%%", rustup_version) \ .replace("%%DEBIAN-SUITE%%", variant) \ .replace("%%ARCH-CASE%%", case) - write_file(f"{rust_version}/{variant}/Dockerfile", rendered) + write_file(f"{channel.name}/{variant}/Dockerfile", rendered) rendered = slim_template \ - .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUST-VERSION%%", channel.rust_version) \ .replace("%%RUSTUP-VERSION%%", rustup_version) \ .replace("%%DEBIAN-SUITE%%", variant) \ .replace("%%ARCH-CASE%%", case) - write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered) + write_file(f"{channel.name}/{variant}/slim/Dockerfile", rendered) def update_alpine(): arch_case = 'apkArch="$(apk --print-arch)"; \\\n' @@ -102,13 +108,13 @@ def update_alpine(): template = read_file("Dockerfile-alpine.template") for version in alpine_versions: - for rust_version in supported_rust_versions: + for channel in supported_channels: rendered = template \ - .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUST-VERSION%%", channel.rust_version) \ .replace("%%RUSTUP-VERSION%%", rustup_version) \ .replace("%%TAG%%", version) \ .replace("%%ARCH-CASE%%", arch_case) - write_file(f"{rust_version}/alpine{version}/Dockerfile", rendered) + write_file(f"{channel.name}/alpine{version}/Dockerfile", rendered) def update_ci(): file = ".github/workflows/ci.yml" @@ -116,7 +122,7 @@ def update_ci(): marker = "#RUST_VERSION\n" split = config.split(marker) - rendered = split[0] + marker + f" RUST_VERSION: {stable_rust_version}\n" + marker + split[2] + rendered = split[0] + marker + f" RUST_VERSION: {stable.rust_version}\n" + marker + split[2] versions = "" for variant in debian_variants: @@ -195,7 +201,7 @@ def file_commit(file): .strip() def version_tags(): - parts = stable_rust_version.split(".") + parts = stable.rust_version.split(".") tags = [] for i in range(len(parts)): tags.append(".".join(parts[:i + 1])) @@ -235,7 +241,7 @@ def generate_stackbrew_library(): library += single_library( tags, map(lambda a: a.bashbrew, arches), - os.path.join(stable_rust_version, variant)) + os.path.join(stable.name, variant)) tags = [] for version_tag in version_tags(): @@ -249,7 +255,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.name, variant, "slim")) for version in alpine_versions: tags = [] @@ -264,7 +270,7 @@ def generate_stackbrew_library(): library += single_library( tags, map(lambda a: a.bashbrew, alpine_arches), - os.path.join(stable_rust_version, f"alpine{version}")) + os.path.join(stable.name, f"alpine{version}")) print(library)