diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /vendor/gems/bundler-checksum/lib | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'vendor/gems/bundler-checksum/lib')
-rw-r--r-- | vendor/gems/bundler-checksum/lib/bundler/checksum/command/init.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/vendor/gems/bundler-checksum/lib/bundler/checksum/command/init.rb b/vendor/gems/bundler-checksum/lib/bundler/checksum/command/init.rb index fed0e11080f..47a9b676f1d 100644 --- a/vendor/gems/bundler-checksum/lib/bundler/checksum/command/init.rb +++ b/vendor/gems/bundler-checksum/lib/bundler/checksum/command/init.rb @@ -16,14 +16,22 @@ module Bundler::Checksum::Command .send(:compact_index_client) .instance_variable_get(:@cache) - seen = [] Bundler.definition.resolve.sort_by(&:name).each do |spec| next unless spec.source.is_a?(Bundler::Source::Rubygems) + spec_identifier = "#{spec.name}==#{spec.version}" - next if seen.include?(spec.name) - seen << spec.name + previous_checksum = previous_checksums.select do |checksum| + checksum[:name] == spec.name && checksum[:version] == spec.version.to_s + end + + if !previous_checksum.empty? + $stderr.puts "Using #{spec_identifier}" + checksums += previous_checksum + + next + end - $stderr.puts "Adding #{spec.name}==#{spec.version}" + $stderr.puts "Adding #{spec_identifier}" compact_index_dependencies = compact_index_cache.dependencies(spec.name).select { |item| item.first == spec.version.to_s } @@ -54,6 +62,15 @@ module Bundler::Checksum::Command private + def previous_checksums + @previous_checksums ||= + if File.exist?(checksum_file) + ::Bundler::Checksum.checksums_from_file + else + [] + end + end + def checksum_file ::Bundler::Checksum.checksum_file end |