bundler 2.3.22 → 2.3.24
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/init.rb +5 -1
- data/lib/bundler/definition.rb +12 -40
- data/lib/bundler/dsl.rb +0 -1
- data/lib/bundler/endpoint_specification.rb +4 -0
- data/lib/bundler/gem_helpers.rb +0 -1
- data/lib/bundler/gem_version_promoter.rb +6 -7
- data/lib/bundler/index.rb +3 -27
- data/lib/bundler/injector.rb +1 -1
- data/lib/bundler/lazy_specification.rb +7 -11
- data/lib/bundler/remote_specification.rb +6 -2
- data/lib/bundler/resolver/base.rb +1 -1
- data/lib/bundler/resolver/spec_group.rb +22 -44
- data/lib/bundler/resolver.rb +31 -76
- data/lib/bundler/rubygems_ext.rb +12 -1
- data/lib/bundler/shared_helpers.rb +1 -2
- data/lib/bundler/spec_set.rb +1 -1
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +0 -1
- metadata +3 -4
- data/lib/bundler/dep_proxy.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93ffee8ad1f220af763c61669d7c2d3c3418a739e9dbba73ba044a0c98ea3c22
|
4
|
+
data.tar.gz: 5c78c181609081cc9bea18f9adea9afc4700cf4a063fdd671cc612dd1c54bafb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ed7a7e5a517df4814a6be035c193e82d28c349adbd100d5e327fb0093a061175bd089ef5a97c5da502f5040135d7585da30daae59d125cd0cec7f96642eb2a6
|
7
|
+
data.tar.gz: 5a48f92f2c763d8ed20f6a341f946fc6e1ef8c3ce266d47332714459ea09eb78ac349f281fe7b20350c8f43d9c0ec71d32ee11fe288415beb41f18e4570ffa4d
|
data/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-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2022-10-17".freeze
|
8
|
+
@git_commit_sha = "b835c7ea15".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli/init.rb
CHANGED
@@ -32,7 +32,11 @@ module Bundler
|
|
32
32
|
file << spec.to_gemfile
|
33
33
|
end
|
34
34
|
else
|
35
|
-
|
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}"
|
data/lib/bundler/definition.rb
CHANGED
@@ -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 =
|
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 ||=
|
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(
|
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
|
-
|
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!(
|
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 ||=
|
482
|
+
@expanded_dependencies ||= dependencies + metadata_dependencies
|
494
483
|
end
|
495
484
|
|
496
485
|
def filter_specs(specs, deps)
|
497
|
-
SpecSet.new(specs).for(
|
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
|
592
|
-
SharedHelpers.pretty_dependency(dep
|
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?(
|
865
|
+
!@originally_locked_specs.incomplete_ruby_specs?(dependencies)
|
894
866
|
|
895
867
|
remove_platform(Gem::Platform::RUBY)
|
896
868
|
add_current_platform
|
data/lib/bundler/dsl.rb
CHANGED
@@ -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
|
data/lib/bundler/gem_helpers.rb
CHANGED
@@ -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
|
-
|
120
|
-
@gem_name = locked_spec
|
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)
|
data/lib/bundler/index.rb
CHANGED
@@ -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.
|
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
|
data/lib/bundler/injector.rb
CHANGED
@@ -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
|
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 :
|
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,
|
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
|
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
|
-
|
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 @
|
37
|
+
if @platform == Gem::Platform::RUBY
|
34
38
|
"#{@name}-#{@version}"
|
35
39
|
else
|
36
|
-
"#{@name}-#{@version}-#{@
|
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] =
|
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
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
@
|
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
|
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
|
-
|
69
|
+
spec.dependencies.each do |dep|
|
91
70
|
next if dep.type == :development
|
92
|
-
dependencies <<
|
71
|
+
dependencies << Dependency.new(dep.name, dep.requirement)
|
93
72
|
end
|
94
73
|
dependencies
|
95
74
|
end
|
96
75
|
|
97
|
-
def metadata_dependencies(
|
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
|
103
|
-
metadata_dependency("RubyGems", spec.required_rubygems_version
|
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
|
85
|
+
def metadata_dependency(name, requirement)
|
108
86
|
return if requirement.nil? || requirement.none?
|
109
87
|
|
110
|
-
|
88
|
+
Dependency.new("#{name}\0", requirement)
|
111
89
|
end
|
112
90
|
end
|
113
91
|
end
|
data/lib/bundler/resolver.rb
CHANGED
@@ -8,22 +8,6 @@ module Bundler
|
|
8
8
|
|
9
9
|
include GemHelpers
|
10
10
|
|
11
|
-
# Figures out the best possible configuration of gems that satisfies
|
12
|
-
# the list of passed dependencies and any child dependencies without
|
13
|
-
# causing any gem activation errors.
|
14
|
-
#
|
15
|
-
# ==== Parameters
|
16
|
-
# *dependencies<Gem::Dependency>:: The list of dependencies to resolve
|
17
|
-
#
|
18
|
-
# ==== Returns
|
19
|
-
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
20
|
-
# collection of gemspecs is returned. Otherwise, nil is returned.
|
21
|
-
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
22
|
-
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
23
|
-
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
24
|
-
resolver.start(requirements)
|
25
|
-
end
|
26
|
-
|
27
11
|
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
28
12
|
@source_requirements = source_requirements
|
29
13
|
@base = Resolver::Base.new(base, additional_base_requirements)
|
@@ -42,8 +26,7 @@ module Bundler
|
|
42
26
|
remove_from_candidates(spec)
|
43
27
|
end
|
44
28
|
|
45
|
-
|
46
|
-
requirements.each {|dep| @prerelease_specified[dep.name] ||= dep.prerelease? }
|
29
|
+
requirements.each {|dep| prerelease_specified[dep.name] ||= dep.prerelease? }
|
47
30
|
|
48
31
|
verify_gemfile_dependencies_are_found!(requirements)
|
49
32
|
result = @resolver.resolve(requirements).
|
@@ -117,48 +100,35 @@ module Bundler
|
|
117
100
|
specification.dependencies_for_activated_platforms
|
118
101
|
end
|
119
102
|
|
120
|
-
def search_for(
|
121
|
-
|
122
|
-
|
123
|
-
name = dependency.name
|
124
|
-
@search_for[dependency_proxy] ||= begin
|
103
|
+
def search_for(dependency)
|
104
|
+
@search_for[dependency] ||= begin
|
105
|
+
name = dependency.name
|
125
106
|
locked_results = @base[name].select {|spec| requirement_satisfied_by?(dependency, nil, spec) }
|
126
107
|
locked_requirement = base_requirements[name]
|
127
108
|
results = results_for(dependency) + locked_results
|
128
109
|
results = results.select {|spec| requirement_satisfied_by?(locked_requirement, nil, spec) } if locked_requirement
|
110
|
+
dep_platforms = dependency.gem_platforms(@platforms)
|
129
111
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
pre, results = results.partition {|spec| spec.version.prerelease? }
|
134
|
-
results = pre + results
|
135
|
-
end
|
136
|
-
|
137
|
-
if results.any?
|
138
|
-
results = @gem_version_promoter.sort_versions(dependency, results)
|
139
|
-
|
140
|
-
results.group_by(&:version).reduce([]) do |groups, (_, specs)|
|
141
|
-
next groups unless specs.any? {|spec| spec.match_platform(platform) }
|
112
|
+
@gem_version_promoter.sort_versions(dependency, results).group_by(&:version).reduce([]) do |groups, (_, specs)|
|
113
|
+
relevant_platforms = dep_platforms.select {|platform| specs.any? {|spec| spec.match_platform(platform) } }
|
114
|
+
next groups unless relevant_platforms.any?
|
142
115
|
|
143
|
-
|
144
|
-
|
145
|
-
|
116
|
+
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
117
|
+
if ruby_specs.any?
|
118
|
+
spec_group_ruby = SpecGroup.new(ruby_specs, [Gem::Platform::RUBY])
|
119
|
+
spec_group_ruby.force_ruby_platform = dependency.force_ruby_platform
|
120
|
+
groups << spec_group_ruby
|
121
|
+
end
|
146
122
|
|
147
|
-
|
148
|
-
if spec_group_ruby
|
149
|
-
spec_group_ruby.force_ruby_platform = dependency.force_ruby_platform
|
150
|
-
groups << spec_group_ruby
|
151
|
-
end
|
123
|
+
next groups if @resolving_only_for_ruby || dependency.force_ruby_platform
|
152
124
|
|
153
|
-
|
125
|
+
platform_specs = relevant_platforms.flat_map {|platform| select_best_platform_match(specs, platform) }
|
126
|
+
next groups if platform_specs == ruby_specs
|
154
127
|
|
155
|
-
|
156
|
-
|
128
|
+
spec_group = SpecGroup.new(platform_specs, relevant_platforms)
|
129
|
+
groups << spec_group
|
157
130
|
|
158
|
-
|
159
|
-
end
|
160
|
-
else
|
161
|
-
[]
|
131
|
+
groups
|
162
132
|
end
|
163
133
|
end
|
164
134
|
end
|
@@ -189,10 +159,6 @@ module Bundler
|
|
189
159
|
requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
|
190
160
|
end
|
191
161
|
|
192
|
-
def dependencies_equal?(dependencies, other_dependencies)
|
193
|
-
dependencies.map(&:dep) == other_dependencies.map(&:dep)
|
194
|
-
end
|
195
|
-
|
196
162
|
def sort_dependencies(dependencies, activated, conflicts)
|
197
163
|
dependencies.sort_by do |dependency|
|
198
164
|
name = name_for(dependency)
|
@@ -204,23 +170,20 @@ module Bundler
|
|
204
170
|
amount_constrained(dependency),
|
205
171
|
conflicts[name] ? 0 : 1,
|
206
172
|
vertex.payload ? 0 : search_for(dependency).count,
|
207
|
-
self.class.platform_sort_key(dependency.__platform),
|
208
173
|
]
|
209
174
|
end
|
210
175
|
end
|
211
176
|
|
212
|
-
def self.platform_sort_key(platform)
|
213
|
-
# Prefer specific platform to not specific platform
|
214
|
-
return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform
|
215
|
-
["00", *platform.to_a.map {|part| part || "" }]
|
216
|
-
end
|
217
|
-
|
218
177
|
private
|
219
178
|
|
220
179
|
def base_requirements
|
221
180
|
@base.base_requirements
|
222
181
|
end
|
223
182
|
|
183
|
+
def prerelease_specified
|
184
|
+
@gem_version_promoter.prerelease_specified
|
185
|
+
end
|
186
|
+
|
224
187
|
def remove_from_candidates(spec)
|
225
188
|
@base.delete(spec)
|
226
189
|
|
@@ -255,7 +218,7 @@ module Bundler
|
|
255
218
|
all - 1_000_000
|
256
219
|
else
|
257
220
|
search = search_for(dependency)
|
258
|
-
search =
|
221
|
+
search = prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? }
|
259
222
|
search - all
|
260
223
|
end
|
261
224
|
end
|
@@ -265,26 +228,16 @@ module Bundler
|
|
265
228
|
requirements.map! do |requirement|
|
266
229
|
name = requirement.name
|
267
230
|
next requirement if name == "bundler"
|
231
|
+
next if requirement.gem_platforms(@platforms).empty?
|
268
232
|
next requirement unless search_for(requirement).empty?
|
269
233
|
next unless requirement.current_platform?
|
270
234
|
|
271
|
-
|
272
|
-
version = base.first.version
|
273
|
-
message = "You have requested:\n" \
|
274
|
-
" #{name} #{requirement.requirement}\n\n" \
|
275
|
-
"The bundle currently has #{name} locked at #{version}.\n" \
|
276
|
-
"Try running `bundle update #{name}`\n\n" \
|
277
|
-
"If you are updating multiple gems in your Gemfile at once,\n" \
|
278
|
-
"try passing them all to `bundle update`"
|
279
|
-
else
|
280
|
-
message = gem_not_found_message(name, requirement, source_for(name))
|
281
|
-
end
|
282
|
-
raise GemNotFound, message
|
235
|
+
raise GemNotFound, gem_not_found_message(name, requirement, source_for(name))
|
283
236
|
end.compact!
|
284
237
|
end
|
285
238
|
|
286
239
|
def gem_not_found_message(name, requirement, source, extra_message = "")
|
287
|
-
specs = source.specs.search(name)
|
240
|
+
specs = source.specs.search(name).sort_by {|s| [s.version, s.platform.to_s] }
|
288
241
|
matching_part = name
|
289
242
|
requirement_label = SharedHelpers.pretty_dependency(requirement)
|
290
243
|
cache_message = begin
|
@@ -297,7 +250,9 @@ module Bundler
|
|
297
250
|
if specs_matching_requirement.any?
|
298
251
|
specs = specs_matching_requirement
|
299
252
|
matching_part = requirement_label
|
300
|
-
|
253
|
+
platforms = requirement.gem_platforms(@platforms)
|
254
|
+
platform_label = platforms.size == 1 ? "platform '#{platforms.first}" : "platforms '#{platforms.join("', '")}"
|
255
|
+
requirement_label = "#{requirement_label}' with #{platform_label}"
|
301
256
|
end
|
302
257
|
|
303
258
|
message = String.new("Could not find gem '#{requirement_label}'#{extra_message} in #{source}#{cache_message}.\n")
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -261,10 +261,21 @@ module Gem
|
|
261
261
|
# version
|
262
262
|
(
|
263
263
|
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
264
|
-
(@os == "linux" && (other.
|
264
|
+
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
|
265
265
|
@version == other.version
|
266
266
|
)
|
267
267
|
end
|
268
|
+
|
269
|
+
# This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`.
|
270
|
+
# Once only 3.3.23 is supported, we can use the method in RubyGems.
|
271
|
+
def normalized_linux_version_ext
|
272
|
+
return nil unless @version
|
273
|
+
|
274
|
+
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
|
275
|
+
return nil if without_gnu_nor_abi_modifiers.empty?
|
276
|
+
|
277
|
+
without_gnu_nor_abi_modifiers
|
278
|
+
end
|
268
279
|
end
|
269
280
|
end
|
270
281
|
|
@@ -163,7 +163,7 @@ module Bundler
|
|
163
163
|
"\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
|
164
164
|
end
|
165
165
|
|
166
|
-
def pretty_dependency(dep
|
166
|
+
def pretty_dependency(dep)
|
167
167
|
msg = String.new(dep.name)
|
168
168
|
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
|
169
169
|
|
@@ -172,7 +172,6 @@ module Bundler
|
|
172
172
|
msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
|
173
173
|
end
|
174
174
|
|
175
|
-
msg << " from the `#{dep.source}` source" if print_source && dep.source
|
176
175
|
msg
|
177
176
|
end
|
178
177
|
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
default:
|
2
|
+
image: ruby:<%= RUBY_VERSION %>
|
2
3
|
|
3
|
-
before_script:
|
4
|
-
|
5
|
-
|
4
|
+
before_script:
|
5
|
+
- gem install bundler -v <%= Bundler::VERSION %>
|
6
|
+
- bundle install
|
6
7
|
|
7
8
|
example_job:
|
8
9
|
script:
|
data/lib/bundler/version.rb
CHANGED
data/lib/bundler.rb
CHANGED
@@ -41,7 +41,6 @@ module Bundler
|
|
41
41
|
|
42
42
|
autoload :Definition, File.expand_path("bundler/definition", __dir__)
|
43
43
|
autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
|
44
|
-
autoload :DepProxy, File.expand_path("bundler/dep_proxy", __dir__)
|
45
44
|
autoload :Deprecate, File.expand_path("bundler/deprecate", __dir__)
|
46
45
|
autoload :Digest, File.expand_path("bundler/digest", __dir__)
|
47
46
|
autoload :Dsl, File.expand_path("bundler/dsl", __dir__)
|
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.
|
4
|
+
version: 2.3.24
|
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-
|
25
|
+
date: 2022-10-17 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
|
@@ -80,7 +80,6 @@ files:
|
|
80
80
|
- lib/bundler/constants.rb
|
81
81
|
- lib/bundler/current_ruby.rb
|
82
82
|
- lib/bundler/definition.rb
|
83
|
-
- lib/bundler/dep_proxy.rb
|
84
83
|
- lib/bundler/dependency.rb
|
85
84
|
- lib/bundler/deployment.rb
|
86
85
|
- lib/bundler/deprecate.rb
|
@@ -380,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
380
379
|
- !ruby/object:Gem::Version
|
381
380
|
version: 2.5.2
|
382
381
|
requirements: []
|
383
|
-
rubygems_version: 3.
|
382
|
+
rubygems_version: 3.3.24
|
384
383
|
signing_key:
|
385
384
|
specification_version: 4
|
386
385
|
summary: The best way to manage your application's dependencies
|
data/lib/bundler/dep_proxy.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bundler
|
4
|
-
class DepProxy
|
5
|
-
attr_reader :__platform, :dep
|
6
|
-
|
7
|
-
@proxies = {}
|
8
|
-
|
9
|
-
def self.get_proxy(dep, platform)
|
10
|
-
@proxies[[dep, platform]] ||= new(dep, platform).freeze
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(dep, platform)
|
14
|
-
@dep = dep
|
15
|
-
@__platform = platform
|
16
|
-
end
|
17
|
-
|
18
|
-
private_class_method :new
|
19
|
-
|
20
|
-
alias_method :eql?, :==
|
21
|
-
|
22
|
-
def type
|
23
|
-
@dep.type
|
24
|
-
end
|
25
|
-
|
26
|
-
def name
|
27
|
-
@dep.name
|
28
|
-
end
|
29
|
-
|
30
|
-
def requirement
|
31
|
-
@dep.requirement
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_s
|
35
|
-
s = name.dup
|
36
|
-
s << " (#{requirement})" unless requirement == Gem::Requirement.default
|
37
|
-
s << " #{__platform}" unless __platform == Gem::Platform::RUBY
|
38
|
-
s
|
39
|
-
end
|
40
|
-
|
41
|
-
def dup
|
42
|
-
raise NoMethodError.new("DepProxy cannot be duplicated")
|
43
|
-
end
|
44
|
-
|
45
|
-
def clone
|
46
|
-
raise NoMethodError.new("DepProxy cannot be cloned")
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def method_missing(*args, &blk)
|
52
|
-
@dep.send(*args, &blk)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|