[rubygems/rubygems] Fix gem install sometimes compiling the wrong source files

If a previous copy of a gem is already installed, RubyGems will not
reinstall the gem but only recompile its extensions. This seems like a
good idea, but only if the gem is being installed from the registry.

If we are installing a locally built package, then the package should be
completely reinstalled and extensions compiled from the sources in the
locally built package, not from the sources in the previous
installation.

1c282d98d5
This commit is contained in:
David Rodríguez 2025-06-12 19:48:36 +02:00 committed by Hiroshi SHIBATA
parent 0c2f0ffa60
commit 0a62e82ac4
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 55 additions and 6 deletions

View file

@ -181,13 +181,10 @@ class Gem::RequestSet
# Install requested gems after they have been downloaded
sorted_requests.each do |req|
if req.installed?
if req.installed? && @always_install.none? {|spec| spec == req.spec.spec }
req.spec.spec.build_extensions
if @always_install.none? {|spec| spec == req.spec.spec }
yield req, nil if block_given?
next
end
yield req, nil if block_given?
next
end
spec =