[rubygems/rubygems] Add Specification#lock_name and use that when dealing with checksums

https://github.com/rubygems/rubygems/commit/8e2c5748d9
This commit is contained in:
David Rodríguez 2025-03-12 19:02:20 +01:00 committed by Hiroshi SHIBATA
parent 5bff692346
commit 9c1be12f99
Notes: git 2025-03-24 04:25:26 +00:00
3 changed files with 8 additions and 4 deletions

View File

@ -190,7 +190,7 @@ module Bundler
def replace(spec, checksum)
return unless checksum
lock_name = spec.name_tuple.lock_name
lock_name = spec.lock_name
@store_mutex.synchronize do
existing = fetch_checksum(lock_name, checksum.algo)
if !existing || existing.same_source?(checksum)
@ -204,7 +204,7 @@ module Bundler
def register(spec, checksum)
return unless checksum
register_checksum(spec.name_tuple.lock_name, checksum)
register_checksum(spec.lock_name, checksum)
end
def merge!(other)
@ -216,7 +216,7 @@ module Bundler
end
def to_lock(spec)
lock_name = spec.name_tuple.lock_name
lock_name = spec.lock_name
checksums = @store[lock_name]
if checksums
"#{lock_name} #{checksums.values.map(&:to_lock).sort.join(",")}"

View File

@ -262,6 +262,10 @@ module Gem
!default_gem? && !File.directory?(full_gem_path)
end
def lock_name
@lock_name ||= name_tuple.lock_name
end
unless VALIDATES_FOR_RESOLUTION
def validate_for_resolution
SpecificationPolicy.new(self).validate_for_resolution

View File

@ -138,7 +138,7 @@ RSpec.describe Bundler::LockfileParser do
expect(subject.ruby_version).to eq ruby_version
rake_spec = specs.last
checksums = subject.sources.last.checksum_store.to_lock(specs.last)
expect(checksums).to eq("#{rake_spec.name_tuple.lock_name} #{rake_checksums.map(&:to_lock).sort.join(",")}")
expect(checksums).to eq("#{rake_spec.lock_name} #{rake_checksums.map(&:to_lock).sort.join(",")}")
end
end