rubygems-update 3.4.8 → 3.4.9

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Manifest.txt +2 -0
  4. data/README.md +16 -0
  5. data/bundler/CHANGELOG.md +25 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/endpoint_specification.rb +0 -4
  8. data/bundler/lib/bundler/fetcher/dependency.rb +1 -5
  9. data/bundler/lib/bundler/incomplete_specification.rb +24 -0
  10. data/bundler/lib/bundler/lazy_specification.rb +4 -8
  11. data/bundler/lib/bundler/lockfile_parser.rb +2 -2
  12. data/bundler/lib/bundler/remote_specification.rb +2 -6
  13. data/bundler/lib/bundler/resolver/base.rb +5 -3
  14. data/bundler/lib/bundler/resolver.rb +6 -9
  15. data/bundler/lib/bundler/settings.rb +1 -1
  16. data/bundler/lib/bundler/shared_helpers.rb +1 -1
  17. data/bundler/lib/bundler/source/git/git_proxy.rb +5 -0
  18. data/bundler/lib/bundler/source/git.rb +1 -1
  19. data/bundler/lib/bundler/source/rubygems.rb +1 -2
  20. data/bundler/lib/bundler/spec_set.rb +12 -11
  21. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  22. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -0
  23. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +1 -1
  24. data/bundler/lib/bundler/uri_normalizer.rb +23 -0
  25. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +0 -5
  26. data/bundler/lib/bundler/version.rb +1 -1
  27. data/bundler/lib/bundler.rb +2 -0
  28. data/lib/rubygems/commands/pristine_command.rb +9 -0
  29. data/lib/rubygems/commands/uninstall_command.rb +3 -0
  30. data/lib/rubygems/core_ext/kernel_require.rb +0 -10
  31. data/lib/rubygems/ext/builder.rb +17 -0
  32. data/lib/rubygems/ext/ext_conf_builder.rb +1 -2
  33. data/lib/rubygems/ext/rake_builder.rb +1 -1
  34. data/lib/rubygems/package/tar_header.rb +1 -1
  35. data/lib/rubygems.rb +1 -1
  36. data/rubygems-update.gemspec +1 -1
  37. data/test/rubygems/package/tar_test_case.rb +1 -1
  38. data/test/rubygems/test_gem.rb +5 -0
  39. data/test/rubygems/test_gem_commands_pristine_command.rb +48 -0
  40. data/test/rubygems/test_gem_commands_uninstall_command.rb +31 -14
  41. data/test/rubygems/test_gem_gem_runner.rb +5 -0
  42. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b72ec3162017147a6f9615ce417dfe0f59cd925ceec0375a6ce918fff8853c7c
4
- data.tar.gz: 93a753b1da6838871ce0e36d140856ef4243ddf43d07ad0a3eb29b5b606fd2d2
3
+ metadata.gz: a0ce67a665c26fdc475dafc0858072799332dc0b01b57143bd46a25bd3d07c8d
4
+ data.tar.gz: 88d69d29ecde40e8ca5112f6ee1d706a66c7819842902a0515b322eeff6187f8
5
5
  SHA512:
6
- metadata.gz: 183cc6648ef21fb35b04ae47856cce4dbeb006bf59191aeff12852ee7498a2bca95858faeb7e439f26527d880a0f6f8c81a0bc2af2bd95fbf606d5318573b66d
7
- data.tar.gz: 52b9d7ba40df8205d56a472ec42e2214c1111356ea2d59e40fe066b1fd164b0f2983313009a3164007ec2adb59c0263cce251a54baaba3656c84445ca3f4a4da
6
+ metadata.gz: fd112dabe5437ac6a58a3bbcb73bd08bbc4061cce3c9e2923fead4816bdf956eb6ce4315fb16d40fc78179939bdb516c748fdb0a7a09debad2f520599968f137
7
+ data.tar.gz: 1a2ec92153d67b8d8deb53ead80c6ab7652d709cceb4ffe9d97528f1adcd0be95892e90a573a6ff305b82b5fd1ead9c48223bce93bf6d6bfe960c1bd71478629
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # 3.4.9 / 2023-03-20
2
+
3
+ ## Enhancements:
4
+
5
+ * Improve `TarHeader#calculate_checksum` speed and readability. Pull
6
+ request [#6476](https://github.com/rubygems/rubygems/pull/6476) by
7
+ Maumagnaguagno
8
+ * Added only missing extensions option into pristine command. Pull request
9
+ [#6446](https://github.com/rubygems/rubygems/pull/6446) by hsbt
10
+ * Installs bundler 2.4.9 as a default gem.
11
+
12
+ ## Bug fixes:
13
+
14
+ * Fix `$LOAD_PATH` in rake and ext_conf builder. Pull request
15
+ [#6490](https://github.com/rubygems/rubygems/pull/6490) by ntkme
16
+ * Fix `gem uninstall` with `--install-dir`. Pull request
17
+ [#6481](https://github.com/rubygems/rubygems/pull/6481) by
18
+ deivid-rodriguez
19
+
20
+ ## Documentation:
21
+
22
+ * Document our current release policy. Pull request
23
+ [#6450](https://github.com/rubygems/rubygems/pull/6450) by
24
+ deivid-rodriguez
25
+
1
26
  # 3.4.8 / 2023-03-08
2
27
 
3
28
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -80,6 +80,7 @@ bundler/lib/bundler/gem_helpers.rb
80
80
  bundler/lib/bundler/gem_tasks.rb
81
81
  bundler/lib/bundler/gem_version_promoter.rb
82
82
  bundler/lib/bundler/graph.rb
83
+ bundler/lib/bundler/incomplete_specification.rb
83
84
  bundler/lib/bundler/index.rb
84
85
  bundler/lib/bundler/injector.rb
85
86
  bundler/lib/bundler/inline.rb
@@ -243,6 +244,7 @@ bundler/lib/bundler/ui/rg_proxy.rb
243
244
  bundler/lib/bundler/ui/shell.rb
244
245
  bundler/lib/bundler/ui/silent.rb
245
246
  bundler/lib/bundler/uri_credentials_filter.rb
247
+ bundler/lib/bundler/uri_normalizer.rb
246
248
  bundler/lib/bundler/vendor/.document
247
249
  bundler/lib/bundler/vendor/connection_pool/LICENSE
248
250
  bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
data/README.md CHANGED
@@ -64,6 +64,22 @@ To upgrade to the latest RubyGems, run:
64
64
 
65
65
  See [UPGRADING](UPGRADING.md) for more details and alternative instructions.
66
66
 
67
+ ## Release policy
68
+
69
+ RubyGems and Bundler are released in sync, although they do not share their
70
+ major version number. It is planned that also their major version numbers will
71
+ be sync'ed in the future.
72
+
73
+ The release policy is somewhat similar to the release policy of Ruby itself:
74
+
75
+ * Frequent patch releases (every 2-4 weeks) including bug fixes, minor
76
+ enhancements, small features, or even medium sized features declared as
77
+ experimental for battle testing.
78
+ * Yearly minor releases including bigger features, and minor breaking changes
79
+ (affecting only edge cases and a very small set of users).
80
+ * Occasional major releases (replacing yearly minors) including major breaking
81
+ changes.
82
+
67
83
  ## Documentation
68
84
 
69
85
  RubyGems uses [rdoc](https://github.com/rdoc/rdoc) for documentation. A compiled set of the docs
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # 2.4.9 (March 20, 2023)
2
+
3
+ ## Security:
4
+
5
+ - Don't recommend `--full-index` on errors [#6493](https://github.com/rubygems/rubygems/pull/6493)
6
+
7
+ ## Enhancements:
8
+
9
+ - Fix duplicated specs in some error messages [#6475](https://github.com/rubygems/rubygems/pull/6475)
10
+ - When running `bundle lock --update <name>`, checkout locked revision of unrelated git sources directly [#6459](https://github.com/rubygems/rubygems/pull/6459)
11
+ - Avoid expiring git sources when unnecessary [#6458](https://github.com/rubygems/rubygems/pull/6458)
12
+ - Use `RbSys::ExtensionTask` when creating new rust gems [#6352](https://github.com/rubygems/rubygems/pull/6352)
13
+ - Don't ignore pre-releases when there's only one candidate [#6441](https://github.com/rubygems/rubygems/pull/6441)
14
+
15
+ ## Bug fixes:
16
+
17
+ - Fix incorrect removal of ruby platform when auto-healing corrupted lockfiles [#6495](https://github.com/rubygems/rubygems/pull/6495)
18
+ - Don't consider platform specific candidates when `force_ruby_platform` set [#6442](https://github.com/rubygems/rubygems/pull/6442)
19
+ - Better deal with circular dependencies [#6330](https://github.com/rubygems/rubygems/pull/6330)
20
+
21
+ ## Documentation:
22
+
23
+ - Add debugging docs [#6387](https://github.com/rubygems/rubygems/pull/6387)
24
+ - Document our current release policy [#6450](https://github.com/rubygems/rubygems/pull/6450)
25
+
1
26
  # 2.4.8 (March 8, 2023)
2
27
 
3
28
  ## Security:
@@ -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 = "2023-03-08".freeze
8
- @git_commit_sha = "a67b2657a0".freeze
7
+ @built_at = "2023-03-20".freeze
8
+ @git_commit_sha = "6f8e92bcc6".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -26,10 +26,6 @@ module Bundler
26
26
  @platform
27
27
  end
28
28
 
29
- def identifier
30
- @__identifier ||= [name, version, platform.to_s]
31
- end
32
-
33
29
  # needed for standalone, load required_paths from local gemspec
34
30
  # after the gem is installed
35
31
  def require_paths
@@ -34,14 +34,10 @@ module Bundler
34
34
 
35
35
  returned_gems = spec_list.map(&:first).uniq
36
36
  specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list)
37
- rescue MarshalError
37
+ rescue MarshalError, HTTPError, GemspecError
38
38
  Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
39
39
  Bundler.ui.debug "could not fetch from the dependency API, trying the full index"
40
40
  nil
41
- rescue HTTPError, GemspecError
42
- Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
43
- Bundler.ui.debug "could not fetch from the dependency API\nit's suggested to retry using the full index via `bundle install --full-index`"
44
- nil
45
41
  end
46
42
 
47
43
  def dependency_specs(gem_names)
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ #
5
+ # Represents a package name that was found to be incomplete when trying to
6
+ # materialize a fresh resolution or the lockfile.
7
+ #
8
+ # Holds the actual partially complete set of specifications for the name.
9
+ # These are used so that they can be unlocked in a future resolution, and fix
10
+ # the situation.
11
+ #
12
+ class IncompleteSpecification
13
+ attr_reader :name, :partially_complete_specs
14
+
15
+ def initialize(name, partially_complete_specs = [])
16
+ @name = name
17
+ @partially_complete_specs = partially_complete_specs
18
+ end
19
+
20
+ def ==(other)
21
+ partially_complete_specs == other.partially_complete_specs
22
+ end
23
+ end
24
+ end
@@ -20,7 +20,7 @@ module Bundler
20
20
  end
21
21
 
22
22
  def full_name
23
- if platform == Gem::Platform::RUBY
23
+ @full_name ||= if platform == Gem::Platform::RUBY
24
24
  "#{@name}-#{@version}"
25
25
  else
26
26
  "#{@name}-#{@version}-#{platform}"
@@ -28,15 +28,15 @@ module Bundler
28
28
  end
29
29
 
30
30
  def ==(other)
31
- identifier == other.identifier
31
+ full_name == other.full_name
32
32
  end
33
33
 
34
34
  def eql?(other)
35
- identifier.eql?(other.identifier)
35
+ full_name.eql?(other.full_name)
36
36
  end
37
37
 
38
38
  def hash
39
- identifier.hash
39
+ full_name.hash
40
40
  end
41
41
 
42
42
  ##
@@ -129,10 +129,6 @@ module Bundler
129
129
  end
130
130
  end
131
131
 
132
- def identifier
133
- @__identifier ||= [name, version, platform.to_s]
134
- end
135
-
136
132
  def git_version
137
133
  return unless source.is_a?(Bundler::Source::Git)
138
134
  " #{source.revision[0..6]}"
@@ -86,7 +86,7 @@ module Bundler
86
86
  send("parse_#{@state}", line)
87
87
  end
88
88
  end
89
- @specs = @specs.values.sort_by(&:identifier)
89
+ @specs = @specs.values.sort_by(&:full_name)
90
90
  rescue ArgumentError => e
91
91
  Bundler.ui.debug(e)
92
92
  raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
@@ -199,7 +199,7 @@ module Bundler
199
199
  @current_spec.source = @current_source
200
200
  @current_source.add_dependency_names(name)
201
201
 
202
- @specs[@current_spec.identifier] = @current_spec
202
+ @specs[@current_spec.full_name] = @current_spec
203
203
  elsif spaces.size == 6
204
204
  version = version.split(",").map(&:strip) if version
205
205
  dep = Gem::Dependency.new(name, version)
@@ -29,12 +29,8 @@ 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
-
36
32
  def full_name
37
- if @platform == Gem::Platform::RUBY
33
+ @full_name ||= if @platform == Gem::Platform::RUBY
38
34
  "#{@name}-#{@version}"
39
35
  else
40
36
  "#{@name}-#{@version}-#{@platform}"
@@ -106,7 +102,7 @@ module Bundler
106
102
  def _remote_specification
107
103
  @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @original_platform])
108
104
  @_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
109
- " missing from the server! Try installing with `--full-index` as a workaround.")
105
+ " missing from the server!")
110
106
  end
111
107
 
112
108
  def method_missing(method, *args, &blk)
@@ -34,9 +34,11 @@ module Bundler
34
34
  @base[name]
35
35
  end
36
36
 
37
- def delete(specs)
38
- specs.each do |spec|
39
- @base.delete(spec)
37
+ def delete(incomplete_specs)
38
+ incomplete_specs.each do |incomplete_spec|
39
+ incomplete_spec.partially_complete_specs.each do |spec|
40
+ @base.delete(spec)
41
+ end
40
42
  end
41
43
  end
42
44
 
@@ -37,7 +37,9 @@ module Bundler
37
37
  root_version = Resolver::Candidate.new(0)
38
38
 
39
39
  @all_specs = Hash.new do |specs, name|
40
- specs[name] = source_for(name).specs.search(name).sort_by {|s| [s.version, s.platform.to_s] }
40
+ specs[name] = source_for(name).specs.search(name).reject do |s|
41
+ s.dependencies.any? {|d| d.name == name && !d.requirement.satisfied_by?(s.version) } # ignore versions that depend on themselves incorrectly
42
+ end.sort_by {|s| [s.version, s.platform.to_s] }
41
43
  end
42
44
 
43
45
  @sorted_versions = Hash.new do |candidates, package|
@@ -55,7 +57,7 @@ module Bundler
55
57
  { root_version => root_dependencies }
56
58
  else
57
59
  Hash.new do |versions, version|
58
- versions[version] = to_dependency_hash(version.dependencies, @packages)
60
+ versions[version] = to_dependency_hash(version.dependencies.reject {|d| d.name == package.name }, @packages)
59
61
  end
60
62
  end
61
63
  end
@@ -186,11 +188,6 @@ module Bundler
186
188
  package_deps = @cached_dependencies[package]
187
189
  sorted_versions = @sorted_versions[package]
188
190
  package_deps[version].map do |dep_package, dep_constraint|
189
- if package == dep_package
190
- cause = PubGrub::Incompatibility::CircularDependency.new(dep_package, dep_constraint.constraint_string)
191
- return [PubGrub::Incompatibility.new([PubGrub::Term.new(dep_constraint, true)], :cause => cause)]
192
- end
193
-
194
191
  low = high = sorted_versions.index(version)
195
192
 
196
193
  # find version low such that all >= low share the same dep
@@ -243,7 +240,7 @@ module Bundler
243
240
  ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
244
241
  groups << Resolver::Candidate.new(version, :specs => ruby_specs) if ruby_specs.any?
245
242
 
246
- next groups if platform_specs == ruby_specs
243
+ next groups if platform_specs == ruby_specs || package.force_ruby_platform?
247
244
 
248
245
  groups << Resolver::Candidate.new(version, :specs => platform_specs)
249
246
 
@@ -302,7 +299,7 @@ module Bundler
302
299
  end
303
300
 
304
301
  def filter_prereleases(specs, package)
305
- return specs unless package.ignores_prereleases?
302
+ return specs unless package.ignores_prereleases? && specs.size > 1
306
303
 
307
304
  specs.reject {|s| s.version.prerelease? }
308
305
  end
@@ -495,7 +495,7 @@ module Bundler
495
495
  uri = $2
496
496
  suffix = $3
497
497
  end
498
- uri = "#{uri}/" unless uri.end_with?("/")
498
+ uri = URINormalizer.normalize_suffix(uri)
499
499
  require_relative "vendored_uri"
500
500
  uri = Bundler::URI(uri)
501
501
  unless uri.absolute?
@@ -160,7 +160,7 @@ module Bundler
160
160
  " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
161
161
  raise APIResponseMismatchError,
162
162
  "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \
163
- "\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
163
+ "\nRunning `bundle update #{spec.name}` should fix the problem."
164
164
  end
165
165
 
166
166
  def pretty_dependency(dep)
@@ -366,6 +366,11 @@ module Bundler
366
366
  args += ["--single-branch"]
367
367
  args.unshift("--no-tags") if supports_cloning_with_no_tags?
368
368
 
369
+ # If there's a locked revision, no need to clone any specific branch
370
+ # or tag, since we will end up checking out that locked revision
371
+ # anyways.
372
+ return args if @revision
373
+
369
374
  args += ["--branch", branch || tag] if branch || tag
370
375
  args
371
376
  end
@@ -19,7 +19,7 @@ module Bundler
19
19
  # Stringify options that could be set as symbols
20
20
  %w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
21
21
 
22
- @uri = options["uri"] || ""
22
+ @uri = URINormalizer.normalize_suffix(options["uri"] || "", :trailing_slash => false)
23
23
  @safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
24
24
  @branch = options["branch"]
25
25
  @ref = options["ref"] || options["branch"] || options["tag"]
@@ -337,8 +337,7 @@ module Bundler
337
337
  end
338
338
 
339
339
  def normalize_uri(uri)
340
- uri = uri.to_s
341
- uri = "#{uri}/" unless %r{/$}.match?(uri)
340
+ uri = URINormalizer.normalize_suffix(uri.to_s)
342
341
  require_relative "../vendored_uri"
343
342
  uri = Bundler::URI(uri)
344
343
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
@@ -7,11 +7,8 @@ module Bundler
7
7
  include Enumerable
8
8
  include TSort
9
9
 
10
- attr_reader :incomplete_specs
11
-
12
- def initialize(specs, incomplete_specs = [])
10
+ def initialize(specs)
13
11
  @specs = specs
14
- @incomplete_specs = incomplete_specs
15
12
  end
16
13
 
17
14
  def for(dependencies, check = false, platforms = [nil])
@@ -45,11 +42,11 @@ module Bundler
45
42
  end
46
43
 
47
44
  if incomplete && check
48
- @incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
45
+ specs << IncompleteSpecification.new(name, lookup[name])
49
46
  end
50
47
  end
51
48
 
52
- specs
49
+ specs.uniq
53
50
  end
54
51
 
55
52
  def [](key)
@@ -81,10 +78,10 @@ module Bundler
81
78
  lookup.dup
82
79
  end
83
80
 
84
- def materialize(deps)
85
- materialized = self.for(deps, true)
81
+ def materialize(deps, platforms = [nil])
82
+ materialized = self.for(deps, true, platforms)
86
83
 
87
- SpecSet.new(materialized, incomplete_specs)
84
+ SpecSet.new(materialized)
88
85
  end
89
86
 
90
87
  # Materialize for all the specs in the spec set, regardless of what platform they're for
@@ -101,15 +98,19 @@ module Bundler
101
98
  end
102
99
 
103
100
  def incomplete_ruby_specs?(deps)
104
- self.for(deps, true, [Gem::Platform::RUBY])
101
+ return false if @specs.empty?
105
102
 
106
- @incomplete_specs.any?
103
+ materialize(deps, [Gem::Platform::RUBY]).incomplete_specs.any?
107
104
  end
108
105
 
109
106
  def missing_specs
110
107
  @specs.select {|s| s.is_a?(LazySpecification) }
111
108
  end
112
109
 
110
+ def incomplete_specs
111
+ @specs.select {|s| s.is_a?(IncompleteSpecification) }
112
+ end
113
+
113
114
  def merge(set)
114
115
  arr = sorted.dup
115
116
  set.each do |set_spec|
@@ -10,7 +10,7 @@ gem "rake", "~> 13.0"
10
10
 
11
11
  gem "rake-compiler"
12
12
  <%- if config[:ext] == 'rust' -%>
13
- gem "rb_sys"
13
+ gem "rb_sys", "~> 0.9.63"
14
14
  <%- end -%>
15
15
  <%- end -%>
16
16
  <%- if config[:test] -%>
@@ -41,6 +41,15 @@ require "standard/rake"
41
41
  <% if config[:ext] -%>
42
42
  <% default_task_names.unshift(:compile) -%>
43
43
  <% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%>
44
+ <% if config[:ext] == 'rust' -%>
45
+ require "rb_sys/extensiontask"
46
+
47
+ task build: :compile
48
+
49
+ RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext|
50
+ ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
51
+ end
52
+ <% else -%>
44
53
  require "rake/extensiontask"
45
54
 
46
55
  task build: :compile
@@ -48,6 +57,7 @@ task build: :compile
48
57
  Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
49
58
  ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
50
59
  end
60
+ <% end -%>
51
61
 
52
62
  <% end -%>
53
63
  <% if default_task_names.size == 1 -%>
@@ -20,7 +20,7 @@ jobs:
20
20
  - uses: actions/checkout@v3
21
21
  <%- if config[:ext] == 'rust' -%>
22
22
  - name: Set up Ruby & Rust
23
- uses: oxidize-rb/actions/setup-ruby-and-rust@main
23
+ uses: oxidize-rb/actions/setup-ruby-and-rust@v1
24
24
  with:
25
25
  ruby-version: ${{ matrix.ruby }}
26
26
  bundler-cache: true
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module URINormalizer
5
+ module_function
6
+
7
+ # Normalizes uri to a consistent version, either with or without trailing
8
+ # slash.
9
+ #
10
+ # TODO: Currently gem sources are locked with a trailing slash, while git
11
+ # sources are locked without a trailing slash. This should be normalized but
12
+ # the inconsistency is there for now to avoid changing all lockfiles
13
+ # including GIT sources. We could normalize this on the next major.
14
+ #
15
+ def normalize_suffix(uri, trailing_slash: true)
16
+ if trailing_slash
17
+ uri.end_with?("/") ? uri : "#{uri}/"
18
+ else
19
+ uri.end_with?("/") ? uri.delete_suffix("/") : uri
20
+ end
21
+ end
22
+ end
23
+ end
@@ -8,9 +8,6 @@ module Bundler::PubGrub
8
8
  InvalidDependency = Struct.new(:package, :constraint) do
9
9
  end
10
10
 
11
- CircularDependency = Struct.new(:package, :constraint) do
12
- end
13
-
14
11
  NoVersions = Struct.new(:constraint) do
15
12
  end
16
13
 
@@ -66,8 +63,6 @@ module Bundler::PubGrub
66
63
  "#{terms[0].to_s(allow_every: true)} depends on #{terms[1].invert}"
67
64
  when Bundler::PubGrub::Incompatibility::InvalidDependency
68
65
  "#{terms[0].to_s(allow_every: true)} depends on unknown package #{cause.package}"
69
- when Bundler::PubGrub::Incompatibility::CircularDependency
70
- "#{terms[0].to_s(allow_every: true)} depends on itself"
71
66
  when Bundler::PubGrub::Incompatibility::NoVersions
72
67
  "no versions satisfy #{cause.constraint}"
73
68
  when Bundler::PubGrub::Incompatibility::ConflictCause
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.8".freeze
4
+ VERSION = "2.4.9".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -62,6 +62,7 @@ module Bundler
62
62
  autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
63
63
  autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
64
64
  autoload :Graph, File.expand_path("bundler/graph", __dir__)
65
+ autoload :IncompleteSpecification, File.expand_path("bundler/incomplete_specification", __dir__)
65
66
  autoload :Index, File.expand_path("bundler/index", __dir__)
66
67
  autoload :Injector, File.expand_path("bundler/injector", __dir__)
67
68
  autoload :Installer, File.expand_path("bundler/installer", __dir__)
@@ -85,6 +86,7 @@ module Bundler
85
86
  autoload :StubSpecification, File.expand_path("bundler/stub_specification", __dir__)
86
87
  autoload :UI, File.expand_path("bundler/ui", __dir__)
87
88
  autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
89
+ autoload :URINormalizer, File.expand_path("bundler/uri_normalizer", __dir__)
88
90
 
89
91
  class << self
90
92
  def configure
@@ -34,6 +34,11 @@ class Gem::Commands::PristineCommand < Gem::Command
34
34
  options[:extensions] = value
35
35
  end
36
36
 
37
+ add_option("--only-missing-extensions",
38
+ "Only restore gems with missing extensions") do |value, options|
39
+ options[:only_missing_extensions] = value
40
+ end
41
+
37
42
  add_option("--only-executables",
38
43
  "Only restore executables") do |value, options|
39
44
  options[:only_executables] = value
@@ -107,6 +112,10 @@ extensions will be restored.
107
112
  Gem::Specification.select do |spec|
108
113
  spec.extensions && !spec.extensions.empty?
109
114
  end
115
+ elsif options[:only_missing_extensions]
116
+ Gem::Specification.select do |spec|
117
+ spec.missing_extensions?
118
+ end
110
119
  else
111
120
  get_all_gem_names.sort.map do |gem_name|
112
121
  Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
@@ -125,6 +125,9 @@ that is a dependency of an existing gem. You can use the
125
125
  def execute
126
126
  check_version
127
127
 
128
+ # Consider only gem specifications installed at `--install-dir`
129
+ Gem::Specification.dirs = options[:install_dir] if options[:install_dir]
130
+
128
131
  if options[:all] && !options[:args].empty?
129
132
  uninstall_specific
130
133
  elsif options[:all]
@@ -37,9 +37,6 @@ module Kernel
37
37
  return gem_original_require(path) unless Gem.discover_gems_on_require
38
38
 
39
39
  begin
40
- if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
41
- monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
42
- end
43
40
  RUBYGEMS_ACTIVATION_MONITOR.enter
44
41
 
45
42
  path = path.to_path if path.respond_to? :to_path
@@ -163,13 +160,6 @@ module Kernel
163
160
  end
164
161
 
165
162
  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
172
- end
173
163
  end
174
164
  end
175
165
 
@@ -55,6 +55,23 @@ class Gem::Ext::Builder
55
55
  end
56
56
  end
57
57
 
58
+ def self.ruby
59
+ require "shellwords"
60
+ # Gem.ruby is quoted if it contains whitespace
61
+ cmd = Gem.ruby.shellsplit
62
+
63
+ # This load_path is only needed when running rubygems test without a proper installation.
64
+ # Prepending it in a normal installation will cause problem with order of $LOAD_PATH.
65
+ # Therefore only add load_path if it is not present in the default $LOAD_PATH.
66
+ load_path = File.expand_path("../..", __dir__)
67
+ case load_path
68
+ when RbConfig::CONFIG["sitelibdir"], RbConfig::CONFIG["vendorlibdir"], RbConfig::CONFIG["rubylibdir"]
69
+ cmd
70
+ else
71
+ cmd << "-I#{load_path}"
72
+ end
73
+ end
74
+
58
75
  def self.run(command, results, command_name = nil, dir = Dir.pwd, env = {})
59
76
  verbose = Gem.configuration.really_verbose
60
77
 
@@ -21,8 +21,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
21
21
  destdir = ENV["DESTDIR"]
22
22
 
23
23
  begin
24
- require "shellwords"
25
- cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../..", __dir__) << File.basename(extension)
24
+ cmd = ruby << File.basename(extension)
26
25
  cmd.push(*args)
27
26
 
28
27
  run(cmd, results, class_name, extension_dir) do |s, r|
@@ -18,7 +18,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
18
18
  rake = rake.shellsplit
19
19
  else
20
20
  begin
21
- rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path("rake", "rake")]
21
+ rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
22
22
  rescue Gem::Exception
23
23
  rake = [Gem.default_exec_format % "rake"]
24
24
  end
@@ -208,7 +208,7 @@ class Gem::Package::TarHeader
208
208
  private
209
209
 
210
210
  def calculate_checksum(header)
211
- header.unpack("C*").inject {|a, b| a + b }
211
+ header.sum(0)
212
212
  end
213
213
 
214
214
  def header(checksum = @checksum)
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require "rbconfig"
9
9
 
10
10
  module Gem
11
- VERSION = "3.4.8"
11
+ VERSION = "3.4.9"
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.4.8"
5
+ s.version = "3.4.9"
6
6
  s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
7
7
  s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
8
8
 
@@ -67,7 +67,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
67
67
  end
68
68
 
69
69
  def calc_checksum(header)
70
- sum = header.unpack("C*").inject {|s,a| s + a }
70
+ sum = header.sum(0)
71
71
  SP(Z(to_oct(sum, 6)))
72
72
  end
73
73
 
@@ -1464,6 +1464,9 @@ class TestGem < Gem::TestCase
1464
1464
  end
1465
1465
 
1466
1466
  def test_load_user_installed_plugins
1467
+ @orig_gem_home = ENV["GEM_HOME"]
1468
+ ENV["GEM_HOME"] = @gemhome
1469
+
1467
1470
  plugin_path = File.join "lib", "rubygems_plugin.rb"
1468
1471
 
1469
1472
  Dir.chdir @tempdir do
@@ -1486,6 +1489,8 @@ class TestGem < Gem::TestCase
1486
1489
  Gem.load_plugins
1487
1490
 
1488
1491
  assert_equal %w[plugin], PLUGINS_LOADED
1492
+ ensure
1493
+ ENV["GEM_HOME"] = @orig_gem_home
1489
1494
  end
1490
1495
 
1491
1496
  def test_load_env_plugins
@@ -202,6 +202,54 @@ class TestGemCommandsPristineCommand < Gem::TestCase
202
202
  assert_empty out, out.inspect
203
203
  end
204
204
 
205
+ def test_execute_extensions_only_missing_extensions
206
+ a = util_spec "a" do |s|
207
+ s.extensions << "ext/a/extconf.rb"
208
+ end
209
+
210
+ ext_path = File.join @tempdir, "ext", "a", "extconf.rb"
211
+ write_file ext_path do |io|
212
+ io.write <<-'RUBY'
213
+ File.open "Makefile", "w" do |f|
214
+ f.puts "clean:\n\techo cleaned\n"
215
+ f.puts "all:\n\techo built\n"
216
+ f.puts "install:\n\techo installed\n"
217
+ end
218
+ RUBY
219
+ end
220
+
221
+ b = util_spec "b" do |s|
222
+ s.extensions << "ext/b/extconf.rb"
223
+ end
224
+
225
+ ext_path = File.join @tempdir, "ext", "b", "extconf.rb"
226
+ write_file ext_path do |io|
227
+ io.write <<-'RUBY'
228
+ File.open "Makefile", "w" do |f|
229
+ f.puts "clean:\n\techo cleaned\n"
230
+ f.puts "all:\n\techo built\n"
231
+ f.puts "install:\n\techo installed\n"
232
+ end
233
+ RUBY
234
+ end
235
+
236
+ install_gem a
237
+ install_gem b
238
+
239
+ # Remove the extension files for b
240
+ FileUtils.rm_rf b.gem_build_complete_path
241
+
242
+ @cmd.options[:only_missing_extensions] = true
243
+ @cmd.options[:args] = []
244
+
245
+ use_ui @ui do
246
+ @cmd.execute
247
+ end
248
+
249
+ refute_includes @ui.output, "Restored #{a.full_name}"
250
+ assert_includes @ui.output, "Restored #{b.full_name}"
251
+ end
252
+
205
253
  def test_execute_no_extension
206
254
  a = util_spec "a" do |s|
207
255
  s.extensions << "ext/a/extconf.rb"
@@ -22,12 +22,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
22
22
  a_4, = util_gem "a", 4
23
23
  install_gem a_4, :install_dir => gemhome2
24
24
 
25
- Gem::Specification.dirs = [@gemhome, gemhome2]
26
-
27
- assert_includes Gem::Specification.all_names, "a-1"
28
- assert_includes Gem::Specification.all_names, "a-4"
29
- assert_includes Gem::Specification.all_names, "b-2"
30
- assert_includes Gem::Specification.all_names, "default-1"
25
+ assert_gems_presence "a-1", "a-4", "b-2", "default-1", dirs: [@gemhome, gemhome2]
31
26
 
32
27
  @cmd.options[:all] = true
33
28
  @cmd.options[:args] = %w[a]
@@ -346,11 +341,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
346
341
  a_4, = util_gem "a", 4
347
342
  install_gem a_4
348
343
 
349
- Gem::Specification.dirs = [@gemhome, gemhome2]
350
-
351
- assert_includes Gem::Specification.all_names, "a-1"
352
- assert_includes Gem::Specification.all_names, "a-4"
353
- assert_includes Gem::Specification.all_names, "default-1"
344
+ assert_gems_presence "a-1", "a-4", "default-1", dirs: [@gemhome, gemhome2]
354
345
 
355
346
  @cmd.options[:all] = true
356
347
  @cmd.options[:args] = []
@@ -371,9 +362,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
371
362
  a_4, = util_gem "a", 4
372
363
  install_gem a_4 , :install_dir => gemhome2
373
364
 
374
- Gem::Specification.dirs = [@gemhome, gemhome2]
375
-
376
- assert_includes Gem::Specification.all_names, "a-4"
365
+ assert_gems_presence "a-4", dirs: [@gemhome, gemhome2]
377
366
 
378
367
  @cmd.options[:args] = ["a:4"]
379
368
 
@@ -386,6 +375,26 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
386
375
  assert_includes e.message, "a is not installed in GEM_HOME"
387
376
  end
388
377
 
378
+ def test_execute_outside_gem_home_when_install_dir_given
379
+ gemhome2 = "#{@gemhome}2"
380
+
381
+ a_4, = util_gem "a", 4
382
+ install_gem a_4 , :install_dir => gemhome2
383
+
384
+ assert_gems_presence "a-4", dirs: [@gemhome, gemhome2]
385
+
386
+ Gem::Specification.dirs = [@gemhome]
387
+
388
+ @cmd.options[:install_dir] = gemhome2
389
+ @cmd.options[:args] = ["a:4"]
390
+
391
+ @cmd.execute
392
+
393
+ Gem::Specification.dirs = [gemhome2]
394
+
395
+ refute_includes Gem::Specification.all_names.sort, "a-4"
396
+ end
397
+
389
398
  def test_handle_options
390
399
  @cmd.handle_options %w[]
391
400
 
@@ -501,4 +510,12 @@ WARNING: Use your OS package manager to uninstall vendor gems
501
510
  end
502
511
  end
503
512
  end
513
+
514
+ def assert_gems_presence(*gems, dirs:)
515
+ Gem::Specification.dirs = dirs
516
+
517
+ gems.each do |full_name|
518
+ assert_includes Gem::Specification.all_names, full_name
519
+ end
520
+ end
504
521
  end
@@ -3,6 +3,9 @@ require_relative "helper"
3
3
 
4
4
  class TestGemGemRunner < Gem::TestCase
5
5
  def setup
6
+ @orig_gem_home = ENV["GEM_HOME"]
7
+ ENV["GEM_HOME"] = @gemhome
8
+
6
9
  require "rubygems/command"
7
10
  @orig_args = Gem::Command.build_args
8
11
  @orig_specific_extra_args = Gem::Command.specific_extra_args_hash.dup
@@ -20,6 +23,8 @@ class TestGemGemRunner < Gem::TestCase
20
23
  Gem::Command.build_args = @orig_args
21
24
  Gem::Command.specific_extra_args_hash = @orig_specific_extra_args
22
25
  Gem::Command.extra_args = @orig_extra_args
26
+
27
+ ENV["GEM_HOME"] = @orig_gem_home
23
28
  end
24
29
 
25
30
  def test_do_configuration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.8
4
+ version: 3.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2023-03-08 00:00:00.000000000 Z
19
+ date: 2023-03-20 00:00:00.000000000 Z
20
20
  dependencies: []
21
21
  description: |-
22
22
  A package (also known as a library) contains a set of functionality
@@ -136,6 +136,7 @@ files:
136
136
  - bundler/lib/bundler/gem_tasks.rb
137
137
  - bundler/lib/bundler/gem_version_promoter.rb
138
138
  - bundler/lib/bundler/graph.rb
139
+ - bundler/lib/bundler/incomplete_specification.rb
139
140
  - bundler/lib/bundler/index.rb
140
141
  - bundler/lib/bundler/injector.rb
141
142
  - bundler/lib/bundler/inline.rb
@@ -299,6 +300,7 @@ files:
299
300
  - bundler/lib/bundler/ui/shell.rb
300
301
  - bundler/lib/bundler/ui/silent.rb
301
302
  - bundler/lib/bundler/uri_credentials_filter.rb
303
+ - bundler/lib/bundler/uri_normalizer.rb
302
304
  - bundler/lib/bundler/vendor/.document
303
305
  - bundler/lib/bundler/vendor/connection_pool/LICENSE
304
306
  - bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
@@ -835,7 +837,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
835
837
  - !ruby/object:Gem::Version
836
838
  version: '0'
837
839
  requirements: []
838
- rubygems_version: 3.4.8
840
+ rubygems_version: 3.4.9
839
841
  signing_key:
840
842
  specification_version: 4
841
843
  summary: RubyGems is a package management framework for Ruby.