From 36b7ad3caa72bc0638d528dcb18682b94ff89b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 14 Oct 2024 23:02:23 +0200 Subject: [rubygems/rubygems] Fix `bundle check` sometimes locking gems under the wrong source https://github.com/rubygems/rubygems/commit/1e5780db0a Co-authored-by: Taylor Thurlow --- lib/bundler/cli/check.rb | 2 +- lib/bundler/definition.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index 1f56834509..493eb3ec6a 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -15,7 +15,7 @@ module Bundler definition.validate_runtime! begin - definition.resolve_only_locally! + definition.check! not_installed = definition.missing_specs rescue GemNotFound, GitError, SolveFailure Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies." diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 80a2eb4714..66ca408c9a 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -163,7 +163,14 @@ module Bundler @gem_version_promoter ||= GemVersionPromoter.new end - def resolve_only_locally! + def check! + # If dependencies have changed, we need to resolve remotely. Otherwise, + # since we'll be resolving with a single local source, we may end up + # locking gems under the wrong source in the lockfile, and missing lockfile + # checksums + resolve_remotely! if @dependency_changes + + # Now do a local only resolve, to verify if any gems are missing locally sources.local_only! resolve end -- cgit v1.2.3