rubygems-update 3.6.6 → 3.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Manifest.txt +2 -1
  4. data/README.md +1 -1
  5. data/bundler/CHANGELOG.md +37 -6
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/checksum.rb +21 -11
  8. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -1
  9. data/bundler/lib/bundler/compact_index_client/parser.rb +1 -1
  10. data/bundler/lib/bundler/definition.rb +90 -65
  11. data/bundler/lib/bundler/dsl.rb +2 -3
  12. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  13. data/bundler/lib/bundler/installer.rb +1 -1
  14. data/bundler/lib/bundler/lazy_specification.rb +9 -1
  15. data/bundler/lib/bundler/lockfile_parser.rb +8 -5
  16. data/bundler/lib/bundler/plugin/api/source.rb +1 -1
  17. data/bundler/lib/bundler/plugin/installer/path.rb +8 -0
  18. data/bundler/lib/bundler/plugin.rb +1 -1
  19. data/bundler/lib/bundler/resolver/candidate.rb +1 -1
  20. data/bundler/lib/bundler/resolver/strategy.rb +40 -0
  21. data/bundler/lib/bundler/resolver.rb +11 -22
  22. data/bundler/lib/bundler/rubygems_ext.rb +15 -0
  23. data/bundler/lib/bundler/runtime.rb +8 -5
  24. data/bundler/lib/bundler/source/gemspec.rb +1 -4
  25. data/bundler/lib/bundler/source/git/git_proxy.rb +8 -3
  26. data/bundler/lib/bundler/source/path.rb +2 -2
  27. data/bundler/lib/bundler/source_list.rb +29 -11
  28. data/bundler/lib/bundler/spec_set.rb +27 -10
  29. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
  30. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  31. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
  32. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
  33. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
  34. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
  35. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
  36. data/bundler/lib/bundler/version.rb +1 -1
  37. data/doc/rubygems/CONTRIBUTING.md +0 -4
  38. data/lib/rubygems/commands/exec_command.rb +15 -6
  39. data/lib/rubygems/defaults.rb +1 -1
  40. data/lib/rubygems/resolver/api_set/gem_parser.rb +2 -5
  41. data/lib/rubygems/specification.rb +5 -5
  42. data/lib/rubygems/version.rb +22 -4
  43. data/lib/rubygems.rb +10 -7
  44. data/rubygems-update.gemspec +1 -1
  45. metadata +11 -10
  46. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9521350c1a716eef57fc59c91a1d81ff8f6806cc2cf1c909c75888aa18a486a
4
- data.tar.gz: 3f62199690949d037610115ea815ae128996298b663fe4417bb5848e71d7a96d
3
+ metadata.gz: d8c683b5b8ebeb45839a1e4e148c66e706823d2d3e79d168fce8745b9be194df
4
+ data.tar.gz: 245eb17bc84ee70ea02919f508d819a19570443a8e569c49fbe58e3d4ca77c92
5
5
  SHA512:
6
- metadata.gz: 6500bc219b6e8629740b729e793fbef6c3e7d2745b14562bb09e8d4bb327bb17de8f255e2a9635c48989c409b560a177cfd1062e77af1a07a7f4501426d71005
7
- data.tar.gz: 5ec01505dfa015e3f4d0ad051d0755d674baa431ac11f128f8d8fefcfb836ab8817794ca1b6f9aa7ce94b1e4dc6dc8421487cef788485a22016cd5dc144e68e1
6
+ metadata.gz: 73cb48fa32e961185618f1a9978f67c66b29f28597ebfb7c6c764e20d719336458884e0371ad49e9ef7a3bf7a3363850315984d43f189266a7852766924dff95
7
+ data.tar.gz: 2bbaeff8ede469f7e70beed2523517884d7fef8a69834a8df00feac62efdc0094a0a9f5c5388e689728d87033e351ffb2a6f1af5b65c3c63d51382f5807e1bbf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ # 3.6.8 / 2025-04-13
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.6.8 as a default gem.
6
+
7
+ # 3.6.7 / 2025-04-03
8
+
9
+ ## Enhancements:
10
+
11
+ * Sorting files in metadata for build reproducibility. Pull request
12
+ [#8569](https://github.com/rubygems/rubygems/pull/8569) by
13
+ giacomobenedetti
14
+ * Default to a SOURCE_DATE_EPOCH of 315619200, to simplify reproducible
15
+ builds. Pull request
16
+ [#8568](https://github.com/rubygems/rubygems/pull/8568) by duckinator
17
+ * Let `gem exec` raise an error in ambiguous cases. Pull request
18
+ [#8573](https://github.com/rubygems/rubygems/pull/8573) by
19
+ deivid-rodriguez
20
+ * Installs bundler 2.6.7 as a default gem.
21
+
22
+ ## Performance:
23
+
24
+ * Speed up Version#<=> ~20-50% when lengths differ. Pull request
25
+ [#8565](https://github.com/rubygems/rubygems/pull/8565) by skipkayhil
26
+
1
27
  # 3.6.6 / 2025-03-13
2
28
 
3
29
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -48,7 +48,6 @@ bundler/lib/bundler/cli/viz.rb
48
48
  bundler/lib/bundler/compact_index_client.rb
49
49
  bundler/lib/bundler/compact_index_client/cache.rb
50
50
  bundler/lib/bundler/compact_index_client/cache_file.rb
51
- bundler/lib/bundler/compact_index_client/gem_parser.rb
52
51
  bundler/lib/bundler/compact_index_client/parser.rb
53
52
  bundler/lib/bundler/compact_index_client/updater.rb
54
53
  bundler/lib/bundler/constants.rb
@@ -181,6 +180,7 @@ bundler/lib/bundler/resolver/incompatibility.rb
181
180
  bundler/lib/bundler/resolver/package.rb
182
181
  bundler/lib/bundler/resolver/root.rb
183
182
  bundler/lib/bundler/resolver/spec_group.rb
183
+ bundler/lib/bundler/resolver/strategy.rb
184
184
  bundler/lib/bundler/retry.rb
185
185
  bundler/lib/bundler/ruby_dsl.rb
186
186
  bundler/lib/bundler/ruby_version.rb
@@ -281,6 +281,7 @@ bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb
281
281
  bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb
282
282
  bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb
283
283
  bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb
284
+ bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb
284
285
  bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb
285
286
  bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb
286
287
  bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RubyGems [![Maintainability](https://api.codeclimate.com/v1/badges/30f913e9c2dd932132c1/maintainability)](https://codeclimate.com/github/rubygems/rubygems/maintainability)
1
+ # RubyGems
2
2
 
3
3
  RubyGems is a package management framework for Ruby.
4
4
 
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # 2.6.8 (April 13, 2025)
2
+
3
+ ## Enhancements:
4
+
5
+ - Refine `bundle update --verbose` logs [#8627](https://github.com/rubygems/rubygems/pull/8627)
6
+ - Improve bug report instructions [#8607](https://github.com/rubygems/rubygems/pull/8607)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Fix `bundle update` crash in an edge case [#8626](https://github.com/rubygems/rubygems/pull/8626)
11
+ - Fix `bundle lock --normalize-platforms` regression [#8620](https://github.com/rubygems/rubygems/pull/8620)
12
+
13
+ # 2.6.7 (April 3, 2025)
14
+
15
+ ## Enhancements:
16
+
17
+ - Fix crash when server compact index API implementation only lists versions [#8594](https://github.com/rubygems/rubygems/pull/8594)
18
+ - Fix lockfile when a gem ends up accidentally under two different sources [#8579](https://github.com/rubygems/rubygems/pull/8579)
19
+ - Refuse to install and print an error in frozen mode if some entries are missing in CHECKSUMS lockfile section [#8563](https://github.com/rubygems/rubygems/pull/8563)
20
+ - Support git 2.49 [#8581](https://github.com/rubygems/rubygems/pull/8581)
21
+ - Improve wording of a few messages [#8570](https://github.com/rubygems/rubygems/pull/8570)
22
+
23
+ ## Bug fixes:
24
+
25
+ - Fix `bundle add` sometimes generating invalid lockfiles [#8586](https://github.com/rubygems/rubygems/pull/8586)
26
+
27
+ ## Performance:
28
+
29
+ - Implement pub_grub strategy interface [#8589](https://github.com/rubygems/rubygems/pull/8589)
30
+ - Update vendored pub_grub [#8571](https://github.com/rubygems/rubygems/pull/8571)
31
+
1
32
  # 2.6.6 (March 13, 2025)
2
33
 
3
34
  ## Enhancements:
@@ -1318,7 +1349,7 @@
1318
1349
  - Enable parallel installation on Windows by default [#4822](https://github.com/rubygems/rubygems/pull/4822)
1319
1350
  - More logging when compact index is not used and we fallback to other APIs [#4546](https://github.com/rubygems/rubygems/pull/4546)
1320
1351
  - `bundle gem` generated MiniTest file and class now start with 'test' [#3893](https://github.com/rubygems/rubygems/pull/3893)
1321
- - Add `Bundler::Definition.no_lock` accessor for skipping lock file creation/update [#3401](https://github.com/rubygems/rubygems/pull/3401)
1352
+ - Add `Bundler::Definition.no_lock` accessor for skipping lockfile creation/update [#3401](https://github.com/rubygems/rubygems/pull/3401)
1322
1353
 
1323
1354
  ## Bug fixes:
1324
1355
 
@@ -2060,7 +2091,7 @@
2060
2091
  - Fix `bundle outdated --group NAME` when the group is listed second in the Gemfile ([#6116](https://github.com/rubygems/bundler/pull/6116))
2061
2092
  - Improve conflict resolution messages by not calling "ruby" a gem when conflict happens in the `required_ruby_version`, and by filtering out requirements that didn't contribute to the conflict ([#6647](https://github.com/rubygems/bundler/pull/6647))
2062
2093
  - Avoid fetching and rebuilding git gems whenever any gem is changed in the Gemfile ([#6711](https://github.com/rubygems/bundler/pull/6711))
2063
- - Include the exact bundler version in the lock file in the suggested command when bundler warns about version mismatches of itself [#6971](https://github.com/rubygems/bundler/pull/6971)
2094
+ - Include the exact bundler version in the lockfile in the suggested command when bundler warns about version mismatches of itself [#6971](https://github.com/rubygems/bundler/pull/6971)
2064
2095
  - Fix plugins being installed every time a command is run #[#6978](https://github.com/rubygems/bundler/pull/6978)
2065
2096
  - Fallback to sequentially fetching specs on 429s [#6728](https://github.com/rubygems/bundler/pull/6728)
2066
2097
  - Make `bundle clean` also clean native extensions for gems with a git source [#7058](https://github.com/rubygems/bundler/pull/7058)
@@ -3525,7 +3556,7 @@ Changes
3525
3556
 
3526
3557
  ## Bug fixes:
3527
3558
 
3528
- - Revert gem source sorting in lock files (@indirect)
3559
+ - Revert gem source sorting in lockfiles (@indirect)
3529
3560
 
3530
3561
  # 1.7.1 (August 20, 2014)
3531
3562
 
@@ -3625,7 +3656,7 @@ Changes
3625
3656
  - redirects across hosts now work on rubies without OpenSSL ([#2686](https://github.com/rubygems/bundler/issues/2686), @grddev)
3626
3657
  - gemspecs now handle filenames with newlines ([#2634](https://github.com/rubygems/bundler/issues/2634), @jasonmp85)
3627
3658
  - support escaped characters in usernames and passwords (@punkie)
3628
- - no more exception on `update GEM` without lock file (@simi)
3659
+ - no more exception on `update GEM` without lockfile (@simi)
3629
3660
  - allow long config values ([#2823](https://github.com/rubygems/bundler/issues/2823), @kgrz)
3630
3661
  - cache successfully even locked to gems shipped with Ruby ([#2869](https://github.com/rubygems/bundler/issues/2869), @aughr)
3631
3662
  - respect NO_PROXY even if a proxy is configured ([#2878](https://github.com/rubygems/bundler/issues/2878), @stlay)
@@ -3773,7 +3804,7 @@ Changes
3773
3804
 
3774
3805
  ## Bug fixes:
3775
3806
 
3776
- - make gemspec path option preserve relative paths in lock file (@bwillis)
3807
+ - make gemspec path option preserve relative paths in lockfile (@bwillis)
3777
3808
  - use umask when creating binstubs ([#1618](https://github.com/rubygems/bundler/issues/1618), @v-yarotsky)
3778
3809
  - warn if graphviz is not installed ([#2435](https://github.com/rubygems/bundler/issues/2435), @Agis-)
3779
3810
  - show git errors while loading gemspecs
@@ -4662,7 +4693,7 @@ Changes
4662
4693
  - Skeleton gemspec now works with older versions of git
4663
4694
  - Fix shell quoting and ref fetching in GemHelper
4664
4695
  - Disable colored output in --deployment
4665
- - Preserve line endings in lock file
4696
+ - Preserve line endings in lockfile
4666
4697
 
4667
4698
  ## Features:
4668
4699
 
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2025-03-13".freeze
8
- @git_commit_sha = "25cf0763954".freeze
7
+ @built_at = "1980-01-02".freeze
8
+ @git_commit_sha = "2a353e42e2e".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -190,7 +190,7 @@ module Bundler
190
190
  def replace(spec, checksum)
191
191
  return unless checksum
192
192
 
193
- lock_name = spec.name_tuple.lock_name
193
+ lock_name = spec.lock_name
194
194
  @store_mutex.synchronize do
195
195
  existing = fetch_checksum(lock_name, checksum.algo)
196
196
  if !existing || existing.same_source?(checksum)
@@ -201,10 +201,12 @@ module Bundler
201
201
  end
202
202
  end
203
203
 
204
- def register(spec, checksum)
205
- return unless checksum
204
+ def missing?(spec)
205
+ @store[spec.lock_name].nil?
206
+ end
206
207
 
207
- register_checksum(spec.name_tuple.lock_name, checksum)
208
+ def register(spec, checksum)
209
+ register_checksum(spec.lock_name, checksum)
208
210
  end
209
211
 
210
212
  def merge!(other)
@@ -216,9 +218,9 @@ module Bundler
216
218
  end
217
219
 
218
220
  def to_lock(spec)
219
- lock_name = spec.name_tuple.lock_name
221
+ lock_name = spec.lock_name
220
222
  checksums = @store[lock_name]
221
- if checksums
223
+ if checksums&.any?
222
224
  "#{lock_name} #{checksums.values.map(&:to_lock).sort.join(",")}"
223
225
  else
224
226
  lock_name
@@ -229,11 +231,15 @@ module Bundler
229
231
 
230
232
  def register_checksum(lock_name, checksum)
231
233
  @store_mutex.synchronize do
232
- existing = fetch_checksum(lock_name, checksum.algo)
233
- if existing
234
- merge_checksum(lock_name, checksum, existing)
234
+ if checksum
235
+ existing = fetch_checksum(lock_name, checksum.algo)
236
+ if existing
237
+ merge_checksum(lock_name, checksum, existing)
238
+ else
239
+ store_checksum(lock_name, checksum)
240
+ end
235
241
  else
236
- store_checksum(lock_name, checksum)
242
+ init_checksum(lock_name)
237
243
  end
238
244
  end
239
245
  end
@@ -243,7 +249,11 @@ module Bundler
243
249
  end
244
250
 
245
251
  def store_checksum(lock_name, checksum)
246
- (@store[lock_name] ||= {})[checksum.algo] = checksum
252
+ init_checksum(lock_name)[checksum.algo] = checksum
253
+ end
254
+
255
+ def init_checksum(lock_name)
256
+ @store[lock_name] ||= {}
247
257
  end
248
258
 
249
259
  def fetch_checksum(lock_name, algo)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "gem_parser"
3
+ require "rubygems/resolver/api_set/gem_parser"
4
4
 
5
5
  module Bundler
6
6
  class CompactIndexClient
@@ -64,7 +64,7 @@ module Bundler
64
64
  end
65
65
 
66
66
  def gem_parser
67
- @gem_parser ||= GemParser.new
67
+ @gem_parser ||= Gem::Resolver::APISet::GemParser.new
68
68
  end
69
69
 
70
70
  # This is mostly the same as `split(" ", 3)` but it avoids allocating extra objects.
@@ -95,6 +95,7 @@ module Bundler
95
95
  @locked_ruby_version = nil
96
96
  @new_platforms = []
97
97
  @removed_platforms = []
98
+ @originally_invalid_platforms = []
98
99
 
99
100
  if lockfile_exists?
100
101
  @lockfile_contents = Bundler.read_file(lockfile)
@@ -147,9 +148,8 @@ module Bundler
147
148
 
148
149
  @current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
149
150
 
150
- converge_path_sources_to_gemspec_sources
151
- @path_changes = converge_paths
152
151
  @source_changes = converge_sources
152
+ @path_changes = converge_paths
153
153
 
154
154
  if conservative
155
155
  @gems_to_unlock = @explicit_unlocks.any? ? @explicit_unlocks : @dependencies.map(&:name)
@@ -337,11 +337,7 @@ module Bundler
337
337
  end
338
338
  end
339
339
  else
340
- if lockfile_exists?
341
- Bundler.ui.debug "Found changes from the lockfile, re-resolving dependencies because #{change_reason}"
342
- else
343
- Bundler.ui.debug "Resolving dependencies because there's no lockfile"
344
- end
340
+ Bundler.ui.debug resolve_needed_reason
345
341
 
346
342
  start_resolution
347
343
  end
@@ -465,7 +461,7 @@ module Bundler
465
461
  end
466
462
 
467
463
  def normalize_platforms
468
- @platforms = resolve.normalize_platforms!(current_dependencies, platforms)
464
+ resolve.normalize_platforms!(current_dependencies, platforms)
469
465
 
470
466
  @resolve = SpecSet.new(resolve.for(current_dependencies, @platforms))
471
467
  end
@@ -537,14 +533,13 @@ module Bundler
537
533
 
538
534
  return unless added.any? || deleted.any? || changed.any? || resolve_needed?
539
535
 
540
- reason = resolve_needed? ? change_reason : "some dependencies were deleted from your gemfile"
541
-
542
- msg = String.new
543
- msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because #{update_refused_reason}"
536
+ msg = String.new("#{change_reason.capitalize.strip}, but ")
537
+ msg << "the lockfile " unless msg.start_with?("Your lockfile")
538
+ msg << "can't be updated because #{update_refused_reason}"
544
539
  msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
545
540
  msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
546
541
  msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
547
- msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_gemfile_path} to version control.\n" unless unlocking?
542
+ msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_lockfile_path} to version control.\n" unless unlocking?
548
543
  msg
549
544
  end
550
545
 
@@ -563,6 +558,7 @@ module Bundler
563
558
  @local_changes ||
564
559
  @missing_lockfile_dep ||
565
560
  @unlocking_bundler ||
561
+ @locked_spec_with_missing_checksums ||
566
562
  @locked_spec_with_missing_deps ||
567
563
  @locked_spec_with_invalid_deps
568
564
  end
@@ -759,7 +755,11 @@ module Bundler
759
755
  end
760
756
  end
761
757
 
762
- @platforms = result.add_extra_platforms!(platforms) if should_add_extra_platforms?
758
+ if should_add_extra_platforms?
759
+ result.add_extra_platforms!(platforms)
760
+ elsif @originally_invalid_platforms.any?
761
+ result.add_originally_invalid_platforms!(platforms, @originally_invalid_platforms)
762
+ end
763
763
 
764
764
  SpecSet.new(result.for(dependencies, @platforms | [Gem::Platform::RUBY]))
765
765
  end
@@ -790,32 +790,58 @@ module Bundler
790
790
  @most_specific_locked_platform
791
791
  end
792
792
 
793
- def change_reason
794
- if unlocking?
795
- unlock_targets = if @gems_to_unlock.any?
796
- ["gems", @gems_to_unlock]
797
- elsif @sources_to_unlock.any?
798
- ["sources", @sources_to_unlock]
793
+ def resolve_needed_reason
794
+ if lockfile_exists?
795
+ if unlocking?
796
+ "Re-resolving dependencies because #{unlocking_reason}"
797
+ else
798
+ "Found changes from the lockfile, re-resolving dependencies because #{lockfile_changed_reason}"
799
799
  end
800
+ else
801
+ "Resolving dependencies because there's no lockfile"
802
+ end
803
+ end
800
804
 
801
- unlock_reason = if unlock_targets
802
- "#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
805
+ def change_reason
806
+ if resolve_needed?
807
+ if unlocking?
808
+ unlocking_reason
803
809
  else
804
- @unlocking_ruby ? "ruby" : ""
810
+ lockfile_changed_reason
805
811
  end
812
+ else
813
+ "some dependencies were deleted from your gemfile"
814
+ end
815
+ end
806
816
 
807
- return "bundler is unlocking #{unlock_reason}"
817
+ def unlocking_reason
818
+ unlock_targets = if @gems_to_unlock.any?
819
+ ["gems", @gems_to_unlock]
820
+ elsif @sources_to_unlock.any?
821
+ ["sources", @sources_to_unlock]
808
822
  end
823
+
824
+ unlock_reason = if unlock_targets
825
+ "#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
826
+ else
827
+ @unlocking_ruby ? "ruby" : ""
828
+ end
829
+
830
+ "bundler is unlocking #{unlock_reason}"
831
+ end
832
+
833
+ def lockfile_changed_reason
809
834
  [
810
835
  [@source_changes, "the list of sources changed"],
811
836
  [@dependency_changes, "the dependencies in your gemfile changed"],
812
- [@current_platform_missing, "your lockfile does not include the current platform"],
837
+ [@current_platform_missing, "your lockfile is missing the current platform"],
813
838
  [@new_platforms.any?, "you are adding a new platform to your lockfile"],
814
839
  [@path_changes, "the gemspecs for path gems changed"],
815
840
  [@local_changes, "the gemspecs for git local gems changed"],
816
- [@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
841
+ [@missing_lockfile_dep, "your lockfile is missing \"#{@missing_lockfile_dep}\""],
817
842
  [@unlocking_bundler, "an update to the version of Bundler itself was requested"],
818
- [@locked_spec_with_missing_deps, "your lock file includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
843
+ [@locked_spec_with_missing_checksums, "your lockfile is missing a CHECKSUMS entry for \"#{@locked_spec_with_missing_checksums}\""],
844
+ [@locked_spec_with_missing_deps, "your lockfile includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
819
845
  [@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
820
846
  ].select(&:first).map(&:last).join(", ")
821
847
  end
@@ -832,8 +858,8 @@ module Bundler
832
858
  !locked || dependencies_for_source_changed?(source, locked) || specs_for_source_changed?(source)
833
859
  end
834
860
 
835
- def dependencies_for_source_changed?(source, locked_source = source)
836
- deps_for_source = @dependencies.select {|s| s.source == source }
861
+ def dependencies_for_source_changed?(source, locked_source)
862
+ deps_for_source = @dependencies.select {|dep| dep.source == source }
837
863
  locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
838
864
 
839
865
  deps_for_source.uniq.sort != locked_deps_for_source.sort
@@ -841,7 +867,7 @@ module Bundler
841
867
 
842
868
  def specs_for_source_changed?(source)
843
869
  locked_index = Index.new
844
- locked_index.use(@locked_specs.select {|s| source.can_lock?(s) })
870
+ locked_index.use(@locked_specs.select {|s| s.replace_source_with!(source) })
845
871
 
846
872
  !locked_index.subset?(source.specs)
847
873
  rescue PathError, GitError => e
@@ -873,21 +899,27 @@ module Bundler
873
899
  def check_lockfile
874
900
  @locked_spec_with_invalid_deps = nil
875
901
  @locked_spec_with_missing_deps = nil
902
+ @locked_spec_with_missing_checksums = nil
876
903
 
877
- missing = []
904
+ missing_deps = []
905
+ missing_checksums = []
878
906
  invalid = []
879
907
 
880
908
  @locked_specs.each do |s|
909
+ missing_checksums << s if @locked_checksums && s.source.checksum_store.missing?(s)
910
+
881
911
  validation = @locked_specs.validate_deps(s)
882
912
 
883
- missing << s if validation == :missing
913
+ missing_deps << s if validation == :missing
884
914
  invalid << s if validation == :invalid
885
915
  end
886
916
 
887
- if missing.any?
888
- @locked_specs.delete(missing)
917
+ @locked_spec_with_missing_checksums = missing_checksums.first.name if missing_checksums.any?
889
918
 
890
- @locked_spec_with_missing_deps = missing.first.name
919
+ if missing_deps.any?
920
+ @locked_specs.delete(missing_deps)
921
+
922
+ @locked_spec_with_missing_deps = missing_deps.first.name
891
923
  end
892
924
 
893
925
  if invalid.any?
@@ -903,24 +935,6 @@ module Bundler
903
935
  end
904
936
  end
905
937
 
906
- def converge_path_source_to_gemspec_source(source)
907
- return source unless source.instance_of?(Source::Path)
908
- gemspec_source = sources.path_sources.find {|s| s.is_a?(Source::Gemspec) && s.as_path_source == source }
909
- gemspec_source || source
910
- end
911
-
912
- def converge_path_sources_to_gemspec_sources
913
- @locked_sources.map! do |source|
914
- converge_path_source_to_gemspec_source(source)
915
- end
916
- @locked_specs.each do |spec|
917
- spec.source &&= converge_path_source_to_gemspec_source(spec.source)
918
- end
919
- @locked_deps.each do |_, dep|
920
- dep.source &&= converge_path_source_to_gemspec_source(dep.source)
921
- end
922
- end
923
-
924
938
  def converge_sources
925
939
  # Replace the sources from the Gemfile with the sources from the Gemfile.lock,
926
940
  # if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
@@ -963,11 +977,17 @@ module Bundler
963
977
  unless name == "bundler"
964
978
  locked_specs = @originally_locked_specs[name]
965
979
 
966
- if locked_specs.any? && !dep.matches_spec?(locked_specs.first)
967
- @gems_to_unlock << name
968
- dep_changed = true
969
- elsif locked_specs.empty? && dep_changed == false
970
- @missing_lockfile_dep = name
980
+ if locked_specs.empty?
981
+ @missing_lockfile_dep = name if dep_changed == false
982
+ else
983
+ if locked_specs.map(&:source).uniq.size > 1
984
+ @locked_specs.delete(locked_specs.select {|s| s.source != dep.source })
985
+ end
986
+
987
+ unless dep.matches_spec?(locked_specs.first)
988
+ @gems_to_unlock << name
989
+ dep_changed = true
990
+ end
971
991
  end
972
992
  end
973
993
 
@@ -1141,16 +1161,21 @@ module Bundler
1141
1161
  def remove_invalid_platforms!
1142
1162
  return if Bundler.frozen_bundle?
1143
1163
 
1144
- platforms.reverse_each do |platform|
1164
+ @originally_invalid_platforms = platforms.select do |platform|
1145
1165
  next if local_platform == platform ||
1146
- @new_platforms.include?(platform) ||
1147
- @path_changes ||
1148
- @dependency_changes ||
1149
- @locked_spec_with_invalid_deps ||
1150
- !spec_set_incomplete_for_platform?(@originally_locked_specs, platform)
1166
+ @new_platforms.include?(platform)
1151
1167
 
1152
- remove_platform(platform)
1168
+ # We should probably avoid removing non-ruby platforms, since that means
1169
+ # lockfile will no longer install on those platforms, so a error to give
1170
+ # heads up to the user may be better. However, we have tests expecting
1171
+ # non ruby platform autoremoval to work, so leaving that in place for
1172
+ # now.
1173
+ next if @dependency_changes && platform != Gem::Platform::RUBY
1174
+
1175
+ spec_set_incomplete_for_platform?(@originally_locked_specs, platform)
1153
1176
  end
1177
+
1178
+ @platforms -= @originally_invalid_platforms
1154
1179
  end
1155
1180
 
1156
1181
  def spec_set_incomplete_for_platform?(spec_set, platform)
@@ -77,7 +77,7 @@ module Bundler
77
77
 
78
78
  @gemspecs << spec
79
79
 
80
- path path, "glob" => glob, "name" => spec.name do
80
+ path path, "glob" => glob, "name" => spec.name, "gemspec" => spec do
81
81
  add_dependency spec.name
82
82
  end
83
83
 
@@ -141,8 +141,7 @@ module Bundler
141
141
  def path(path, options = {}, &blk)
142
142
  source_options = normalize_hash(options).merge(
143
143
  "path" => Pathname.new(path),
144
- "root_path" => gemfile_root,
145
- "gemspec" => gemspecs.find {|g| g.name == options["name"] }
144
+ "root_path" => gemfile_root
146
145
  )
147
146
 
148
147
  source_options["global"] = true unless block_given?
@@ -80,7 +80,7 @@ module Bundler
80
80
  First, try this link to see if there are any existing issue reports for this error:
81
81
  #{issues_url(e)}
82
82
 
83
- If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}, and copy and paste the report template above in there.
83
+ If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}. Make sure to copy and paste the full output of this command under the "What happened instead?" section.
84
84
  EOS
85
85
  end
86
86
 
@@ -212,7 +212,7 @@ module Bundler
212
212
  def load_plugins
213
213
  Gem.load_plugins
214
214
 
215
- requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
215
+ requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
216
216
  path_plugin_files = requested_path_gems.flat_map do |spec|
217
217
  spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
218
218
  rescue TypeError
@@ -175,6 +175,14 @@ module Bundler
175
175
  @force_ruby_platform = true
176
176
  end
177
177
 
178
+ def replace_source_with!(gemfile_source)
179
+ return unless gemfile_source.can_lock?(self)
180
+
181
+ @source = gemfile_source
182
+
183
+ true
184
+ end
185
+
178
186
  private
179
187
 
180
188
  def use_exact_resolved_specifications?
@@ -196,7 +204,7 @@ module Bundler
196
204
 
197
205
  # If in frozen mode, we fallback to a non-installable candidate because by
198
206
  # doing this we avoid re-resolving and potentially end up changing the
199
- # lock file, which is not allowed. In that case, we will give a proper error
207
+ # lockfile, which is not allowed. In that case, we will give a proper error
200
208
  # about the mismatch higher up the stack, right before trying to install the
201
209
  # bad gem.
202
210
  def choose_compatible(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
@@ -239,7 +239,6 @@ module Bundler
239
239
  spaces = $1
240
240
  return unless spaces.size == 2
241
241
  checksums = $6
242
- return unless checksums
243
242
  name = $2
244
243
  version = $3
245
244
  platform = $4
@@ -249,10 +248,14 @@ module Bundler
249
248
  full_name = Gem::NameTuple.new(name, version, platform).full_name
250
249
  return unless spec = @specs[full_name]
251
250
 
252
- checksums.split(",") do |lock_checksum|
253
- column = line.index(lock_checksum) + 1
254
- checksum = Checksum.from_lock(lock_checksum, "#{@lockfile_path}:#{@pos.line}:#{column}")
255
- spec.source.checksum_store.register(spec, checksum)
251
+ if checksums
252
+ checksums.split(",") do |lock_checksum|
253
+ column = line.index(lock_checksum) + 1
254
+ checksum = Checksum.from_lock(lock_checksum, "#{@lockfile_path}:#{@pos.line}:#{column}")
255
+ spec.source.checksum_store.register(spec, checksum)
256
+ end
257
+ else
258
+ spec.source.checksum_store.register(spec, nil)
256
259
  end
257
260
  end
258
261
 
@@ -67,7 +67,7 @@ module Bundler
67
67
  # to check out same version of gem later.
68
68
  #
69
69
  # There options are passed when the source plugin is created from the
70
- # lock file.
70
+ # lockfile.
71
71
  #
72
72
  # @return [Hash]
73
73
  def options_to_lock
@@ -8,6 +8,14 @@ module Bundler
8
8
  SharedHelpers.in_bundle? ? Bundler.root : Plugin.root
9
9
  end
10
10
 
11
+ def eql?(other)
12
+ return unless other.class == self.class
13
+ expanded_original_path == other.expanded_original_path &&
14
+ version == other.version
15
+ end
16
+
17
+ alias_method :==, :eql?
18
+
11
19
  def generate_bin(spec, disable_extensions = false)
12
20
  # Need to find a way without code duplication
13
21
  # For now, we can ignore this