[rubygems/rubygems] Avoid concurrent builds of Bundler when running specs

Instead, build it during setup when in CI.

This should avoid some Windows specific test failures when Bundler
copies the same files from multiple processes and runs into EACESS
errors.

https://github.com/rubygems/rubygems/commit/c194a1d753
This commit is contained in:
David Rodriguez 2024-02-02 21:15:26 +01:00 коммит произвёл git
Родитель 176c4bb3c7
Коммит 5f8375381b
4 изменённых файлов: 35 добавлений и 11 удалений

Просмотреть файл

@ -87,11 +87,10 @@ RSpec.configure do |config|
# Don't wrap output in tests
ENV["THOR_COLUMNS"] = "10000"
extend(Spec::Helpers)
system_gems :bundler, path: pristine_system_gem_path
end
Spec::Helpers.install_dev_bundler unless ENV["CI"]
extend(Spec::Builders)
config.before :all do
check_test_gems!
build_repo1

Просмотреть файл

@ -5,6 +5,11 @@ require "shellwords"
module Spec
module Builders
def self.extended(mod)
mod.extend Path
mod.extend Helpers
end
def self.constantize(name)
name.delete("-").upcase
end
@ -22,7 +27,7 @@ module Spec
end
def build_repo1
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first
build_repo gem_repo1 do
FileUtils.cp rake_path, "#{gem_repo1}/gems/"
@ -240,12 +245,12 @@ module Spec
end
def check_test_gems!
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first
if rake_path.nil?
FileUtils.rm_rf(Path.base_system_gems)
FileUtils.rm_rf(base_system_gems)
Spec::Rubygems.install_test_deps
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
rake_path = Dir["#{base_system_gems}/**/rake*.gem"].first
end
if rake_path.nil?
@ -261,9 +266,9 @@ module Spec
@_build_path = "#{path}/gems"
@_build_repo = File.basename(path)
yield
with_gem_path_as Path.base_system_gem_path do
Dir[Spec::Path.base_system_gem_path.join("gems/rubygems-generate_index*/lib")].first ||
raise("Could not find rubygems-generate_index lib directory in #{Spec::Path.base_system_gem_path}")
with_gem_path_as base_system_gem_path do
Dir[base_system_gem_path.join("gems/rubygems-generate_index*/lib")].first ||
raise("Could not find rubygems-generate_index lib directory in #{base_system_gem_path}")
command = "generate_index"
command += " --no-compact" if !build_compact_index && gem_command(command + " --help").include?("--[no-]compact")

Просмотреть файл

@ -11,6 +11,12 @@ module Spec
include Spec::Options
include Spec::Subprocess
def self.extended(mod)
mod.extend Spec::Path
mod.extend Spec::Options
mod.extend Spec::Subprocess
end
def reset!
Dir.glob("#{tmp}/{gems/*,*}", File::FNM_DOTMATCH).each do |dir|
next if %w[base base_system remote1 rubocop standard gems rubygems . ..].include?(File.basename(dir))
@ -267,6 +273,12 @@ module Spec
end
end
def self.install_dev_bundler
extend self
system_gems :bundler, path: pristine_system_gem_path
end
def install_gem(path, install_dir, default = false)
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
@ -277,6 +289,8 @@ module Spec
end
def with_built_bundler(version = nil, &block)
require_relative "builders"
Builders::BundlerBuilder.new(self, "bundler", version)._build(&block)
end

Просмотреть файл

@ -75,9 +75,15 @@ module Spec
end
def install_test_deps
Gem.clear_paths
install_gems(test_gemfile, Path.base_system_gems.to_s)
install_gems(rubocop_gemfile, Path.rubocop_gems.to_s)
install_gems(standard_gemfile, Path.standard_gems.to_s)
# For some reason, doing this here crashes on JRuby + Windows. So defer to
# when the test suite is running in that case.
Helpers.install_dev_bundler unless Gem.win_platform? && RUBY_ENGINE == "jruby"
end
def check_source_control_changes(success_message:, error_message:)