bundler 2.6.5 → 2.7.1
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 +1172 -1024
- data/README.md +7 -7
- data/bundler.gemspec +2 -2
- data/lib/bundler/build_metadata.rb +10 -11
- data/lib/bundler/checksum.rb +22 -12
- data/lib/bundler/cli/common.rb +1 -1
- data/lib/bundler/cli/config.rb +2 -2
- data/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/lib/bundler/cli/doctor.rb +27 -155
- data/lib/bundler/cli/gem.rb +62 -30
- data/lib/bundler/cli/inject.rb +2 -2
- data/lib/bundler/cli/install.rb +5 -5
- data/lib/bundler/cli/issue.rb +2 -2
- data/lib/bundler/cli/lock.rb +2 -1
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/update.rb +3 -3
- data/lib/bundler/cli.rb +26 -49
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/parser.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +2 -1
- data/lib/bundler/compact_index_client.rb +1 -5
- data/lib/bundler/current_ruby.rb +27 -3
- data/lib/bundler/definition.rb +184 -151
- data/lib/bundler/dependency.rb +1 -1
- data/lib/bundler/dsl.rb +35 -26
- data/lib/bundler/errors.rb +18 -0
- data/lib/bundler/feature_flag.rb +15 -12
- data/lib/bundler/fetcher/dependency.rb +2 -1
- data/lib/bundler/fetcher/downloader.rb +33 -7
- data/lib/bundler/fetcher.rb +49 -19
- data/lib/bundler/friendly_errors.rb +3 -2
- data/lib/bundler/index.rb +7 -2
- data/lib/bundler/injector.rb +9 -9
- data/lib/bundler/installer.rb +6 -5
- data/lib/bundler/lazy_specification.rb +38 -19
- data/lib/bundler/lockfile_parser.rb +29 -10
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +175 -129
- data/lib/bundler/man/bundle-config.1.ronn +93 -88
- data/lib/bundler/man/bundle-console.1 +1 -1
- data/lib/bundler/man/bundle-doctor.1 +43 -4
- data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
- data/lib/bundler/man/bundle-env.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +3 -3
- data/lib/bundler/man/bundle-exec.1.ronn +2 -2
- data/lib/bundler/man/bundle-fund.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +67 -44
- data/lib/bundler/man/bundle-gem.1.ronn +8 -4
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +2 -2
- data/lib/bundler/man/bundle-inject.1.ronn +1 -1
- data/lib/bundler/man/bundle-install.1 +4 -4
- data/lib/bundler/man/bundle-install.1.ronn +3 -4
- data/lib/bundler/man/bundle-issue.1 +1 -1
- data/lib/bundler/man/bundle-licenses.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-plugin.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +4 -4
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/match_platform.rb +31 -12
- data/lib/bundler/materialization.rb +2 -2
- data/lib/bundler/plugin/api/source.rb +1 -1
- data/lib/bundler/plugin/index.rb +1 -1
- data/lib/bundler/plugin/installer/path.rb +8 -0
- data/lib/bundler/plugin.rb +1 -1
- data/lib/bundler/resolver/candidate.rb +12 -9
- data/lib/bundler/resolver/package.rb +1 -1
- data/lib/bundler/resolver/strategy.rb +40 -0
- data/lib/bundler/resolver.rb +18 -27
- data/lib/bundler/rubygems_ext.rb +131 -120
- data/lib/bundler/rubygems_integration.rb +11 -6
- data/lib/bundler/runtime.rb +9 -6
- data/lib/bundler/self_manager.rb +32 -42
- data/lib/bundler/settings/validator.rb +0 -23
- data/lib/bundler/settings.rb +4 -6
- data/lib/bundler/shared_helpers.rb +10 -4
- data/lib/bundler/source/gemspec.rb +1 -4
- data/lib/bundler/source/git/git_proxy.rb +17 -6
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/path.rb +9 -2
- data/lib/bundler/source/rubygems/remote.rb +11 -3
- data/lib/bundler/source_list.rb +30 -16
- data/lib/bundler/source_map.rb +1 -1
- data/lib/bundler/spec_set.rb +55 -16
- data/lib/bundler/templates/Executable +0 -11
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
- data/lib/bundler/ui/shell.rb +2 -2
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
- data/lib/bundler/vendor/uri/lib/uri/common.rb +7 -3
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +12 -11
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +6 -6
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/version.rb +10 -2
- data/lib/bundler/worker.rb +1 -1
- data/lib/bundler.rb +14 -12
- metadata +9 -16
- data/lib/bundler/compact_index_client/gem_parser.rb +0 -32
- data/lib/bundler/gem_helpers.rb +0 -144
- data/lib/bundler/templates/Executable.bundler +0 -109
- data/lib/bundler/vendor/connection_pool/.document +0 -1
- data/lib/bundler/vendor/fileutils/.document +0 -1
- data/lib/bundler/vendor/net-http-persistent/.document +0 -1
- data/lib/bundler/vendor/pub_grub/.document +0 -1
- data/lib/bundler/vendor/securerandom/.document +0 -1
- data/lib/bundler/vendor/thor/.document +0 -1
- data/lib/bundler/vendor/tsort/.document +0 -1
- data/lib/bundler/vendor/uri/.document +0 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative '../../../../../vendored_net_http'
|
2
2
|
require_relative '../../../../../vendored_uri'
|
3
|
-
require 'cgi'
|
3
|
+
require 'cgi/escape'
|
4
|
+
require 'cgi/util' unless defined?(CGI::EscapeExt)
|
4
5
|
require_relative '../../../../connection_pool/lib/connection_pool'
|
5
6
|
|
6
7
|
autoload :OpenSSL, 'openssl'
|
@@ -42,9 +43,8 @@ autoload :OpenSSL, 'openssl'
|
|
42
43
|
# # perform the POST, the Gem::URI is always required
|
43
44
|
# response http.request post_uri, post
|
44
45
|
#
|
45
|
-
# Note that for GET, HEAD and other requests that do not have a body
|
46
|
-
#
|
47
|
-
# params which are sent in the body for other requests.
|
46
|
+
# ⚠ Note that for GET, HEAD and other requests that do not have a body,
|
47
|
+
# it uses Gem::URI#request_uri as default to send query params
|
48
48
|
#
|
49
49
|
# == TLS/SSL
|
50
50
|
#
|
@@ -60,6 +60,7 @@ autoload :OpenSSL, 'openssl'
|
|
60
60
|
# #ca_path :: Directory with certificate-authorities
|
61
61
|
# #cert_store :: An SSL certificate store
|
62
62
|
# #ciphers :: List of SSl ciphers allowed
|
63
|
+
# #extra_chain_cert :: Extra certificates to be added to the certificate chain
|
63
64
|
# #private_key :: The client's SSL private key
|
64
65
|
# #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
|
65
66
|
# connection
|
@@ -176,7 +177,7 @@ class Gem::Net::HTTP::Persistent
|
|
176
177
|
##
|
177
178
|
# The version of Gem::Net::HTTP::Persistent you are using
|
178
179
|
|
179
|
-
VERSION = '4.0.
|
180
|
+
VERSION = '4.0.6'
|
180
181
|
|
181
182
|
##
|
182
183
|
# Error class for errors raised by Gem::Net::HTTP::Persistent. Various
|
@@ -267,6 +268,11 @@ class Gem::Net::HTTP::Persistent
|
|
267
268
|
|
268
269
|
attr_reader :ciphers
|
269
270
|
|
271
|
+
##
|
272
|
+
# Extra certificates to be added to the certificate chain
|
273
|
+
|
274
|
+
attr_reader :extra_chain_cert
|
275
|
+
|
270
276
|
##
|
271
277
|
# Sends debug_output to this IO via Gem::Net::HTTP#set_debug_output.
|
272
278
|
#
|
@@ -587,6 +593,21 @@ class Gem::Net::HTTP::Persistent
|
|
587
593
|
reconnect_ssl
|
588
594
|
end
|
589
595
|
|
596
|
+
if Gem::Net::HTTP.method_defined?(:extra_chain_cert=)
|
597
|
+
##
|
598
|
+
# Extra certificates to be added to the certificate chain.
|
599
|
+
# It is only supported starting from Gem::Net::HTTP version 0.1.1
|
600
|
+
def extra_chain_cert= extra_chain_cert
|
601
|
+
@extra_chain_cert = extra_chain_cert
|
602
|
+
|
603
|
+
reconnect_ssl
|
604
|
+
end
|
605
|
+
else
|
606
|
+
def extra_chain_cert= _extra_chain_cert
|
607
|
+
raise "extra_chain_cert= is not supported by this version of Gem::Net::HTTP"
|
608
|
+
end
|
609
|
+
end
|
610
|
+
|
590
611
|
##
|
591
612
|
# Creates a new connection for +uri+
|
592
613
|
|
@@ -605,47 +626,49 @@ class Gem::Net::HTTP::Persistent
|
|
605
626
|
|
606
627
|
connection = @pool.checkout net_http_args
|
607
628
|
|
608
|
-
|
629
|
+
begin
|
630
|
+
http = connection.http
|
609
631
|
|
610
|
-
|
611
|
-
|
632
|
+
connection.ressl @ssl_generation if
|
633
|
+
connection.ssl_generation != @ssl_generation
|
612
634
|
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
635
|
+
if not http.started? then
|
636
|
+
ssl http if use_ssl
|
637
|
+
start http
|
638
|
+
elsif expired? connection then
|
639
|
+
reset connection
|
640
|
+
end
|
619
641
|
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
642
|
+
http.keep_alive_timeout = @idle_timeout if @idle_timeout
|
643
|
+
http.max_retries = @max_retries if http.respond_to?(:max_retries=)
|
644
|
+
http.read_timeout = @read_timeout if @read_timeout
|
645
|
+
http.write_timeout = @write_timeout if
|
646
|
+
@write_timeout && http.respond_to?(:write_timeout=)
|
647
|
+
|
648
|
+
return yield connection
|
649
|
+
rescue Errno::ECONNREFUSED
|
650
|
+
if http.proxy?
|
651
|
+
address = http.proxy_address
|
652
|
+
port = http.proxy_port
|
653
|
+
else
|
654
|
+
address = http.address
|
655
|
+
port = http.port
|
656
|
+
end
|
625
657
|
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
658
|
+
raise Error, "connection refused: #{address}:#{port}"
|
659
|
+
rescue Errno::EHOSTDOWN
|
660
|
+
if http.proxy?
|
661
|
+
address = http.proxy_address
|
662
|
+
port = http.proxy_port
|
663
|
+
else
|
664
|
+
address = http.address
|
665
|
+
port = http.port
|
666
|
+
end
|
635
667
|
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
address = http.proxy_address
|
640
|
-
port = http.proxy_port
|
641
|
-
else
|
642
|
-
address = http.address
|
643
|
-
port = http.port
|
668
|
+
raise Error, "host down: #{address}:#{port}"
|
669
|
+
ensure
|
670
|
+
@pool.checkin net_http_args
|
644
671
|
end
|
645
|
-
|
646
|
-
raise Error, "host down: #{address}:#{port}"
|
647
|
-
ensure
|
648
|
-
@pool.checkin net_http_args
|
649
672
|
end
|
650
673
|
|
651
674
|
##
|
@@ -782,7 +805,7 @@ class Gem::Net::HTTP::Persistent
|
|
782
805
|
@proxy_connection_id = [nil, *@proxy_args].join ':'
|
783
806
|
|
784
807
|
if @proxy_uri.query then
|
785
|
-
@no_proxy =
|
808
|
+
@no_proxy = Gem::URI.decode_www_form(@proxy_uri.query).filter_map { |k, v| v if k == 'no_proxy' }.join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? }
|
786
809
|
end
|
787
810
|
end
|
788
811
|
|
@@ -953,7 +976,8 @@ class Gem::Net::HTTP::Persistent
|
|
953
976
|
end
|
954
977
|
|
955
978
|
##
|
956
|
-
# Shuts down all connections
|
979
|
+
# Shuts down all connections. Attempting to checkout a connection after
|
980
|
+
# shutdown will raise an error.
|
957
981
|
#
|
958
982
|
# *NOTE*: Calling shutdown for can be dangerous!
|
959
983
|
#
|
@@ -964,6 +988,17 @@ class Gem::Net::HTTP::Persistent
|
|
964
988
|
@pool.shutdown { |http| http.finish }
|
965
989
|
end
|
966
990
|
|
991
|
+
##
|
992
|
+
# Discard all existing connections. Subsequent checkouts will create
|
993
|
+
# new connections as needed.
|
994
|
+
#
|
995
|
+
# If any thread is still using a connection it may cause an error! Call
|
996
|
+
# #reload when you are completely done making requests!
|
997
|
+
|
998
|
+
def reload
|
999
|
+
@pool.reload { |http| http.finish }
|
1000
|
+
end
|
1001
|
+
|
967
1002
|
##
|
968
1003
|
# Enables SSL on +connection+
|
969
1004
|
|
@@ -1021,6 +1056,10 @@ application:
|
|
1021
1056
|
connection.key = @private_key
|
1022
1057
|
end
|
1023
1058
|
|
1059
|
+
if defined?(@extra_chain_cert) and @extra_chain_cert
|
1060
|
+
connection.extra_chain_cert = @extra_chain_cert
|
1061
|
+
end
|
1062
|
+
|
1024
1063
|
connection.cert_store = if @cert_store then
|
1025
1064
|
@cert_store
|
1026
1065
|
else
|
@@ -79,29 +79,17 @@ module Bundler::PubGrub
|
|
79
79
|
dependencies_for(@root_package, @root_version)
|
80
80
|
end
|
81
81
|
|
82
|
-
# Override me (maybe)
|
83
|
-
#
|
84
|
-
# If not overridden, the order returned by all_versions_for will be used
|
85
|
-
#
|
86
|
-
# Returns: Array of versions in preferred order
|
87
|
-
def sort_versions_by_preferred(package, sorted_versions)
|
88
|
-
indexes = @version_indexes[package]
|
89
|
-
sorted_versions.sort_by { |version| indexes[version] }
|
90
|
-
end
|
91
|
-
|
92
82
|
def initialize
|
93
83
|
@root_package = Package.root
|
94
84
|
@root_version = Package.root_version
|
95
85
|
|
96
|
-
@
|
86
|
+
@sorted_versions = Hash.new do |h,k|
|
97
87
|
if k == @root_package
|
98
88
|
h[k] = [@root_version]
|
99
89
|
else
|
100
|
-
h[k] = all_versions_for(k)
|
90
|
+
h[k] = all_versions_for(k).sort
|
101
91
|
end
|
102
92
|
end
|
103
|
-
@sorted_versions = Hash.new { |h,k| h[k] = @cached_versions[k].sort }
|
104
|
-
@version_indexes = Hash.new { |h,k| h[k] = @cached_versions[k].each.with_index.to_h }
|
105
93
|
|
106
94
|
@cached_dependencies = Hash.new do |packages, package|
|
107
95
|
if package == @root_package
|
@@ -117,15 +105,7 @@ module Bundler::PubGrub
|
|
117
105
|
end
|
118
106
|
|
119
107
|
def versions_for(package, range=VersionRange.any)
|
120
|
-
|
121
|
-
|
122
|
-
# Conditional avoids (among other things) calling
|
123
|
-
# sort_versions_by_preferred with the root package
|
124
|
-
if versions.size > 1
|
125
|
-
sort_versions_by_preferred(package, versions)
|
126
|
-
else
|
127
|
-
versions
|
128
|
-
end
|
108
|
+
range.select_versions(@sorted_versions[package])
|
129
109
|
end
|
130
110
|
|
131
111
|
def no_versions_incompatibility_for(_package, unsatisfied_term)
|
@@ -164,7 +144,7 @@ module Bundler::PubGrub
|
|
164
144
|
sorted_versions[high]
|
165
145
|
end
|
166
146
|
|
167
|
-
range = VersionRange.new(min: low, max: high, include_min:
|
147
|
+
range = VersionRange.new(min: low, max: high, include_min: !low.nil?)
|
168
148
|
|
169
149
|
self_constraint = VersionConstraint.new(package, range: range)
|
170
150
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Bundler::PubGrub
|
2
|
+
class Strategy
|
3
|
+
def initialize(source)
|
4
|
+
@source = source
|
5
|
+
|
6
|
+
@root_package = Package.root
|
7
|
+
@root_version = Package.root_version
|
8
|
+
|
9
|
+
@version_indexes = Hash.new do |h,k|
|
10
|
+
if k == @root_package
|
11
|
+
h[k] = { @root_version => 0 }
|
12
|
+
else
|
13
|
+
h[k] = @source.all_versions_for(k).each.with_index.to_h
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def next_package_and_version(unsatisfied)
|
19
|
+
package, range = next_term_to_try_from(unsatisfied)
|
20
|
+
|
21
|
+
[package, most_preferred_version_of(package, range)]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def most_preferred_version_of(package, range)
|
27
|
+
versions = @source.versions_for(package, range)
|
28
|
+
|
29
|
+
indexes = @version_indexes[package]
|
30
|
+
versions.min_by { |version| indexes[version] }
|
31
|
+
end
|
32
|
+
|
33
|
+
def next_term_to_try_from(unsatisfied)
|
34
|
+
unsatisfied.min_by do |package, range|
|
35
|
+
matching_versions = @source.versions_for(package, range)
|
36
|
+
higher_versions = @source.versions_for(package, range.upper_invert)
|
37
|
+
|
38
|
+
[matching_versions.count <= 1 ? 0 : 1, higher_versions.count]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -76,6 +76,9 @@ module Bundler::PubGrub
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def initialize(min: nil, max: nil, include_min: false, include_max: false, name: nil)
|
79
|
+
raise ArgumentError, "Ranges without a lower bound cannot have include_min == true" if !min && include_min == true
|
80
|
+
raise ArgumentError, "Ranges without an upper bound cannot have include_max == true" if !max && include_max == true
|
81
|
+
|
79
82
|
@min = min
|
80
83
|
@max = max
|
81
84
|
@include_min = include_min
|
@@ -311,10 +314,19 @@ module Bundler::PubGrub
|
|
311
314
|
|
312
315
|
def contiguous_to?(other)
|
313
316
|
return false if other.empty?
|
317
|
+
return true if any?
|
318
|
+
|
319
|
+
intersects?(other) || contiguous_below?(other) || contiguous_above?(other)
|
320
|
+
end
|
321
|
+
|
322
|
+
def contiguous_below?(other)
|
323
|
+
return false if !max || !other.min
|
324
|
+
|
325
|
+
max == other.min && (include_max || other.include_min)
|
326
|
+
end
|
314
327
|
|
315
|
-
|
316
|
-
|
317
|
-
(max == other.min && (include_max || other.include_min))
|
328
|
+
def contiguous_above?(other)
|
329
|
+
other.contiguous_below?(self)
|
318
330
|
end
|
319
331
|
|
320
332
|
def allows_all?(other)
|
@@ -375,15 +387,15 @@ module Bundler::PubGrub
|
|
375
387
|
def invert
|
376
388
|
return self.class.empty if any?
|
377
389
|
|
378
|
-
low = VersionRange.new(max: min, include_max: !include_min)
|
379
|
-
high = VersionRange.new(min: max, include_min: !include_max)
|
390
|
+
low = -> { VersionRange.new(max: min, include_max: !include_min) }
|
391
|
+
high = -> { VersionRange.new(min: max, include_min: !include_max) }
|
380
392
|
|
381
393
|
if !min
|
382
|
-
high
|
394
|
+
high.call
|
383
395
|
elsif !max
|
384
|
-
low
|
396
|
+
low.call
|
385
397
|
else
|
386
|
-
low.union(high)
|
398
|
+
low.call.union(high.call)
|
387
399
|
end
|
388
400
|
end
|
389
401
|
|
@@ -2,17 +2,20 @@ require_relative 'partial_solution'
|
|
2
2
|
require_relative 'term'
|
3
3
|
require_relative 'incompatibility'
|
4
4
|
require_relative 'solve_failure'
|
5
|
+
require_relative 'strategy'
|
5
6
|
|
6
7
|
module Bundler::PubGrub
|
7
8
|
class VersionSolver
|
8
9
|
attr_reader :logger
|
9
10
|
attr_reader :source
|
10
11
|
attr_reader :solution
|
12
|
+
attr_reader :strategy
|
11
13
|
|
12
|
-
def initialize(source:, root: Package.root, logger: Bundler::PubGrub.logger)
|
14
|
+
def initialize(source:, root: Package.root, strategy: Strategy.new(source), logger: Bundler::PubGrub.logger)
|
13
15
|
@logger = logger
|
14
16
|
|
15
17
|
@source = source
|
18
|
+
@strategy = strategy
|
16
19
|
|
17
20
|
# { package => [incompatibility, ...]}
|
18
21
|
@incompatibilities = Hash.new do |h, k|
|
@@ -36,26 +39,25 @@ module Bundler::PubGrub
|
|
36
39
|
|
37
40
|
# Returns true if there is more work to be done, false otherwise
|
38
41
|
def work
|
39
|
-
|
40
|
-
|
41
|
-
next_package = choose_package_version
|
42
|
-
propagate(next_package)
|
43
|
-
|
44
|
-
if solved?
|
42
|
+
unsatisfied_terms = solution.unsatisfied
|
43
|
+
if unsatisfied_terms.empty?
|
45
44
|
logger.info { "Solution found after #{solution.attempted_solutions} attempts:" }
|
46
45
|
solution.decisions.each do |package, version|
|
47
46
|
next if Package.root?(package)
|
48
47
|
logger.info { "* #{package} #{version}" }
|
49
48
|
end
|
50
49
|
|
51
|
-
false
|
52
|
-
else
|
53
|
-
true
|
50
|
+
return false
|
54
51
|
end
|
52
|
+
|
53
|
+
next_package = choose_package_version_from(unsatisfied_terms)
|
54
|
+
propagate(next_package)
|
55
|
+
|
56
|
+
true
|
55
57
|
end
|
56
58
|
|
57
59
|
def solve
|
58
|
-
work
|
60
|
+
while work; end
|
59
61
|
|
60
62
|
solution.decisions
|
61
63
|
end
|
@@ -105,29 +107,15 @@ module Bundler::PubGrub
|
|
105
107
|
unsatisfied.package
|
106
108
|
end
|
107
109
|
|
108
|
-
def
|
109
|
-
|
110
|
-
package = term.package
|
111
|
-
range = term.constraint.range
|
112
|
-
matching_versions = source.versions_for(package, range)
|
113
|
-
higher_versions = source.versions_for(package, range.upper_invert)
|
110
|
+
def choose_package_version_from(unsatisfied_terms)
|
111
|
+
remaining = unsatisfied_terms.map { |t| [t.package, t.constraint.range] }.to_h
|
114
112
|
|
115
|
-
|
116
|
-
end.package
|
117
|
-
end
|
118
|
-
|
119
|
-
def choose_package_version
|
120
|
-
if solution.unsatisfied.empty?
|
121
|
-
logger.info "No packages unsatisfied. Solving complete!"
|
122
|
-
return nil
|
123
|
-
end
|
113
|
+
package, version = strategy.next_package_and_version(remaining)
|
124
114
|
|
125
|
-
package = next_package_to_try
|
126
|
-
unsatisfied_term = solution.unsatisfied.find { |t| t.package == package }
|
127
|
-
version = source.versions_for(package, unsatisfied_term.constraint.range).first
|
128
115
|
logger.debug { "attempting #{package} #{version}" }
|
129
116
|
|
130
117
|
if version.nil?
|
118
|
+
unsatisfied_term = unsatisfied_terms.find { |t| t.package == package }
|
131
119
|
add_incompatibility source.no_versions_incompatibility_for(package, unsatisfied_term)
|
132
120
|
return package
|
133
121
|
end
|
@@ -13,15 +13,19 @@ require_relative "rfc2396_parser"
|
|
13
13
|
require_relative "rfc3986_parser"
|
14
14
|
|
15
15
|
module Bundler::URI
|
16
|
+
# The default parser instance for RFC 2396.
|
16
17
|
RFC2396_PARSER = RFC2396_Parser.new
|
17
18
|
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
|
18
19
|
|
20
|
+
# The default parser instance for RFC 3986.
|
19
21
|
RFC3986_PARSER = RFC3986_Parser.new
|
20
22
|
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
|
21
23
|
|
24
|
+
# The default parser instance.
|
22
25
|
DEFAULT_PARSER = RFC3986_PARSER
|
23
26
|
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
|
24
27
|
|
28
|
+
# Set the default parser instance.
|
25
29
|
def self.parser=(parser = RFC3986_PARSER)
|
26
30
|
remove_const(:Parser) if defined?(::Bundler::URI::Parser)
|
27
31
|
const_set("Parser", parser.class)
|
@@ -40,7 +44,7 @@ module Bundler::URI
|
|
40
44
|
end
|
41
45
|
self.parser = RFC3986_PARSER
|
42
46
|
|
43
|
-
def self.const_missing(const)
|
47
|
+
def self.const_missing(const) # :nodoc:
|
44
48
|
if const == :REGEXP
|
45
49
|
warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
|
46
50
|
Bundler::URI::RFC2396_REGEXP
|
@@ -87,7 +91,7 @@ module Bundler::URI
|
|
87
91
|
module_function :make_components_hash
|
88
92
|
end
|
89
93
|
|
90
|
-
module Schemes
|
94
|
+
module Schemes # :nodoc:
|
91
95
|
end
|
92
96
|
private_constant :Schemes
|
93
97
|
|
@@ -305,7 +309,7 @@ module Bundler::URI
|
|
305
309
|
256.times do |i|
|
306
310
|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
|
307
311
|
end
|
308
|
-
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
|
312
|
+
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
|
309
313
|
TBLENCWWWCOMP_[' '] = '+'
|
310
314
|
TBLENCWWWCOMP_.freeze
|
311
315
|
TBLDECWWWCOMP_ = {} # :nodoc:
|
@@ -737,12 +737,12 @@ module Bundler::URI
|
|
737
737
|
end
|
738
738
|
private :check_registry
|
739
739
|
|
740
|
-
def set_registry(v)
|
740
|
+
def set_registry(v) # :nodoc:
|
741
741
|
raise InvalidURIError, "cannot set registry"
|
742
742
|
end
|
743
743
|
protected :set_registry
|
744
744
|
|
745
|
-
def registry=(v)
|
745
|
+
def registry=(v) # :nodoc:
|
746
746
|
raise InvalidURIError, "cannot set registry"
|
747
747
|
end
|
748
748
|
|
@@ -1133,17 +1133,16 @@ module Bundler::URI
|
|
1133
1133
|
base.fragment=(nil)
|
1134
1134
|
|
1135
1135
|
# RFC2396, Section 5.2, 4)
|
1136
|
-
if
|
1137
|
-
base.
|
1138
|
-
|
1139
|
-
|
1140
|
-
base.set_path(rel.path)
|
1136
|
+
if authority
|
1137
|
+
base.set_userinfo(rel.userinfo)
|
1138
|
+
base.set_host(rel.host)
|
1139
|
+
base.set_port(rel.port || base.default_port)
|
1140
|
+
base.set_path(rel.path)
|
1141
|
+
elsif base.path && rel.path
|
1142
|
+
base.set_path(merge_path(base.path, rel.path))
|
1141
1143
|
end
|
1142
1144
|
|
1143
1145
|
# RFC2396, Section 5.2, 7)
|
1144
|
-
base.set_userinfo(rel.userinfo) if rel.userinfo
|
1145
|
-
base.set_host(rel.host) if rel.host
|
1146
|
-
base.set_port(rel.port) if rel.port
|
1147
1146
|
base.query = rel.query if rel.query
|
1148
1147
|
base.fragment=(rel.fragment) if rel.fragment
|
1149
1148
|
|
@@ -1392,10 +1391,12 @@ module Bundler::URI
|
|
1392
1391
|
end
|
1393
1392
|
end
|
1394
1393
|
|
1394
|
+
# Returns the hash value.
|
1395
1395
|
def hash
|
1396
1396
|
self.component_ary.hash
|
1397
1397
|
end
|
1398
1398
|
|
1399
|
+
# Compares with _oth_ for Hash.
|
1399
1400
|
def eql?(oth)
|
1400
1401
|
self.class == oth.class &&
|
1401
1402
|
parser == oth.parser &&
|
@@ -1438,7 +1439,7 @@ module Bundler::URI
|
|
1438
1439
|
end
|
1439
1440
|
end
|
1440
1441
|
|
1441
|
-
def inspect
|
1442
|
+
def inspect # :nodoc:
|
1442
1443
|
"#<#{self.class} #{self}>"
|
1443
1444
|
end
|
1444
1445
|
|
@@ -321,14 +321,14 @@ module Bundler::URI
|
|
321
321
|
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
|
322
322
|
end
|
323
323
|
|
324
|
-
|
325
|
-
if
|
326
|
-
def inspect
|
327
|
-
|
324
|
+
TO_S = Kernel.instance_method(:to_s) # :nodoc:
|
325
|
+
if TO_S.respond_to?(:bind_call)
|
326
|
+
def inspect # :nodoc:
|
327
|
+
TO_S.bind_call(self)
|
328
328
|
end
|
329
329
|
else
|
330
|
-
def inspect
|
331
|
-
|
330
|
+
def inspect # :nodoc:
|
331
|
+
TO_S.bind(self).call
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
data/lib/bundler/version.rb
CHANGED
@@ -1,13 +1,21 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
module Bundler
|
4
|
-
VERSION = "2.
|
4
|
+
VERSION = "2.7.1".freeze
|
5
5
|
|
6
6
|
def self.bundler_major_version
|
7
|
-
@bundler_major_version ||=
|
7
|
+
@bundler_major_version ||= gem_version.segments.first
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.gem_version
|
11
11
|
@gem_version ||= Gem::Version.create(VERSION)
|
12
12
|
end
|
13
|
+
|
14
|
+
def self.verbose_version
|
15
|
+
@verbose_version ||= "#{VERSION}#{simulated_version ? " (simulating Bundler #{simulated_version})" : ""}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.simulated_version
|
19
|
+
@simulated_version ||= Bundler.settings[:simulate_version]
|
20
|
+
end
|
13
21
|
end
|
data/lib/bundler/worker.rb
CHANGED
@@ -88,7 +88,7 @@ module Bundler
|
|
88
88
|
|
89
89
|
@threads = Array.new(@size) do |i|
|
90
90
|
Thread.start { process_queue(i) }.tap do |thread|
|
91
|
-
thread.name = "#{name} Worker ##{i}"
|
91
|
+
thread.name = "#{name} Worker ##{i}"
|
92
92
|
end
|
93
93
|
rescue ThreadError => e
|
94
94
|
creation_errors << e
|