diff options
author | Thong Kuah <tkuah@gitlab.com> | 2022-08-01 11:42:18 +1200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-10-23 13:59:01 +0900 |
commit | ad08674d8dc17c4ca031ce20760c4a4779c83e27 (patch) | |
tree | bf4958d6f06c36051f9c65e53c9e615ea1d978b2 /lib/bundler/lockfile_generator.rb | |
parent | 2d468358a516f575d013f07801079e0906c61f0c (diff) | |
download | ruby-ad08674d8dc17c4ca031ce20760c4a4779c83e27.tar.gz |
[rubygems/rubygems] Add CHECKSUMS for each gem in lockfile
We lock the checksum for each resolved spec under a new CHECKSUMS
section in the lockfile.
If the locked spec does not resolve for the local platform, we preserve
the locked checksum, similar to how we preserve specs.
Checksum locking only makes sense on install. The compact index
information is only available then.
https://github.com/rubygems/rubygems/commit/bde37ca6bf
Diffstat (limited to 'lib/bundler/lockfile_generator.rb')
-rw-r--r-- | lib/bundler/lockfile_generator.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/lockfile_generator.rb b/lib/bundler/lockfile_generator.rb index f7ba51b3e6..11e8e3f103 100644 --- a/lib/bundler/lockfile_generator.rb +++ b/lib/bundler/lockfile_generator.rb @@ -19,6 +19,7 @@ module Bundler add_sources add_platforms add_dependencies + add_checksums add_locked_ruby_version add_bundled_with @@ -65,6 +66,24 @@ module Bundler end end + def add_checksums + out << "\nCHECKSUMS\n" + + definition.resolve.sort_by(&:full_name).each do |spec| + checksum = spec.to_checksum if spec.respond_to?(:to_checksum) + + #if spec.is_a?(LazySpecification) + #spec.materialize_for_checksum do + #checksum ||= spec.to_checksum if spec.respond_to?(:to_checksum) + #end + #end + + checksum ||= definition.locked_checksums.find {|c| c.match_spec?(spec) } + + out << checksum.to_lock if checksum + end + end + def add_locked_ruby_version return unless locked_ruby_version = definition.locked_ruby_version add_section("RUBY VERSION", locked_ruby_version.to_s) |