diff options
author | Martin Emde <[email protected]> | 2023-08-30 15:15:52 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-10-23 13:59:01 +0900 |
commit | 92f23a48e3bb7555ca99fc49e15b250a70f9d086 (patch) | |
tree | bd583abe4555696c8b68d141f7f51d8755b2e96e /lib/bundler/lockfile_parser.rb | |
parent | c5fd94073ff2e22b6eea29c242c7e4a12ed7c865 (diff) |
[rubygems/rubygems] Refactor Checksum classes and methods to reduce
code.
(https://github.com/rubygems/rubygems/pull/6917)
https://github.com/rubygems/rubygems/commit/2238bdaadc
Diffstat (limited to 'lib/bundler/lockfile_parser.rb')
-rw-r--r-- | lib/bundler/lockfile_parser.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index 43d544fd32..9ffe5beffd 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -225,19 +225,16 @@ module Bundler version = Gem::Version.new(version) platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY - source = "#{@lockfile_path}:#{@pos} in the CHECKSUMS lockfile section" - checksums = checksums.split(",").map do |c| - algo, digest = c.split("-", 2) - Checksum::Single.new(algo, digest, source) - end - full_name = GemHelpers.spec_full_name(name, version, platform) - # Don't raise exception if there's a checksum for a gem that's not in the lockfile, # we prefer to heal invalid lockfiles return unless spec = @specs[full_name] - spec.source.checksum_store.register_full_name(full_name, checksums) + checksums.split(",").each do |c| + algo, digest = c.split("-", 2) + lock_name = GemHelpers.lock_name(spec.name, spec.version, spec.platform) + spec.source.checksum_store.register(full_name, Checksum.new(algo, digest, "#{@lockfile_path}:#{@pos} CHECKSUMS #{lock_name}")) + end end def parse_spec(line) |