rubygems-update 3.4.5 → 3.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1128 -1095
  3. data/Manifest.txt +5 -6
  4. data/bundler/CHANGELOG.md +29 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/binstubs.rb +5 -1
  7. data/bundler/lib/bundler/cli/init.rb +2 -2
  8. data/bundler/lib/bundler/cli.rb +1 -0
  9. data/bundler/lib/bundler/current_ruby.rb +2 -0
  10. data/bundler/lib/bundler/dependency.rb +1 -1
  11. data/bundler/lib/bundler/inline.rb +6 -8
  12. data/bundler/lib/bundler/installer/parallel_installer.rb +16 -2
  13. data/bundler/lib/bundler/installer/standalone.rb +12 -8
  14. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  15. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  16. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  17. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  18. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  19. data/bundler/lib/bundler/man/bundle-config.1 +1 -1
  20. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  21. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  22. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  25. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  26. data/bundler/lib/bundler/man/bundle-init.1 +5 -1
  27. data/bundler/lib/bundler/man/bundle-init.1.ronn +2 -0
  28. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle.1 +1 -1
  43. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  44. data/bundler/lib/bundler/rubygems_integration.rb +8 -4
  45. data/bundler/lib/bundler/source/git/git_proxy.rb +6 -4
  46. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  47. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +6 -2
  48. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +8 -1
  49. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +5 -4
  50. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +4 -2
  51. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +4 -1
  52. data/bundler/lib/bundler/version.rb +1 -1
  53. data/lib/rubygems/core_ext/kernel_require.rb +113 -109
  54. data/lib/rubygems/deprecate.rb +2 -2
  55. data/lib/rubygems/ext/builder.rb +1 -2
  56. data/lib/rubygems/ext/cargo_builder.rb +129 -89
  57. data/lib/rubygems/package/tar_reader/entry.rb +6 -4
  58. data/lib/rubygems/specification_policy.rb +6 -1
  59. data/lib/rubygems.rb +11 -1
  60. data/rubygems-update.gemspec +1 -1
  61. data/test/rubygems/bundler_test_gem.rb +419 -0
  62. data/test/rubygems/test_gem.rb +0 -412
  63. data/test/rubygems/test_gem_command_manager.rb +25 -0
  64. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +2 -4
  65. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.lock → ext/custom_name_lib/Cargo.lock} +0 -0
  66. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.toml → ext/custom_name_lib/Cargo.toml} +0 -0
  67. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{src → ext/custom_name_lib/src}/lib.rs +1 -1
  68. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
  69. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
  70. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  71. data/test/rubygems/test_gem_ext_cargo_builder.rb +9 -16
  72. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +5 -10
  73. data/test/rubygems/test_gem_package_tar_reader_entry.rb +60 -2
  74. data/test/rubygems/test_gem_specification.rb +17 -0
  75. metadata +8 -9
  76. data/bundler/lib/bundler/templates/gems.rb +0 -5
  77. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +0 -21
  78. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +0 -21
@@ -76,9 +76,13 @@ module Bundler::PubGrub
76
76
  elsif terms.length == 1
77
77
  term = terms[0]
78
78
  if term.positive?
79
- "#{terms[0].to_s(allow_every: true)} is forbidden"
79
+ if term.constraint.any?
80
+ "#{term.package} cannot be used"
81
+ else
82
+ "#{term.to_s(allow_every: true)} cannot be used"
83
+ end
80
84
  else
81
- "#{terms[0].invert} is required"
85
+ "#{term.invert} is required"
82
86
  end
83
87
  else
84
88
  if terms.all?(&:positive?)
@@ -19,7 +19,14 @@ module Bundler::PubGrub
19
19
  version = Gem::Version.new(version)
20
20
  @packages[name] ||= {}
21
21
  raise ArgumentError, "#{name} #{version} declared twice" if @packages[name].key?(version)
22
- @packages[name][version] = deps
22
+ @packages[name][version] = clean_deps(name, version, deps)
23
+ end
24
+
25
+ private
26
+
27
+ # Exclude redundant self-referencing dependencies
28
+ def clean_deps(name, version, deps)
29
+ deps.reject {|dep_name, req| name == dep_name && Bundler::PubGrub::RubyGems.parse_range(req).include?(version) }
23
30
  end
24
31
  end
25
32
 
@@ -15,15 +15,16 @@ module Bundler::PubGrub
15
15
  package.hash ^ range.hash
16
16
  end
17
17
 
18
+ def ==(other)
19
+ package == other.package &&
20
+ range == other.range
21
+ end
22
+
18
23
  def eql?(other)
19
24
  package.eql?(other.package) &&
20
25
  range.eql?(other.range)
21
26
  end
22
27
 
23
- def ==(other)
24
- package == other.package && range == other.range
25
- end
26
-
27
28
  class << self
28
29
  def exact(package, version)
29
30
  range = VersionRange.new(min: version, max: version, include_min: true, include_max: true)
@@ -19,7 +19,7 @@ module Bundler::PubGrub
19
19
  true
20
20
  end
21
21
 
22
- def eql?
22
+ def eql?(other)
23
23
  other.empty?
24
24
  end
25
25
 
@@ -65,6 +65,7 @@ module Bundler::PubGrub
65
65
  end
66
66
 
67
67
  EMPTY = Empty.new
68
+ Empty.singleton_class.undef_method(:new)
68
69
 
69
70
  def self.empty
70
71
  EMPTY
@@ -88,7 +89,8 @@ module Bundler::PubGrub
88
89
 
89
90
  def eql?(other)
90
91
  if other.is_a?(VersionRange)
91
- min.eql?(other.min) &&
92
+ !other.empty? &&
93
+ min.eql?(other.min) &&
92
94
  max.eql?(other.max) &&
93
95
  include_min.eql?(other.include_min) &&
94
96
  include_max.eql?(other.include_max)
@@ -125,6 +125,7 @@ module Bundler::PubGrub
125
125
  package = next_package_to_try
126
126
  unsatisfied_term = solution.unsatisfied.find { |t| t.package == package }
127
127
  version = source.versions_for(package, unsatisfied_term.constraint.range).first
128
+ logger.debug { "attempting #{package} #{version}" }
128
129
 
129
130
  if version.nil?
130
131
  add_incompatibility source.no_versions_incompatibility_for(package, unsatisfied_term)
@@ -148,9 +149,11 @@ module Bundler::PubGrub
148
149
  end
149
150
 
150
151
  unless conflict
151
- logger.info { "selecting #{package} #{version}" }
152
+ logger.info { "selected #{package} #{version}" }
152
153
 
153
154
  solution.decide(package, version)
155
+ else
156
+ logger.info { "conflict: #{conflict.inspect}" }
154
157
  end
155
158
 
156
159
  package
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.5".freeze
4
+ VERSION = "2.4.7".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -34,137 +34,141 @@ module Kernel
34
34
  # that file has already been loaded is preserved.
35
35
 
36
36
  def require(path) # :doc:
37
- if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
38
- monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
39
- end
40
- RUBYGEMS_ACTIVATION_MONITOR.enter
41
-
42
- path = path.to_path if path.respond_to? :to_path
43
-
44
- if spec = Gem.find_unresolved_default_spec(path)
45
- # Ensure -I beats a default gem
46
- resolved_path = begin
47
- rp = nil
48
- load_path_check_index = Gem.load_path_insert_index - Gem.activated_gem_paths
49
- Gem.suffixes.each do |s|
50
- $LOAD_PATH[0...load_path_check_index].each do |lp|
51
- safe_lp = lp.dup.tap(&Gem::UNTAINT)
52
- begin
53
- if File.symlink? safe_lp # for backward compatibility
54
- next
37
+ return gem_original_require(path) unless Gem.discover_gems_on_require
38
+
39
+ begin
40
+ if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
41
+ monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
42
+ end
43
+ RUBYGEMS_ACTIVATION_MONITOR.enter
44
+
45
+ path = path.to_path if path.respond_to? :to_path
46
+
47
+ if spec = Gem.find_unresolved_default_spec(path)
48
+ # Ensure -I beats a default gem
49
+ resolved_path = begin
50
+ rp = nil
51
+ load_path_check_index = Gem.load_path_insert_index - Gem.activated_gem_paths
52
+ Gem.suffixes.each do |s|
53
+ $LOAD_PATH[0...load_path_check_index].each do |lp|
54
+ safe_lp = lp.dup.tap(&Gem::UNTAINT)
55
+ begin
56
+ if File.symlink? safe_lp # for backward compatibility
57
+ next
58
+ end
59
+ rescue SecurityError
60
+ RUBYGEMS_ACTIVATION_MONITOR.exit
61
+ raise
55
62
  end
56
- rescue SecurityError
57
- RUBYGEMS_ACTIVATION_MONITOR.exit
58
- raise
59
- end
60
63
 
61
- full_path = File.expand_path(File.join(safe_lp, "#{path}#{s}"))
62
- if File.file?(full_path)
63
- rp = full_path
64
- break
64
+ full_path = File.expand_path(File.join(safe_lp, "#{path}#{s}"))
65
+ if File.file?(full_path)
66
+ rp = full_path
67
+ break
68
+ end
65
69
  end
70
+ break if rp
66
71
  end
67
- break if rp
72
+ rp
68
73
  end
69
- rp
74
+
75
+ begin
76
+ Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
77
+ rescue Exception
78
+ RUBYGEMS_ACTIVATION_MONITOR.exit
79
+ raise
80
+ end unless resolved_path
70
81
  end
71
82
 
72
- begin
73
- Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
74
- rescue Exception
75
- RUBYGEMS_ACTIVATION_MONITOR.exit
76
- raise
77
- end unless resolved_path
78
- end
83
+ # If there are no unresolved deps, then we can use just try
84
+ # normal require handle loading a gem from the rescue below.
79
85
 
80
- # If there are no unresolved deps, then we can use just try
81
- # normal require handle loading a gem from the rescue below.
86
+ if Gem::Specification.unresolved_deps.empty?
87
+ RUBYGEMS_ACTIVATION_MONITOR.exit
88
+ return gem_original_require(path)
89
+ end
82
90
 
83
- if Gem::Specification.unresolved_deps.empty?
84
- RUBYGEMS_ACTIVATION_MONITOR.exit
85
- return gem_original_require(path)
86
- end
91
+ # If +path+ is for a gem that has already been loaded, don't
92
+ # bother trying to find it in an unresolved gem, just go straight
93
+ # to normal require.
94
+ #--
95
+ # TODO request access to the C implementation of this to speed up RubyGems
87
96
 
88
- # If +path+ is for a gem that has already been loaded, don't
89
- # bother trying to find it in an unresolved gem, just go straight
90
- # to normal require.
91
- #--
92
- # TODO request access to the C implementation of this to speed up RubyGems
97
+ if Gem::Specification.find_active_stub_by_path(path)
98
+ RUBYGEMS_ACTIVATION_MONITOR.exit
99
+ return gem_original_require(path)
100
+ end
93
101
 
94
- if Gem::Specification.find_active_stub_by_path(path)
95
- RUBYGEMS_ACTIVATION_MONITOR.exit
96
- return gem_original_require(path)
97
- end
102
+ # Attempt to find +path+ in any unresolved gems...
103
+
104
+ found_specs = Gem::Specification.find_in_unresolved path
105
+
106
+ # If there are no directly unresolved gems, then try and find +path+
107
+ # in any gems that are available via the currently unresolved gems.
108
+ # For example, given:
109
+ #
110
+ # a => b => c => d
111
+ #
112
+ # If a and b are currently active with c being unresolved and d.rb is
113
+ # requested, then find_in_unresolved_tree will find d.rb in d because
114
+ # it's a dependency of c.
115
+ #
116
+ if found_specs.empty?
117
+ found_specs = Gem::Specification.find_in_unresolved_tree path
118
+
119
+ found_specs.each do |found_spec|
120
+ found_spec.activate
121
+ end
98
122
 
99
- # Attempt to find +path+ in any unresolved gems...
100
-
101
- found_specs = Gem::Specification.find_in_unresolved path
102
-
103
- # If there are no directly unresolved gems, then try and find +path+
104
- # in any gems that are available via the currently unresolved gems.
105
- # For example, given:
106
- #
107
- # a => b => c => d
108
- #
109
- # If a and b are currently active with c being unresolved and d.rb is
110
- # requested, then find_in_unresolved_tree will find d.rb in d because
111
- # it's a dependency of c.
112
- #
113
- if found_specs.empty?
114
- found_specs = Gem::Specification.find_in_unresolved_tree path
115
-
116
- found_specs.each do |found_spec|
117
- found_spec.activate
118
- end
123
+ # We found +path+ directly in an unresolved gem. Now we figure out, of
124
+ # the possible found specs, which one we should activate.
125
+ else
119
126
 
120
- # We found +path+ directly in an unresolved gem. Now we figure out, of
121
- # the possible found specs, which one we should activate.
122
- else
127
+ # Check that all the found specs are just different
128
+ # versions of the same gem
129
+ names = found_specs.map(&:name).uniq
123
130
 
124
- # Check that all the found specs are just different
125
- # versions of the same gem
126
- names = found_specs.map(&:name).uniq
131
+ if names.size > 1
132
+ RUBYGEMS_ACTIVATION_MONITOR.exit
133
+ raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
134
+ end
127
135
 
128
- if names.size > 1
129
- RUBYGEMS_ACTIVATION_MONITOR.exit
130
- raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
131
- end
136
+ # Ok, now find a gem that has no conflicts, starting
137
+ # at the highest version.
138
+ valid = found_specs.find {|s| !s.has_conflicts? }
132
139
 
133
- # Ok, now find a gem that has no conflicts, starting
134
- # at the highest version.
135
- valid = found_specs.find {|s| !s.has_conflicts? }
140
+ unless valid
141
+ le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
142
+ le.name = names.first
143
+ RUBYGEMS_ACTIVATION_MONITOR.exit
144
+ raise le
145
+ end
136
146
 
137
- unless valid
138
- le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
139
- le.name = names.first
140
- RUBYGEMS_ACTIVATION_MONITOR.exit
141
- raise le
147
+ valid.activate
142
148
  end
143
149
 
144
- valid.activate
145
- end
146
-
147
- RUBYGEMS_ACTIVATION_MONITOR.exit
148
- return gem_original_require(path)
149
- rescue LoadError => load_error
150
- if load_error.path == path
151
- RUBYGEMS_ACTIVATION_MONITOR.enter
150
+ RUBYGEMS_ACTIVATION_MONITOR.exit
151
+ return gem_original_require(path)
152
+ rescue LoadError => load_error
153
+ if load_error.path == path
154
+ RUBYGEMS_ACTIVATION_MONITOR.enter
155
+
156
+ begin
157
+ require_again = Gem.try_activate(path)
158
+ ensure
159
+ RUBYGEMS_ACTIVATION_MONITOR.exit
160
+ end
152
161
 
153
- begin
154
- require_again = Gem.try_activate(path)
155
- ensure
156
- RUBYGEMS_ACTIVATION_MONITOR.exit
162
+ return gem_original_require(path) if require_again
157
163
  end
158
164
 
159
- return gem_original_require(path) if require_again
160
- end
161
-
162
- raise load_error
163
- ensure
164
- if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
165
- if monitor_owned != (ow = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?)
166
- STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $!
167
- raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before #{monitor_owned} -> after #{ow}"
165
+ raise load_error
166
+ ensure
167
+ if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
168
+ if monitor_owned != (ow = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?)
169
+ STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $!
170
+ raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before #{monitor_owned} -> after #{ow}"
171
+ end
168
172
  end
169
173
  end
170
174
  end
@@ -143,7 +143,7 @@ module Gem::Deprecate
143
143
  end
144
144
 
145
145
  # Deprecation method to deprecate Rubygems commands
146
- def rubygems_deprecate_command
146
+ def rubygems_deprecate_command(version = Gem::Deprecate.next_rubygems_major_version)
147
147
  class_eval do
148
148
  define_method "deprecated?" do
149
149
  true
@@ -151,7 +151,7 @@ module Gem::Deprecate
151
151
 
152
152
  define_method "deprecation_warning" do
153
153
  msg = [ "#{self.command} command is deprecated",
154
- ". It will be removed in Rubygems #{Gem::Deprecate.next_rubygems_major_version}.\n",
154
+ ". It will be removed in Rubygems #{version}.\n",
155
155
  ]
156
156
 
157
157
  alert_warning "#{msg.join}" unless Gem::Deprecate.skip
@@ -131,8 +131,7 @@ class Gem::Ext::Builder
131
131
  when /CMakeLists.txt/ then
132
132
  Gem::Ext::CmakeBuilder
133
133
  when /Cargo.toml/ then
134
- # We use the spec name here to ensure we invoke the correct init function later
135
- Gem::Ext::CargoBuilder.new(@spec)
134
+ Gem::Ext::CargoBuilder.new
136
135
  else
137
136
  build_error("No builder for extension '#{extension}'")
138
137
  end