bundler 2.3.14 → 2.3.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64817a3760b34f35e53aea5e788049373a97d786d75921aa67fbd6a676eb5bcb
4
- data.tar.gz: 584ecd0d1b0a738a7de9e95f9cdbfef0ca3e8ac00f2a928fd5e23b4777b073e7
3
+ metadata.gz: 90ea0eb8e0cfa7a8f3c4cbbaaf462526decabe37e575a4d180e1565b8770ae9e
4
+ data.tar.gz: '050481f0d752f3e519b3d830f9f9f873b48d2e38879cc7a1ccb35ace0ee75c01'
5
5
  SHA512:
6
- metadata.gz: 5397e12203b667c6870f7ee605c7ad2b43c31af5716c45c2376577cc5a2a2be93b1e48ae36eab6e23f7b49e1942a21d9e8c3c04d2ea8d18606fd3e4ea2b4f1ac
7
- data.tar.gz: 1db7fcf817b82739a0b6867e532705fec37e82b571103b9e2b688374f208f4d5ce9e9daad3bdd0062abddfb9025190953535c100c3365c0b3109e993efdb1ea6
6
+ metadata.gz: 5e1de206741c6d35bbfaa5fb41b9af2b15dc08050831e51c92b2e7a9038f040e5a9326ba1bb21350e320c7f1c3a98174eae752fba042ff3a6911886e6f5c8fc1
7
+ data.tar.gz: 8dbccee1de0304584cb0f7a34d14f55e3d1accc5d298d0f676c2d967150d739e7b9916ca4c4b0ed5d6a7ce53d7d586946ec560e97367044257c2907e8bba2308
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # 2.3.15 (June 1, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Show better error when previous installation fails to be removed [#5564](https://github.com/rubygems/rubygems/pull/5564)
6
+ - Show exception cause in bug report template [#5563](https://github.com/rubygems/rubygems/pull/5563)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Fix `bundle remove` by invalidating cached `Bundle.definition` [#5443](https://github.com/rubygems/rubygems/pull/5443)
11
+ - Fix generated standalone script when it includes default gems [#5586](https://github.com/rubygems/rubygems/pull/5586)
12
+ - Skip duplicated dependency warning for gemspec dev deps [#5587](https://github.com/rubygems/rubygems/pull/5587)
13
+ - Give better conflict resolution advice [#5581](https://github.com/rubygems/rubygems/pull/5581)
14
+ - Fix crash when commenting out a mirror in configuration [#5576](https://github.com/rubygems/rubygems/pull/5576)
15
+ - Fix crash when installing gems with symlinks [#5570](https://github.com/rubygems/rubygems/pull/5570)
16
+ - Ignore `Errno::EROFS` errors when creating `bundler.lock` [#5580](https://github.com/rubygems/rubygems/pull/5580)
17
+ - Ignore `Errno::EPERM` errors when creating `bundler.lock` [#5579](https://github.com/rubygems/rubygems/pull/5579)
18
+ - Fix crash when printing resolution conflicts on metadata requirements [#5562](https://github.com/rubygems/rubygems/pull/5562)
19
+
1
20
  # 2.3.14 (May 18, 2022)
2
21
 
3
22
  ## Bug fixes:
@@ -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-05-18".freeze
8
- @git_commit_sha = "467ad58a7c".freeze
7
+ @built_at = "2022-06-01".freeze
8
+ @git_commit_sha = "e7e41afd92".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
data/lib/bundler/dsl.rb CHANGED
@@ -124,19 +124,17 @@ module Bundler
124
124
  raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
125
125
  "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
126
126
  "#{update_prompt}"
127
+ elsif current.source != dep.source
128
+ return if dep.type == :development
129
+ raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
130
+ "You specified that #{dep.name} (#{dep.requirement}) should come from " \
131
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
127
132
  else
128
133
  Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
129
134
  "You should probably keep only one of them.\n" \
130
135
  "Remove any duplicate entries and specify the gem only once.\n" \
131
136
  "While it's not a problem now, it could cause errors if you change the version of one of them later."
132
137
  end
133
-
134
- if current.source != dep.source
135
- return if dep.type == :development
136
- raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
137
- "You specified that #{dep.name} (#{dep.requirement}) should come from " \
138
- "#{current.source || "an unspecified source"} and #{dep.source}\n"
139
- end
140
138
  end
141
139
  end
142
140
 
@@ -79,10 +79,6 @@ module Bundler
79
79
  case @permission_type
80
80
  when :create
81
81
  "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
82
- when :delete
83
- permissions = "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
84
- permissions += ", and the same thing for all subdirectories inside #{@path}" if File.directory?(@path)
85
- permissions
86
82
  else
87
83
  "#{@permission_type} permissions for that path"
88
84
  end
@@ -172,4 +168,16 @@ module Bundler
172
168
 
173
169
  status_code(32)
174
170
  end
171
+
172
+ class DirectoryRemovalError < BundlerError
173
+ def initialize(orig_exception, msg)
174
+ full_message = "#{msg}.\n" \
175
+ "The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
176
+ " #{orig_exception.backtrace.join("\n ")}\n\n" \
177
+ "Bundler Error Backtrace:"
178
+ super(full_message)
179
+ end
180
+
181
+ status_code(36)
182
+ end
175
183
  end
@@ -65,8 +65,7 @@ module Bundler
65
65
  --- ERROR REPORT TEMPLATE -------------------------------------------------------
66
66
 
67
67
  ```
68
- #{e.class}: #{e.message}
69
- #{e.backtrace && e.backtrace.join("\n ").chomp}
68
+ #{exception_message(e)}
70
69
  ```
71
70
 
72
71
  #{Bundler::Env.report}
@@ -85,6 +84,21 @@ module Bundler
85
84
  EOS
86
85
  end
87
86
 
87
+ def exception_message(error)
88
+ message = serialized_exception_for(error)
89
+ cause = error.cause
90
+ return message unless cause
91
+
92
+ message + serialized_exception_for(cause)
93
+ end
94
+
95
+ def serialized_exception_for(e)
96
+ <<-EOS.gsub(/^ {8}/, "")
97
+ #{e.class}: #{e.message}
98
+ #{e.backtrace && e.backtrace.join("\n ").chomp}
99
+ EOS
100
+ end
101
+
88
102
  def issues_url(exception)
89
103
  message = exception.message.lines.first.tr(":", " ").chomp
90
104
  message = message.split("-").first if exception.is_a?(Errno)
@@ -72,6 +72,10 @@ module Bundler
72
72
 
73
73
  deps.each {|dep| Bundler.ui.confirm "#{SharedHelpers.pretty_dependency(dep, false)} was removed." }
74
74
  end
75
+
76
+ # Invalidate the cached Bundler.definition.
77
+ # This prevents e.g. `bundle remove ...` from using outdated information.
78
+ Bundler.reset_paths!
75
79
  end
76
80
 
77
81
  private
@@ -38,12 +38,7 @@ def gemfile(install = false, options = {}, &gemfile)
38
38
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
39
39
 
40
40
  begin
41
- old_root = Bundler.method(:root)
42
- bundler_module = class << Bundler; self; end
43
- bundler_module.send(:remove_method, :root)
44
- def Bundler.root
45
- Bundler::SharedHelpers.pwd.expand_path
46
- end
41
+ Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
47
42
  old_gemfile = ENV["BUNDLE_GEMFILE"]
48
43
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
49
44
 
@@ -71,11 +66,6 @@ def gemfile(install = false, options = {}, &gemfile)
71
66
  runtime.setup.require
72
67
  end
73
68
  ensure
74
- if bundler_module
75
- bundler_module.send(:remove_method, :root)
76
- bundler_module.send(:define_method, :root, old_root)
77
- end
78
-
79
69
  if old_gemfile
80
70
  ENV["BUNDLE_GEMFILE"] = old_gemfile
81
71
  else
@@ -66,7 +66,7 @@ module Bundler
66
66
  # require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
67
67
  # information.
68
68
  def run(options)
69
- create_bundle_path
69
+ Bundler.create_bundle_path
70
70
 
71
71
  ProcessLock.lock do
72
72
  if Bundler.frozen_bundle?
@@ -262,15 +262,6 @@ module Bundler
262
262
  end
263
263
  end
264
264
 
265
- def create_bundle_path
266
- SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p|
267
- Bundler.mkdir_p(p)
268
- end unless Bundler.bundle_path.exist?
269
- rescue Errno::EEXIST
270
- raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
271
- "because a file already exists at that path. Either remove or rename the file so the directory can be created."
272
- end
273
-
274
265
  # returns whether or not a re-resolve was needed
275
266
  def resolve_if_needed(options)
276
267
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
@@ -12,7 +12,7 @@ module Bundler
12
12
  yield
13
13
  f.flock(File::LOCK_UN)
14
14
  end
15
- rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
15
+ rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM, Errno::EROFS
16
16
  # In the case the user does not have access to
17
17
  # create the lock file or is using NFS where
18
18
  # locks are not available we skip locking.
@@ -19,13 +19,15 @@ module Bundler
19
19
  # collection of gemspecs is returned. Otherwise, nil is returned.
20
20
  def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
21
21
  base = SpecSet.new(base) unless base.is_a?(SpecSet)
22
- resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
22
+ metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
23
+ resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
23
24
  result = resolver.start(requirements)
24
- SpecSet.new(SpecSet.new(result).for(requirements.reject {|dep| dep.name.end_with?("\0") }))
25
+ SpecSet.new(SpecSet.new(result).for(regular_requirements))
25
26
  end
26
27
 
27
- def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
28
+ def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
28
29
  @source_requirements = source_requirements
30
+ @metadata_requirements = metadata_requirements
29
31
  @base = base
30
32
  @resolver = Molinillo::Resolver.new(self, self)
31
33
  @search_for = {}
@@ -344,8 +346,6 @@ module Bundler
344
346
  trees.sort_by! {|t| t.reverse.map(&:name) }
345
347
  end
346
348
 
347
- metadata_requirements = {}
348
-
349
349
  o << trees.map do |tree|
350
350
  t = "".dup
351
351
  depth = 2
@@ -354,7 +354,6 @@ module Bundler
354
354
  base_tree_name = base_tree.name
355
355
 
356
356
  if base_tree_name.end_with?("\0")
357
- metadata_requirements[base_tree_name] = base_tree
358
357
  t = nil
359
358
  else
360
359
  tree.each do |req|
@@ -393,10 +392,10 @@ module Bundler
393
392
  end
394
393
  end
395
394
  elsif name.end_with?("\0")
396
- o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
395
+ o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(@metadata_requirements.find {|req| req.name == name })}\n\n)
397
396
  elsif conflict.locked_requirement
398
397
  o << "\n"
399
- o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
398
+ o << %(Deleting your #{name_for_locking_dependency_source} file and running `bundle install` will rebuild your snapshot from scratch, using only\n)
400
399
  o << %(the gems in your Gemfile, which may resolve the conflict.\n)
401
400
  elsif !conflict.existing
402
401
  o << "\n"
@@ -93,14 +93,9 @@ module Bundler
93
93
  private
94
94
 
95
95
  def strict_rm_rf(dir)
96
- # FileUtils.rm_rf should probably rise in case of permission issues like
97
- # `rm -rf` does. However, it fails to delete the folder silently due to
98
- # https://github.com/ruby/fileutils/issues/57. It should probably be fixed
99
- # inside `fileutils` but for now I`m checking whether the folder was
100
- # removed after it completes, and raising otherwise.
101
- FileUtils.rm_rf dir
102
-
103
- raise PermissionError.new(dir, :delete) if File.directory?(dir)
96
+ Bundler.rm_rf dir
97
+ rescue Errno::ENOTEMPTY => e
98
+ raise DirectoryRemovalError.new(e.cause, "Could not delete previous installation of `#{dir}`")
104
99
  end
105
100
 
106
101
  def validate_bundler_checksum(checksum)
@@ -487,7 +487,7 @@ module Bundler
487
487
  /ix.freeze
488
488
 
489
489
  def self.key_for(key)
490
- key = normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
490
+ key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
491
491
  key = key.to_s.gsub(".", "__").gsub("-", "___").upcase
492
492
  "BUNDLE_#{key}"
493
493
  end
@@ -499,7 +499,7 @@ module Bundler
499
499
  end
500
500
 
501
501
  def rubygems_dir
502
- Bundler.rubygems.gem_dir
502
+ Bundler.bundle_path
503
503
  end
504
504
 
505
505
  def default_cache_path_for(dir)
@@ -64,9 +64,11 @@ module Bundler
64
64
  end
65
65
 
66
66
  def full_gem_path
67
- # deleted gems can have their stubs return nil, so in that case grab the
68
- # expired path from the full spec
69
- stub.full_gem_path || method_missing(:full_gem_path)
67
+ stub.full_gem_path
68
+ end
69
+
70
+ def full_gem_path=(path)
71
+ stub.full_gem_path = path
70
72
  end
71
73
 
72
74
  def full_require_paths
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.14".freeze
4
+ VERSION = "2.3.15".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
data/lib/bundler.rb CHANGED
@@ -97,6 +97,17 @@ module Bundler
97
97
  @bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
98
98
  end
99
99
 
100
+ def create_bundle_path
101
+ SharedHelpers.filesystem_access(bundle_path.to_s) do |p|
102
+ mkdir_p(p)
103
+ end unless bundle_path.exist?
104
+
105
+ @bundle_path = bundle_path.realpath
106
+ rescue Errno::EEXIST
107
+ raise PathError, "Could not install to path `#{bundle_path}` " \
108
+ "because a file already exists at that path. Either remove or rename the file so the directory can be created."
109
+ end
110
+
100
111
  def configured_bundle_path
101
112
  @configured_bundle_path ||= settings.path.tap(&:validate!)
102
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.14
4
+ version: 2.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2022-05-18 00:00:00.000000000 Z
25
+ date: 2022-06-01 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  - !ruby/object:Gem::Version
370
370
  version: 2.5.2
371
371
  requirements: []
372
- rubygems_version: 3.3.14
372
+ rubygems_version: 3.3.15
373
373
  signing_key:
374
374
  specification_version: 4
375
375
  summary: The best way to manage your application's dependencies