Skip to content

Commit

Permalink
Clean up Ruby patch release overrides (#496)
Browse files Browse the repository at this point in the history
`RakeCompilerDock.cross_rubies` supplies the exact patch release
needed. This is available in rack-compiler-dock v1.9.1:

* rake-compiler/rake-compiler-dock#149
* https://github.com/rake-compiler/rake-compiler-dock/releases/tag/v1.9.1

This simplifies the `Dockerfile`, but it does mean we have to keep the
rake-compiler-dock version in the `Gemfile` in sync with all the
images in `docker/Dockerfile.*`.
  • Loading branch information
stanhu authored Jan 21, 2025
1 parent 81f2550 commit 4c3508f
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 33 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gemspec path: "examples/rust_reverse"
gem "rake", "~> 13.0"
gem "minitest", "5.15.0"
gem "rake-compiler", "~> 1.2.5" # Small bug in 1.2.4 that breaks Ruby 2.5
gem "rake-compiler-dock", "1.9.1" # This should match the versions used in docker/Dockerfile.*
gem "racc", "~> 1.7"
gem "base64", "~> 0.2.0"
gem "yard"
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.aarch64-linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-aarch64-linux
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-aarch64-linux

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="aarch64-linux" \
RUST_TARGET="aarch64-unknown-linux-gnu" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.aarch64-linux-musl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-aarch64-linux-musl
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-aarch64-linux-musl

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="aarch64-linux-musl" \
RUST_TARGET="aarch64-unknown-linux-musl" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.arm-linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-arm-linux
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-arm-linux

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="arm-linux" \
RUST_TARGET="arm-unknown-linux-gnueabihf" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.arm64-darwin
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-arm64-darwin
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-arm64-darwin

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="arm64-darwin" \
RUST_TARGET="aarch64-apple-darwin" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x64-mingw-ucrt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x64-mingw-ucrt
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x64-mingw-ucrt

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x64-mingw-ucrt" \
RUST_TARGET="x86_64-pc-windows-gnu" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x64-mingw32
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x64-mingw32
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x64-mingw32

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x64-mingw32" \
RUST_TARGET="x86_64-pc-windows-gnu" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x86-linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x86-linux
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x86-linux

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x86-linux" \
RUST_TARGET="i686-unknown-linux-gnu" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x86-mingw32
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x86-mingw32
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x86-mingw32

ARG LLVM_MINGW_VERSION=20231128 \
LLVM_MINGW_SHA256=2d532648bfd202bfe5edfa8b7f6c55970f65639779f34115a9a8bfa6f7d87f0b \
LLVM_MINGW_LIBCLANG_VERSION=14.0.0

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x86-mingw32" \
RUST_TARGET="i686-pc-windows-gnu" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x86_64-darwin
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x86_64-darwin
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x86_64-darwin

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x86_64-darwin" \
RUST_TARGET="x86_64-apple-darwin" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x86_64-linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x86_64-linux
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x86_64-linux

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x86_64-linux" \
RUST_TARGET="x86_64-unknown-linux-gnu" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile.x86_64-linux-musl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.8.0-mri-x86_64-linux-musl
# Ensure this version matches the rack-compiler-version in Gemfile
FROM ghcr.io/rake-compiler/rake-compiler-dock-image:1.9.1-mri-x86_64-linux-musl

ENV RUBY_CC_VERSION="3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10" \
ENV RUBY_CC_VERSION="3.4:3.3:3.2:3.1:3.0:2.7:2.6" \
RUBY_TARGET="x86_64-linux-musl" \
RUST_TARGET="x86_64-unknown-linux-musl" \
RUSTUP_DEFAULT_TOOLCHAIN="stable" \
Expand Down
13 changes: 2 additions & 11 deletions gem/exe/rb-sys-dock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)

require "optparse"
require "open3"
require "rake_compiler_dock"
require "rb_sys/version"
require "rb_sys/toolchain_info"
require "rb_sys/cargo/metadata"
Expand All @@ -17,16 +18,6 @@ OPTIONS = {
directory: Dir.pwd
}

PATCH_RELEASE_OVERRIDES = {
"2.6" => "2.6.10",
"2.7" => "2.7.8",
"3.0" => "3.0.7",
"3.1" => "3.1.6",
"3.2" => "3.2.6",
"3.3" => "3.3.5",
"3.4" => "3.4.1"
}

def cargo_metadata
return @cargo_metadata if defined?(@cargo_metadata)

Expand Down Expand Up @@ -110,7 +101,7 @@ OptionParser.new do |opts|

opts.on("-r", "--ruby-versions LIST", "List all supported Ruby versions") do |arg|
vers = arg.split(/[^0-9.]+/).map do |v|
override = PATCH_RELEASE_OVERRIDES[v]
override = RakeCompilerDock.cross_rubies[v]

next override if override

Expand Down

0 comments on commit 4c3508f

Please sign in to comment.