rubygems-update 3.3.22 → 3.3.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Manifest.txt +1 -1
  4. data/POLICIES.md +38 -5
  5. data/bundler/CHANGELOG.md +29 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/init.rb +5 -1
  8. data/bundler/lib/bundler/definition.rb +12 -40
  9. data/bundler/lib/bundler/dsl.rb +0 -1
  10. data/bundler/lib/bundler/endpoint_specification.rb +4 -0
  11. data/bundler/lib/bundler/gem_helpers.rb +0 -1
  12. data/bundler/lib/bundler/gem_version_promoter.rb +6 -7
  13. data/bundler/lib/bundler/index.rb +3 -27
  14. data/bundler/lib/bundler/injector.rb +1 -1
  15. data/bundler/lib/bundler/lazy_specification.rb +7 -11
  16. data/bundler/lib/bundler/remote_specification.rb +6 -2
  17. data/bundler/lib/bundler/resolver/base.rb +1 -1
  18. data/bundler/lib/bundler/resolver/spec_group.rb +22 -44
  19. data/bundler/lib/bundler/resolver.rb +31 -76
  20. data/bundler/lib/bundler/rubygems_ext.rb +12 -1
  21. data/bundler/lib/bundler/shared_helpers.rb +1 -2
  22. data/bundler/lib/bundler/spec_set.rb +1 -1
  23. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
  24. data/bundler/lib/bundler/version.rb +1 -1
  25. data/bundler/lib/bundler.rb +0 -1
  26. data/lib/rubygems/gemcutter_utilities.rb +8 -1
  27. data/lib/rubygems/package.rb +9 -4
  28. data/lib/rubygems/platform.rb +17 -1
  29. data/lib/rubygems/resolver.rb +1 -1
  30. data/lib/rubygems.rb +1 -1
  31. data/rubygems-update.gemspec +1 -1
  32. data/test/rubygems/alternate_cert.pem +14 -14
  33. data/test/rubygems/alternate_cert_32.pem +15 -15
  34. data/test/rubygems/alternate_key.pem +25 -25
  35. data/test/rubygems/child_cert.pem +15 -16
  36. data/test/rubygems/child_cert_32.pem +15 -16
  37. data/test/rubygems/child_key.pem +25 -25
  38. data/test/rubygems/encrypted_private_key.pem +26 -26
  39. data/test/rubygems/expired_cert.pem +15 -15
  40. data/test/rubygems/future_cert.pem +15 -15
  41. data/test/rubygems/future_cert_32.pem +15 -15
  42. data/test/rubygems/grandchild_cert.pem +15 -16
  43. data/test/rubygems/grandchild_cert_32.pem +15 -16
  44. data/test/rubygems/grandchild_key.pem +25 -25
  45. data/test/rubygems/helper.rb +23 -17
  46. data/test/rubygems/invalid_issuer_cert.pem +16 -16
  47. data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
  48. data/test/rubygems/invalid_key.pem +25 -25
  49. data/test/rubygems/invalid_signer_cert.pem +15 -15
  50. data/test/rubygems/invalid_signer_cert_32.pem +15 -15
  51. data/test/rubygems/invalidchild_cert.pem +15 -16
  52. data/test/rubygems/invalidchild_cert_32.pem +15 -16
  53. data/test/rubygems/invalidchild_key.pem +25 -25
  54. data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
  55. data/test/rubygems/private_key.pem +25 -25
  56. data/test/rubygems/public_cert.pem +16 -16
  57. data/test/rubygems/public_cert_32.pem +15 -15
  58. data/test/rubygems/public_key.pem +7 -7
  59. data/test/rubygems/test_gem.rb +254 -212
  60. data/test/rubygems/test_gem_commands_owner_command.rb +105 -24
  61. data/test/rubygems/test_gem_commands_push_command.rb +44 -23
  62. data/test/rubygems/test_gem_commands_signin_command.rb +28 -3
  63. data/test/rubygems/test_gem_commands_yank_command.rb +9 -9
  64. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
  65. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  66. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
  67. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  68. data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -12
  69. data/test/rubygems/test_gem_package.rb +15 -0
  70. data/test/rubygems/test_gem_platform.rb +35 -0
  71. data/test/rubygems/test_gem_resolver.rb +33 -0
  72. data/test/rubygems/test_gem_security.rb +5 -5
  73. data/test/rubygems/test_gem_security_signer.rb +6 -6
  74. data/test/rubygems/test_require.rb +5 -5
  75. data/test/rubygems/utilities.rb +36 -14
  76. data/test/rubygems/wrong_key_cert.pem +15 -15
  77. data/test/rubygems/wrong_key_cert_32.pem +15 -15
  78. metadata +4 -4
  79. data/bundler/lib/bundler/dep_proxy.rb +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7155d16d3c9857d2ae7b4dd04e939a77f72fa12f939413f328d77c73b152cc37
4
- data.tar.gz: 5f696b3a1885a97d4f0a518761e8a452a256fe360d428cff409ada562b64fa36
3
+ metadata.gz: 65c7d26883d0730029624be1ed4fd91012021d0db47680ee7624b49befff19fa
4
+ data.tar.gz: c6e162899091bcd0151d65e798d94291f6355c01b89f240e38ec93533a70287a
5
5
  SHA512:
6
- metadata.gz: 64a732dbbe8b89756cebcc79c9806bf9f0ddd6646d2e527e029fdbcba7ae19bc8b33ae82ccbf4e04dacca81d550af36e6cd31eea0a9950e8210098a827241d89
7
- data.tar.gz: d3bf1303f659b05996386c5cc2f36d4f6bee88a6c187a4cb4f93cd4044b6848c700a653ad3d402af5c48e23d6eaffb8ebd0ff87300377d4cbbb834083f26d836
6
+ metadata.gz: 409a780fb1964ad6f14355c9c1df5e87d0d0dc9a4e54edc54dbf16ef3425bd8bb237c0eae9fea20d05d9e31f4983d7a34c31ef1c651ba514c22c6cddadfcc461
7
+ data.tar.gz: 723c63a66cf6288ddaa7bfc921195501a7b54c860a81444114553008ab1faadbd26bfae19cbd24cc15fe476923a3791fa04876501dfae9838de8d39b64140a8d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # 3.3.24 / 2022-10-17
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.3.24 as a default gem.
6
+
7
+ # 3.3.23 / 2022-10-05
8
+
9
+ ## Enhancements:
10
+
11
+ * Add better error handling for permanent redirect responses. Pull request
12
+ #5931 by jenshenny
13
+ * Installs bundler 2.3.23 as a default gem.
14
+
15
+ ## Bug fixes:
16
+
17
+ * Fix generic arm platform matching against runtime arm platforms with
18
+ eabi modifiers. Pull request #5957 by deivid-rodriguez
19
+ * Fix `Gem::Platform.match` not handling String argument properly. Pull
20
+ request #5939 by flavorjones
21
+ * Fix resolution on non-musl platforms. Pull request #5915 by
22
+ deivid-rodriguez
23
+ * Mask the file mode when extracting files. Pull request #5906 by
24
+ kddnewton
25
+
1
26
  # 3.3.22 / 2022-09-07
2
27
 
3
28
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -57,7 +57,6 @@ bundler/lib/bundler/compact_index_client/updater.rb
57
57
  bundler/lib/bundler/constants.rb
58
58
  bundler/lib/bundler/current_ruby.rb
59
59
  bundler/lib/bundler/definition.rb
60
- bundler/lib/bundler/dep_proxy.rb
61
60
  bundler/lib/bundler/dependency.rb
62
61
  bundler/lib/bundler/deployment.rb
63
62
  bundler/lib/bundler/deprecate.rb
@@ -577,6 +576,7 @@ test/rubygems/invalidchild_cert.pem
577
576
  test/rubygems/invalidchild_cert_32.pem
578
577
  test/rubygems/invalidchild_key.pem
579
578
  test/rubygems/package/tar_test_case.rb
579
+ test/rubygems/packages/Bluebie-legs-0.6.2.gem
580
580
  test/rubygems/packages/ascii_binder-0.1.10.1.gem
581
581
  test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem
582
582
  test/rubygems/plugin/exception/rubygems_plugin.rb
data/POLICIES.md CHANGED
@@ -42,8 +42,19 @@ at version 2.7, so when RubyGems 2.8 is released, it will only support Ruby
42
42
 
43
43
  ## Release Process
44
44
 
45
- Releases of new versions should follow these steps, to ensure the process is
46
- smooth and no needed steps are missed.
45
+ ### Permissions
46
+
47
+ You'll need the following environment variables set to release RubyGems &
48
+ Bundler:
49
+
50
+ * AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: to be able to push RubyGems zip
51
+ files to s3 so that they appear at RubyGems [download page].
52
+
53
+ * GITHUB_RELEASE_PAT: A [GitHub PAT] with repo permissions, in order to push
54
+ GitHub releases and to use the GitHub API for changelog generation.
55
+
56
+ [download page]: https://rubygems.org/pages/download
57
+ [GitHub PAT]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
47
58
 
48
59
  ### Recommendations for security releases
49
60
 
@@ -54,14 +65,36 @@ smooth and no needed steps are missed.
54
65
  have to work on weekends.
55
66
  * Continue with the regular release process below.
56
67
 
68
+ ### Automatic changelog and backport generation
69
+
70
+ PR labels and titles are used to automatically generate changelogs for patch and
71
+ minor releases.
72
+
73
+ When releasing, a changelog generation script goes through all PRs that have
74
+ never made it into a release, and selects only the ones with specific labels as
75
+ detailed in the `.changelog.yml` and `bundler/.changelog.yml` files. Those
76
+ particular PRs get backported to the stable branch and included in the release
77
+ changelog.
78
+
79
+ If PRs don't have a proper label, they won't be backported to patch releases.
80
+
81
+ If you want a PR to be backported to a patch level release, but don't want to
82
+ include it in the changelog, you can use the special `rubygems: backport` and
83
+ `bundler: backport` labels. For example, this is useful when backporting a PR
84
+ generates conflicts that are solved by backporting another PR with no user
85
+ visible changes. You can use these special labels to also backport the other PR
86
+ and not get any conflicts.
57
87
 
58
88
  ### Steps for patch releases
59
89
 
60
90
  * Confirm all PRs that you want backported are properly tagged with `rubygems:
61
91
  <type>` or `bundler: <type>` labels at GitHub.
62
- * Run `rake prepare_release[<target_version>]`, create a PR and merge it
63
- to the stable branch once CI passes.
64
- * Switch to the stable branch and pull the PR just merged.
92
+ * Run `rake prepare_release[<target_version>]`. This will create a PR to the
93
+ stable branch with the backports included in the release, and proper
94
+ changelogs and version bumps. It will also create a PR to merge release
95
+ changelogs into master.
96
+ * Once CI passes, merge the release PR, switch to the stable branch and pull
97
+ the PR just merged.
65
98
  * Release `bundler` with `(cd bundler && bin/rake release)`.
66
99
  * Release `rubygems` with `rake release`.
67
100
 
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # 2.3.24 (October 17, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Only add extra resolver spec group for Ruby platform when needed [#5698](https://github.com/rubygems/rubygems/pull/5698)
6
+ - Fix little UI issue when bundler shows duplicated gems in a list [#5965](https://github.com/rubygems/rubygems/pull/5965)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Fix incorrect materialization on Windows [#5975](https://github.com/rubygems/rubygems/pull/5975)
11
+
12
+ # 2.3.23 (October 5, 2022)
13
+
14
+ ## Enhancements:
15
+
16
+ - Update GitLab CI template with new one [#5944](https://github.com/rubygems/rubygems/pull/5944)
17
+
18
+ ## Bug fixes:
19
+
20
+ - Fix `bundle init` not respecting umask in generated gem's Gemfile [#5947](https://github.com/rubygems/rubygems/pull/5947)
21
+
22
+ ## Performance:
23
+
24
+ - Further speed up Bundler by not sorting specs unnecessarily [#5868](https://github.com/rubygems/rubygems/pull/5868)
25
+
26
+ ## Documentation:
27
+
28
+ - Update Bundler new feature instructions [#5912](https://github.com/rubygems/rubygems/pull/5912)
29
+
1
30
  # 2.3.22 (September 7, 2022)
2
31
 
3
32
  ## Enhancements:
@@ -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 = "2022-09-07".freeze
8
- @git_commit_sha = "44fb4c9ef5".freeze
7
+ @built_at = "2022-10-17".freeze
8
+ @git_commit_sha = "b835c7ea15".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -32,7 +32,11 @@ module Bundler
32
32
  file << spec.to_gemfile
33
33
  end
34
34
  else
35
- FileUtils.cp(File.expand_path("../templates/#{gemfile}", __dir__), gemfile)
35
+ File.open(File.expand_path("../templates/#{gemfile}", __dir__), "r") do |template|
36
+ File.open(gemfile, "wb") do |destination|
37
+ IO.copy_stream(template, destination)
38
+ end
39
+ end
36
40
  end
37
41
 
38
42
  puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
@@ -106,6 +106,7 @@ module Bundler
106
106
  @locked_gems = nil
107
107
  @locked_deps = {}
108
108
  @locked_specs = SpecSet.new([])
109
+ @originally_locked_specs = @locked_specs
109
110
  @locked_sources = []
110
111
  @locked_platforms = []
111
112
  end
@@ -138,8 +139,8 @@ module Bundler
138
139
  if @unlock[:conservative]
139
140
  @unlock[:gems] ||= @dependencies.map(&:name)
140
141
  else
141
- eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
142
- @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name)
142
+ eager_unlock = (@unlock[:gems] || []).map {|name| Dependency.new(name, ">= 0") }
143
+ @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name).uniq
143
144
  end
144
145
 
145
146
  @dependency_changes = converge_dependencies
@@ -149,18 +150,7 @@ module Bundler
149
150
  end
150
151
 
151
152
  def gem_version_promoter
152
- @gem_version_promoter ||= begin
153
- locked_specs =
154
- if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty?
155
- # Definition uses an empty set of locked_specs to indicate all gems
156
- # are unlocked, but GemVersionPromoter needs the locked_specs
157
- # for conservative comparison.
158
- Bundler::SpecSet.new(@locked_gems.specs)
159
- else
160
- @locked_specs
161
- end
162
- GemVersionPromoter.new(locked_specs, @unlock[:gems])
163
- end
153
+ @gem_version_promoter ||= GemVersionPromoter.new(@originally_locked_specs, @unlock[:gems])
164
154
  end
165
155
 
166
156
  def resolve_only_locally!
@@ -234,7 +224,7 @@ module Bundler
234
224
 
235
225
  def current_dependencies
236
226
  dependencies.select do |d|
237
- d.should_include? && !d.gem_platforms(@platforms).empty?
227
+ d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
238
228
  end
239
229
  end
240
230
 
@@ -258,10 +248,9 @@ module Bundler
258
248
 
259
249
  def dependencies_for(groups)
260
250
  groups.map!(&:to_sym)
261
- deps = current_dependencies.reject do |d|
251
+ current_dependencies.reject do |d|
262
252
  (d.groups & groups).empty?
263
253
  end
264
- expand_dependencies(deps)
265
254
  end
266
255
 
267
256
  # Resolve all the dependencies specified in Gemfile. It ensures that
@@ -484,17 +473,17 @@ module Bundler
484
473
  def resolver
485
474
  @resolver ||= begin
486
475
  last_resolve = converge_locked_specs
487
- remove_ruby_from_platforms_if_necessary!(dependencies)
476
+ remove_ruby_from_platforms_if_necessary!(current_dependencies)
488
477
  Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve), platforms)
489
478
  end
490
479
  end
491
480
 
492
481
  def expanded_dependencies
493
- @expanded_dependencies ||= expand_dependencies(dependencies + metadata_dependencies, true)
482
+ @expanded_dependencies ||= dependencies + metadata_dependencies
494
483
  end
495
484
 
496
485
  def filter_specs(specs, deps)
497
- SpecSet.new(specs).for(expand_dependencies(deps, true), false, platforms)
486
+ SpecSet.new(specs).for(deps, false, platforms)
498
487
  end
499
488
 
500
489
  def materialize(dependencies)
@@ -588,8 +577,8 @@ module Bundler
588
577
  ].select(&:first).map(&:last).join(", ")
589
578
  end
590
579
 
591
- def pretty_dep(dep, source = false)
592
- SharedHelpers.pretty_dependency(dep, source)
580
+ def pretty_dep(dep)
581
+ SharedHelpers.pretty_dependency(dep)
593
582
  end
594
583
 
595
584
  # Check if the specs of the given source changed
@@ -802,23 +791,6 @@ module Bundler
802
791
  ]
803
792
  end
804
793
 
805
- def expand_dependencies(dependencies, remote = false)
806
- deps = []
807
- dependencies.each do |dep|
808
- dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
809
- next unless remote || dep.current_platform?
810
- target_platforms = dep.gem_platforms(remote ? @platforms : [generic_local_platform])
811
- deps += expand_dependency_with_platforms(dep, target_platforms)
812
- end
813
- deps
814
- end
815
-
816
- def expand_dependency_with_platforms(dep, platforms)
817
- platforms.map do |p|
818
- DepProxy.get_proxy(dep, p)
819
- end
820
- end
821
-
822
794
  def source_requirements
823
795
  # Record the specs available in each gem's source, so that those
824
796
  # specs will be available later when the resolver knows where to
@@ -890,7 +862,7 @@ module Bundler
890
862
  Bundler.local_platform == Gem::Platform::RUBY ||
891
863
  !platforms.include?(Gem::Platform::RUBY) ||
892
864
  (@new_platform && platforms.last == Gem::Platform::RUBY) ||
893
- !@originally_locked_specs.incomplete_ruby_specs?(expand_dependencies(dependencies))
865
+ !@originally_locked_specs.incomplete_ruby_specs?(dependencies)
894
866
 
895
867
  remove_platform(Gem::Platform::RUBY)
896
868
  add_current_platform
@@ -67,7 +67,6 @@ module Bundler
67
67
 
68
68
  gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).map {|g| Bundler.load_gemspec(g) }.compact
69
69
  gemspecs.reject! {|s| s.name != name } if name
70
- Index.sort_specs(gemspecs)
71
70
  specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
72
71
 
73
72
  case specs_by_name_and_version.size
@@ -26,6 +26,10 @@ module Bundler
26
26
  @platform
27
27
  end
28
28
 
29
+ def identifier
30
+ @__identifier ||= [name, version, platform.to_s]
31
+ end
32
+
29
33
  # needed for standalone, load required_paths from local gemspec
30
34
  # after the gem is installed
31
35
  def require_paths
@@ -5,7 +5,6 @@ module Bundler
5
5
  GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
6
6
  GENERICS = [
7
7
  [Gem::Platform.new("java"), Gem::Platform.new("java")],
8
- [Gem::Platform.new("universal-java"), Gem::Platform.new("java")],
9
8
  [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
10
9
  [Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
11
10
  [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
@@ -116,15 +116,14 @@ module Bundler
116
116
  end
117
117
 
118
118
  def sort_dep_specs(spec_groups, locked_spec)
119
- return spec_groups unless locked_spec
120
- @gem_name = locked_spec.name
121
- @locked_version = locked_spec.version
119
+ @locked_version = locked_spec&.version
120
+ @gem_name = locked_spec&.name
122
121
 
123
122
  result = spec_groups.sort do |a, b|
124
123
  @a_ver = a.version
125
124
  @b_ver = b.version
126
125
 
127
- unless @prerelease_specified[@gem_name]
126
+ unless @gem_name && @prerelease_specified[@gem_name]
128
127
  a_pre = @a_ver.prerelease?
129
128
  b_pre = @b_ver.prerelease?
130
129
 
@@ -148,7 +147,7 @@ module Bundler
148
147
  end
149
148
 
150
149
  def either_version_older_than_locked
151
- @a_ver < @locked_version || @b_ver < @locked_version
150
+ @locked_version && (@a_ver < @locked_version || @b_ver < @locked_version)
152
151
  end
153
152
 
154
153
  def segments_do_not_match(level)
@@ -157,7 +156,7 @@ module Bundler
157
156
  end
158
157
 
159
158
  def unlocking_gem?
160
- unlock_gems.empty? || unlock_gems.include?(@gem_name)
159
+ unlock_gems.empty? || (@gem_name && unlock_gems.include?(@gem_name))
161
160
  end
162
161
 
163
162
  # Specific version moves can't always reliably be done during sorting
@@ -165,7 +164,7 @@ module Bundler
165
164
  def post_sort(result)
166
165
  # default :major behavior in Bundler does not do this
167
166
  return result if major?
168
- if unlocking_gem?
167
+ if unlocking_gem? || @locked_version.nil?
169
168
  result
170
169
  else
171
170
  move_version_to_end(result, @locked_version)
@@ -57,36 +57,13 @@ module Bundler
57
57
  # Search this index's specs, and any source indexes that this index knows
58
58
  # about, returning all of the results.
59
59
  def search(query)
60
- sort_specs(unsorted_search(query))
61
- end
62
-
63
- def unsorted_search(query)
64
60
  results = local_search(query)
65
-
66
- seen = results.map(&:full_name).uniq unless @sources.empty?
61
+ return results unless @sources.any?
67
62
 
68
63
  @sources.each do |source|
69
- source.unsorted_search(query).each do |spec|
70
- next if seen.include?(spec.full_name)
71
-
72
- seen << spec.full_name
73
- results << spec
74
- end
64
+ results.concat(source.search(query))
75
65
  end
76
-
77
- results
78
- end
79
- protected :unsorted_search
80
-
81
- def self.sort_specs(specs)
82
- specs.sort_by do |s|
83
- platform_string = s.platform.to_s
84
- [s.version, platform_string == RUBY ? NULL : platform_string]
85
- end
86
- end
87
-
88
- def sort_specs(specs)
89
- self.class.sort_specs(specs)
66
+ results.uniq(&:full_name)
90
67
  end
91
68
 
92
69
  def local_search(query)
@@ -94,7 +71,6 @@ module Bundler
94
71
  when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
95
72
  when String then specs_by_name(query)
96
73
  when Gem::Dependency then search_by_dependency(query)
97
- when DepProxy then search_by_dependency(query.dep)
98
74
  else
99
75
  raise "You can't search for a #{query.inspect}."
100
76
  end
@@ -70,7 +70,7 @@ module Bundler
70
70
 
71
71
  show_warning("No gems were removed from the gemfile.") if deps.empty?
72
72
 
73
- deps.each {|dep| Bundler.ui.confirm "#{SharedHelpers.pretty_dependency(dep, false)} was removed." }
73
+ deps.each {|dep| Bundler.ui.confirm "#{SharedHelpers.pretty_dependency(dep)} was removed." }
74
74
  end
75
75
 
76
76
  # Invalidate the cached Bundler.definition.
@@ -77,7 +77,7 @@ module Bundler
77
77
  source.local!
78
78
 
79
79
  candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
80
- target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform
80
+ target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
81
81
 
82
82
  source.specs.search(Dependency.new(name, version)).select do |spec|
83
83
  MatchPlatform.platforms_match?(spec.platform, target_platform)
@@ -120,7 +120,7 @@ module Bundler
120
120
  end
121
121
 
122
122
  def identifier
123
- @__identifier ||= [name, version, platform_string]
123
+ @__identifier ||= [name, version, platform.to_s]
124
124
  end
125
125
 
126
126
  def git_version
@@ -128,13 +128,6 @@ module Bundler
128
128
  " #{source.revision[0..6]}"
129
129
  end
130
130
 
131
- protected
132
-
133
- def platform_string
134
- platform_string = platform.to_s
135
- platform_string == Index::RUBY ? Index::NULL : platform_string
136
- end
137
-
138
131
  private
139
132
 
140
133
  def to_ary
@@ -151,7 +144,8 @@ module Bundler
151
144
 
152
145
  #
153
146
  # For backwards compatibility with existing lockfiles, if the most specific
154
- # locked platform is RUBY, we keep the previous behaviour of resolving the
147
+ # locked platform is not a specific platform like x86_64-linux or
148
+ # universal-java-11, then we keep the previous behaviour of resolving the
155
149
  # best platform variant at materiliazation time. For previous bundler
156
150
  # versions (before 2.2.0) this was always the case (except when the lockfile
157
151
  # only included non-ruby platforms), but we're also keeping this behaviour
@@ -159,7 +153,9 @@ module Bundler
159
153
  # explicitly add a more specific platform.
160
154
  #
161
155
  def ruby_platform_materializes_to_ruby_platform?
162
- !Bundler.most_specific_locked_platform?(generic_local_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
156
+ generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
157
+
158
+ !Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
163
159
  end
164
160
  end
165
161
  end
@@ -29,11 +29,15 @@ module Bundler
29
29
  @platform = _remote_specification.platform
30
30
  end
31
31
 
32
+ def identifier
33
+ @__identifier ||= [name, version, @platform.to_s]
34
+ end
35
+
32
36
  def full_name
33
- if @original_platform == Gem::Platform::RUBY
37
+ if @platform == Gem::Platform::RUBY
34
38
  "#{@name}-#{@version}"
35
39
  else
36
- "#{@name}-#{@version}-#{@original_platform}"
40
+ "#{@name}-#{@version}-#{@platform}"
37
41
  end
38
42
  end
39
43
 
@@ -40,7 +40,7 @@ module Bundler
40
40
  base_requirements = {}
41
41
  @base.each do |ls|
42
42
  dep = Dependency.new(ls.name, ls.version)
43
- base_requirements[ls.name] = DepProxy.get_proxy(dep, ls.platform)
43
+ base_requirements[ls.name] = dep
44
44
  end
45
45
  @additional_base_requirements.each {|d| base_requirements[d.name] = d }
46
46
  base_requirements
@@ -6,40 +6,23 @@ module Bundler
6
6
  attr_accessor :name, :version, :source
7
7
  attr_accessor :activated_platforms, :force_ruby_platform
8
8
 
9
- def self.create_for(specs, all_platforms, specific_platform)
10
- specific_platform_specs = specs[specific_platform]
11
- return unless specific_platform_specs.any?
12
-
13
- platforms = all_platforms.select {|p| specs[p].any? }
14
-
15
- new(specific_platform_specs.first, specs, platforms)
16
- end
17
-
18
- def initialize(exemplary_spec, specs, relevant_platforms)
19
- @exemplary_spec = exemplary_spec
20
- @name = exemplary_spec.name
21
- @version = exemplary_spec.version
22
- @source = exemplary_spec.source
9
+ def initialize(specs, relevant_platforms)
10
+ @exemplary_spec = specs.first
11
+ @name = @exemplary_spec.name
12
+ @version = @exemplary_spec.version
13
+ @source = @exemplary_spec.source
23
14
 
24
15
  @activated_platforms = relevant_platforms
25
- @dependencies = Hash.new do |dependencies, platforms|
26
- dependencies[platforms] = dependencies_for(platforms)
27
- end
28
16
  @specs = specs
29
17
  end
30
18
 
31
19
  def to_specs
32
- activated_platforms.map do |p|
33
- specs = @specs[p]
34
- next unless specs.any?
35
-
36
- specs.map do |s|
37
- lazy_spec = LazySpecification.new(name, version, s.platform, source)
38
- lazy_spec.force_ruby_platform = force_ruby_platform
39
- lazy_spec.dependencies.replace s.dependencies
40
- lazy_spec
41
- end
42
- end.flatten.compact.uniq
20
+ @specs.map do |s|
21
+ lazy_spec = LazySpecification.new(name, version, s.platform, source)
22
+ lazy_spec.force_ruby_platform = force_ruby_platform
23
+ lazy_spec.dependencies.replace s.dependencies
24
+ lazy_spec
25
+ end
43
26
  end
44
27
 
45
28
  def to_s
@@ -48,7 +31,9 @@ module Bundler
48
31
  end
49
32
 
50
33
  def dependencies_for_activated_platforms
51
- @dependencies[activated_platforms]
34
+ @dependencies_for_activated_platforms ||= @specs.map do |spec|
35
+ __dependencies(spec) + metadata_dependencies(spec)
36
+ end.flatten.uniq
52
37
  end
53
38
 
54
39
  def ==(other)
@@ -79,35 +64,28 @@ module Bundler
79
64
 
80
65
  private
81
66
 
82
- def dependencies_for(platforms)
83
- platforms.map do |platform|
84
- __dependencies(platform) + metadata_dependencies(platform)
85
- end.flatten
86
- end
87
-
88
- def __dependencies(platform)
67
+ def __dependencies(spec)
89
68
  dependencies = []
90
- @specs[platform].first.dependencies.each do |dep|
69
+ spec.dependencies.each do |dep|
91
70
  next if dep.type == :development
92
- dependencies << DepProxy.get_proxy(Dependency.new(dep.name, dep.requirement), platform)
71
+ dependencies << Dependency.new(dep.name, dep.requirement)
93
72
  end
94
73
  dependencies
95
74
  end
96
75
 
97
- def metadata_dependencies(platform)
98
- spec = @specs[platform].first
76
+ def metadata_dependencies(spec)
99
77
  return [] if spec.is_a?(LazySpecification)
100
78
 
101
79
  [
102
- metadata_dependency("Ruby", spec.required_ruby_version, platform),
103
- metadata_dependency("RubyGems", spec.required_rubygems_version, platform),
80
+ metadata_dependency("Ruby", spec.required_ruby_version),
81
+ metadata_dependency("RubyGems", spec.required_rubygems_version),
104
82
  ].compact
105
83
  end
106
84
 
107
- def metadata_dependency(name, requirement, platform)
85
+ def metadata_dependency(name, requirement)
108
86
  return if requirement.nil? || requirement.none?
109
87
 
110
- DepProxy.get_proxy(Dependency.new("#{name}\0", requirement), platform)
88
+ Dependency.new("#{name}\0", requirement)
111
89
  end
112
90
  end
113
91
  end