rubygems-update 3.2.0.rc.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +54 -51
- data/Manifest.txt +32 -29
- data/Rakefile +3 -1
- data/bundler/CHANGELOG.md +35 -1
- data/bundler/UPGRADING.md +1 -1
- data/bundler/lib/bundler.rb +4 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +5 -2
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/exec.rb +3 -3
- data/bundler/lib/bundler/cli/outdated.rb +2 -4
- data/bundler/lib/bundler/compact_index_client/updater.rb +5 -5
- data/bundler/lib/bundler/definition.rb +4 -9
- data/bundler/lib/bundler/env.rb +1 -1
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/fetcher/index.rb +2 -3
- data/bundler/lib/bundler/friendly_errors.rb +15 -0
- data/bundler/lib/bundler/index.rb +5 -1
- data/bundler/lib/bundler/injector.rb +9 -2
- data/bundler/lib/bundler/installer.rb +7 -5
- data/bundler/lib/bundler/lazy_specification.rb +5 -7
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/{man → lib/bundler/man}/bundle-add.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-cache.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-check.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-clean.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-config.1.ronn +1 -9
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-exec.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-gem.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-init.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-inject.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-install.1.ronn +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-list.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-lock.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-open.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-platform.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-remove.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-show.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-update.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/bundle.1.ronn +0 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +0 -0
- data/bundler/lib/bundler/plugin/api/source.rb +1 -1
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +2 -3
- data/bundler/lib/bundler/rubygems_integration.rb +4 -0
- data/bundler/lib/bundler/settings.rb +0 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +1 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +0 -1
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +2 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +34 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +38 -40
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +4 -7
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/man/bundle-add.1 +1 -1
- data/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/man/bundle-cache.1 +1 -1
- data/bundler/man/bundle-check.1 +1 -1
- data/bundler/man/bundle-clean.1 +1 -1
- data/bundler/man/bundle-config.1 +2 -5
- data/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/man/bundle-exec.1 +1 -1
- data/bundler/man/bundle-gem.1 +1 -1
- data/bundler/man/bundle-info.1 +1 -1
- data/bundler/man/bundle-init.1 +1 -1
- data/bundler/man/bundle-inject.1 +1 -1
- data/bundler/man/bundle-install.1 +2 -2
- data/bundler/man/bundle-list.1 +1 -1
- data/bundler/man/bundle-lock.1 +1 -1
- data/bundler/man/bundle-open.1 +1 -1
- data/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/man/bundle-platform.1 +1 -1
- data/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/man/bundle-remove.1 +1 -1
- data/bundler/man/bundle-show.1 +1 -1
- data/bundler/man/bundle-update.1 +1 -1
- data/bundler/man/bundle-viz.1 +1 -1
- data/bundler/man/bundle.1 +1 -1
- data/bundler/man/gemfile.5 +1 -1
- data/bundler/man/index.txt +25 -0
- data/lib/rubygems.rb +6 -2
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/command_manager.rb +2 -2
- data/lib/rubygems/commands/build_command.rb +37 -20
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/help_command.rb +2 -0
- data/lib/rubygems/commands/owner_command.rb +10 -2
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +7 -3
- data/lib/rubygems/commands/query_command.rb +17 -0
- data/lib/rubygems/commands/server_command.rb +4 -0
- data/lib/rubygems/commands/setup_command.rb +25 -45
- data/lib/rubygems/commands/sources_command.rb +6 -2
- data/lib/rubygems/commands/specification_command.rb +6 -0
- data/lib/rubygems/commands/yank_command.rb +4 -4
- data/lib/rubygems/core_ext/kernel_require.rb +3 -0
- data/lib/rubygems/core_ext/kernel_warn.rb +6 -7
- data/lib/rubygems/defaults.rb +2 -2
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +4 -3
- data/lib/rubygems/ext/builder.rb +13 -32
- data/lib/rubygems/ext/cmake_builder.rb +4 -4
- data/lib/rubygems/ext/configure_builder.rb +4 -4
- data/lib/rubygems/ext/ext_conf_builder.rb +19 -14
- data/lib/rubygems/ext/rake_builder.rb +3 -3
- data/lib/rubygems/gemcutter_utilities.rb +90 -14
- data/lib/rubygems/indexer.rb +0 -1
- data/lib/rubygems/install_update_options.rb +2 -2
- data/lib/rubygems/installer.rb +12 -9
- data/lib/rubygems/installer_test_case.rb +7 -6
- data/lib/rubygems/name_tuple.rb +1 -1
- data/lib/rubygems/openssl.rb +4 -4
- data/lib/rubygems/package.rb +3 -2
- data/lib/rubygems/package/tar_header.rb +1 -1
- data/lib/rubygems/package/tar_test_case.rb +1 -1
- data/lib/rubygems/platform.rb +18 -7
- data/lib/rubygems/query_utils.rb +0 -9
- data/lib/rubygems/remote_fetcher.rb +1 -2
- data/lib/rubygems/request.rb +4 -3
- data/lib/rubygems/request_set/gem_dependency_api.rb +4 -4
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems/resolver/activation_request.rb +9 -1
- data/lib/rubygems/resolver/api_specification.rb +5 -1
- data/lib/rubygems/resolver/conflict.rb +1 -1
- data/lib/rubygems/resolver/dependency_request.rb +1 -1
- data/lib/rubygems/resolver/index_specification.rb +11 -0
- data/lib/rubygems/resolver/installer_set.rb +1 -2
- data/lib/rubygems/resolver/lock_set.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +39 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +43 -10
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +75 -7
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +506 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/specification.rb +1 -1
- data/lib/rubygems/s3_uri_signer.rb +1 -1
- data/lib/rubygems/security.rb +1 -2
- data/lib/rubygems/security/policy.rb +1 -1
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/server.rb +1 -1
- data/lib/rubygems/source.rb +10 -4
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +8 -8
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +1 -1
- data/lib/rubygems/test_case.rb +13 -26
- data/lib/rubygems/uri_formatter.rb +2 -1
- data/lib/rubygems/version_option.rb +6 -0
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_bundled_ca.rb +9 -5
- data/test/rubygems/test_gem.rb +3 -3
- data/test/rubygems/test_gem_commands_build_command.rb +197 -5
- data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +2 -2
- data/test/rubygems/test_gem_commands_help_command.rb +15 -2
- data/test/rubygems/test_gem_commands_install_command.rb +1 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +49 -1
- data/test/rubygems/test_gem_commands_pristine_command.rb +2 -2
- data/test/rubygems/test_gem_commands_push_command.rb +31 -5
- data/test/rubygems/test_gem_commands_query_command.rb +3 -3
- data/test/rubygems/test_gem_commands_setup_command.rb +13 -18
- data/test/rubygems/test_gem_commands_signin_command.rb +27 -3
- data/test/rubygems/test_gem_commands_sources_command.rb +60 -0
- data/test/rubygems/test_gem_commands_specification_command.rb +28 -0
- data/test/rubygems/test_gem_commands_update_command.rb +2 -2
- data/test/rubygems/test_gem_commands_yank_command.rb +31 -1
- data/test/rubygems/test_gem_dependency_installer.rb +36 -2
- data/test/rubygems/test_gem_dependency_list.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +10 -14
- data/test/rubygems/test_gem_ext_cmake_builder.rb +3 -9
- data/test/rubygems/test_gem_ext_configure_builder.rb +3 -9
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +9 -26
- data/test/rubygems/test_gem_ext_rake_builder.rb +5 -13
- data/test/rubygems/test_gem_gem_runner.rb +5 -4
- data/test/rubygems/test_gem_gemcutter_utilities.rb +3 -3
- data/test/rubygems/test_gem_install_update_options.rb +15 -3
- data/test/rubygems/test_gem_installer.rb +74 -11
- data/test/rubygems/test_gem_package.rb +8 -8
- data/test/rubygems/test_gem_package_old.rb +4 -4
- data/test/rubygems/test_gem_package_tar_writer.rb +1 -1
- data/test/rubygems/test_gem_platform.rb +63 -4
- data/test/rubygems/test_gem_remote_fetcher.rb +14 -18
- data/test/rubygems/test_gem_request.rb +2 -2
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
- data/test/rubygems/test_gem_resolver_api_set.rb +8 -8
- data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
- data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -1
- data/test/rubygems/test_gem_security.rb +2 -2
- data/test/rubygems/test_gem_security_policy.rb +2 -2
- data/test/rubygems/test_gem_security_signer.rb +2 -2
- data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
- data/test/rubygems/test_gem_source.rb +5 -0
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_specification.rb +5 -4
- data/test/rubygems/test_gem_uninstaller.rb +7 -7
- data/test/rubygems/test_gem_validator.rb +1 -1
- data/test/rubygems/test_gem_version_option.rb +1 -1
- data/test/rubygems/test_require.rb +50 -9
- metadata +35 -32
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -100,6 +100,7 @@ module Bundler
|
|
100
100
|
@specs.map do |s|
|
101
101
|
next s unless s.is_a?(LazySpecification)
|
102
102
|
s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
|
103
|
+
s.source.remote!
|
103
104
|
spec = s.__materialize__
|
104
105
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
105
106
|
spec
|
@@ -33,7 +33,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
33
33
|
## Contributing
|
34
34
|
|
35
35
|
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).<% end %>
|
36
|
-
|
37
36
|
<% if config[:mit] -%>
|
38
37
|
|
39
38
|
## License
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "<%= File.basename(config[:namespaced_path]) %>/version"
|
4
4
|
<%- if config[:ext] -%>
|
5
|
-
|
5
|
+
require_relative "<%= File.basename(config[:namespaced_path]) %>/<%= config[:underscored_name] %>"
|
6
6
|
<%- end -%>
|
7
7
|
|
8
8
|
<%- config[:constant_array].each_with_index do |c, i| -%>
|
@@ -33,4 +33,10 @@ Gem::Specification.new do |spec|
|
|
33
33
|
<%- if config[:ext] -%>
|
34
34
|
spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
|
35
35
|
<%- end -%>
|
36
|
+
|
37
|
+
# Uncomment to register a new dependency of your gem
|
38
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
39
|
+
|
40
|
+
# For more information and examples about making a new gem, checkout our
|
41
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
42
|
end
|
@@ -124,6 +124,7 @@ module Bundler::Molinillo
|
|
124
124
|
dot.join("\n")
|
125
125
|
end
|
126
126
|
|
127
|
+
# @param [DependencyGraph] other
|
127
128
|
# @return [Boolean] whether the two dependency graphs are equal, determined
|
128
129
|
# by a recursive traversal of each {#root_vertices} and its
|
129
130
|
# {Vertex#successors}
|
@@ -190,7 +191,7 @@ module Bundler::Molinillo
|
|
190
191
|
# @return [Edge] the added edge
|
191
192
|
def add_edge(origin, destination, requirement)
|
192
193
|
if destination.path_to?(origin)
|
193
|
-
raise CircularDependencyError.new(
|
194
|
+
raise CircularDependencyError.new(path(destination, origin))
|
194
195
|
end
|
195
196
|
add_edge_no_circular(origin, destination, requirement)
|
196
197
|
end
|
@@ -219,5 +220,37 @@ module Bundler::Molinillo
|
|
219
220
|
def add_edge_no_circular(origin, destination, requirement)
|
220
221
|
log.add_edge_no_circular(self, origin.name, destination.name, requirement)
|
221
222
|
end
|
223
|
+
|
224
|
+
# Returns the path between two vertices
|
225
|
+
# @raise [ArgumentError] if there is no path between the vertices
|
226
|
+
# @param [Vertex] from
|
227
|
+
# @param [Vertex] to
|
228
|
+
# @return [Array<Vertex>] the shortest path from `from` to `to`
|
229
|
+
def path(from, to)
|
230
|
+
distances = Hash.new(vertices.size + 1)
|
231
|
+
distances[from.name] = 0
|
232
|
+
predecessors = {}
|
233
|
+
each do |vertex|
|
234
|
+
vertex.successors.each do |successor|
|
235
|
+
if distances[successor.name] > distances[vertex.name] + 1
|
236
|
+
distances[successor.name] = distances[vertex.name] + 1
|
237
|
+
predecessors[successor] = vertex
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
path = [to]
|
243
|
+
while before = predecessors[to]
|
244
|
+
path << before
|
245
|
+
to = before
|
246
|
+
break if to == from
|
247
|
+
end
|
248
|
+
|
249
|
+
unless path.last.equal?(from)
|
250
|
+
raise ArgumentError, "There is no path from #{from.name} to #{to.name}"
|
251
|
+
end
|
252
|
+
|
253
|
+
path.reverse
|
254
|
+
end
|
222
255
|
end
|
223
256
|
end
|
@@ -65,7 +65,7 @@ module Bundler::Molinillo
|
|
65
65
|
# @param [SpecificationProvider] specification_provider see {#specification_provider}
|
66
66
|
def initialize(conflicts, specification_provider)
|
67
67
|
pairs = []
|
68
|
-
|
68
|
+
conflicts.values.flat_map(&:requirements).each do |conflicting|
|
69
69
|
conflicting.each do |source, conflict_requirements|
|
70
70
|
conflict_requirements.each do |c|
|
71
71
|
pairs << [c, source]
|
@@ -207,7 +207,7 @@ module Bundler::Molinillo
|
|
207
207
|
def start_resolution
|
208
208
|
@started_at = Time.now
|
209
209
|
|
210
|
-
|
210
|
+
push_initial_state
|
211
211
|
|
212
212
|
debug { "Starting resolution (#{@started_at})\nUser-requested dependencies: #{original_requested}" }
|
213
213
|
resolver_ui.before_resolution
|
@@ -273,10 +273,10 @@ module Bundler::Molinillo
|
|
273
273
|
states.last
|
274
274
|
end
|
275
275
|
|
276
|
-
# Creates the initial state for the resolution, based upon the
|
276
|
+
# Creates and pushes the initial state for the resolution, based upon the
|
277
277
|
# {#requested} dependencies
|
278
|
-
# @return [
|
279
|
-
def
|
278
|
+
# @return [void]
|
279
|
+
def push_initial_state
|
280
280
|
graph = DependencyGraph.new.tap do |dg|
|
281
281
|
original_requested.each do |requested|
|
282
282
|
vertex = dg.add_vertex(name_for(requested), nil, true)
|
@@ -285,18 +285,7 @@ module Bundler::Molinillo
|
|
285
285
|
dg.tag(:initial_state)
|
286
286
|
end
|
287
287
|
|
288
|
-
|
289
|
-
initial_requirement = requirements.shift
|
290
|
-
DependencyState.new(
|
291
|
-
initial_requirement && name_for(initial_requirement),
|
292
|
-
requirements,
|
293
|
-
graph,
|
294
|
-
initial_requirement,
|
295
|
-
possibilities_for_requirement(initial_requirement, graph),
|
296
|
-
0,
|
297
|
-
{},
|
298
|
-
[]
|
299
|
-
)
|
288
|
+
push_state_for_requirements(original_requested, true, graph)
|
300
289
|
end
|
301
290
|
|
302
291
|
# Unwinds the states stack because a conflict has been encountered
|
@@ -361,7 +350,7 @@ module Bundler::Molinillo
|
|
361
350
|
current_detail
|
362
351
|
end
|
363
352
|
|
364
|
-
# @param [Array<Object>] array of requirements that combine to create a conflict
|
353
|
+
# @param [Array<Object>] binding_requirements array of requirements that combine to create a conflict
|
365
354
|
# @return [Array<UnwindDetails>] array of UnwindDetails that have a chance
|
366
355
|
# of resolving the passed requirements
|
367
356
|
def unwind_options_for_requirements(binding_requirements)
|
@@ -429,7 +418,7 @@ module Bundler::Molinillo
|
|
429
418
|
end
|
430
419
|
|
431
420
|
# @param [DependencyState] state
|
432
|
-
# @param [Array] array of requirements
|
421
|
+
# @param [Array] binding_requirements array of requirements
|
433
422
|
# @return [Boolean] whether or not the given state has any possibilities
|
434
423
|
# that could satisfy the given requirements
|
435
424
|
def conflict_fixing_possibilities?(state, binding_requirements)
|
@@ -444,7 +433,8 @@ module Bundler::Molinillo
|
|
444
433
|
|
445
434
|
# Filter's a state's possibilities to remove any that would not fix the
|
446
435
|
# conflict we've just rewound from
|
447
|
-
# @param [UnwindDetails] details of the conflict just
|
436
|
+
# @param [UnwindDetails] unwind_details details of the conflict just
|
437
|
+
# unwound from
|
448
438
|
# @return [void]
|
449
439
|
def filter_possibilities_after_unwind(unwind_details)
|
450
440
|
return unless state && !state.possibilities.empty?
|
@@ -458,7 +448,7 @@ module Bundler::Molinillo
|
|
458
448
|
|
459
449
|
# Filter's a state's possibilities to remove any that would not satisfy
|
460
450
|
# the requirements in the conflict we've just rewound from
|
461
|
-
# @param [UnwindDetails] details of the conflict just unwound from
|
451
|
+
# @param [UnwindDetails] unwind_details details of the conflict just unwound from
|
462
452
|
# @return [void]
|
463
453
|
def filter_possibilities_for_primary_unwind(unwind_details)
|
464
454
|
unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index }
|
@@ -491,7 +481,7 @@ module Bundler::Molinillo
|
|
491
481
|
|
492
482
|
# Filter's a state's possibilities to remove any that would (eventually)
|
493
483
|
# create a requirement in the conflict we've just rewound from
|
494
|
-
# @param [UnwindDetails] details of the conflict just unwound from
|
484
|
+
# @param [UnwindDetails] unwind_details details of the conflict just unwound from
|
495
485
|
# @return [void]
|
496
486
|
def filter_possibilities_for_parent_unwind(unwind_details)
|
497
487
|
unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index }
|
@@ -500,7 +490,7 @@ module Bundler::Molinillo
|
|
500
490
|
primary_unwinds = unwinds_to_state.select(&:unwinding_to_primary_requirement?).uniq
|
501
491
|
parent_unwinds = unwinds_to_state.uniq - primary_unwinds
|
502
492
|
|
503
|
-
allowed_possibility_sets =
|
493
|
+
allowed_possibility_sets = primary_unwinds.flat_map do |unwind|
|
504
494
|
states[unwind.state_index].possibilities.select do |possibility_set|
|
505
495
|
possibility_set.possibilities.any? do |poss|
|
506
496
|
possibility_satisfies_requirements?(poss, unwind.conflicting_requirements)
|
@@ -508,7 +498,7 @@ module Bundler::Molinillo
|
|
508
498
|
end
|
509
499
|
end
|
510
500
|
|
511
|
-
requirements_to_avoid =
|
501
|
+
requirements_to_avoid = parent_unwinds.flat_map(&:sub_dependencies_to_avoid)
|
512
502
|
|
513
503
|
state.possibilities.reject! do |possibility_set|
|
514
504
|
!allowed_possibility_sets.include?(possibility_set) &&
|
@@ -524,12 +514,12 @@ module Bundler::Molinillo
|
|
524
514
|
|
525
515
|
possible_binding_requirements = conflict.requirements.values.flatten(1).uniq
|
526
516
|
|
527
|
-
# When there
|
528
|
-
# (the one causing the circular) won
|
529
|
-
# (which won
|
530
|
-
# because it
|
531
|
-
# We need to make sure we have that requirement in the conflict
|
532
|
-
# otherwise we won
|
517
|
+
# When there's a `CircularDependency` error the conflicting requirement
|
518
|
+
# (the one causing the circular) won't be `conflict.requirement`
|
519
|
+
# (which won't be for the right state, because we won't have created it,
|
520
|
+
# because it's circular).
|
521
|
+
# We need to make sure we have that requirement in the conflict's list,
|
522
|
+
# otherwise we won't be able to unwind properly, so we just return all
|
533
523
|
# the requirements for the conflict.
|
534
524
|
return possible_binding_requirements if conflict.underlying_error
|
535
525
|
|
@@ -558,8 +548,8 @@ module Bundler::Molinillo
|
|
558
548
|
end
|
559
549
|
|
560
550
|
# @param [Object] requirement we wish to check
|
561
|
-
# @param [Array] array of requirements
|
562
|
-
# @param [Array] array of possibilities the requirements will be used to filter
|
551
|
+
# @param [Array] possible_binding_requirements array of requirements
|
552
|
+
# @param [Array] possibilities array of possibilities the requirements will be used to filter
|
563
553
|
# @return [Boolean] whether or not the given requirement is required to filter
|
564
554
|
# out all elements of the array of possibilities.
|
565
555
|
def binding_requirement_in_set?(requirement, possible_binding_requirements, possibilities)
|
@@ -568,6 +558,7 @@ module Bundler::Molinillo
|
|
568
558
|
end
|
569
559
|
end
|
570
560
|
|
561
|
+
# @param [Object] requirement
|
571
562
|
# @return [Object] the requirement that led to `requirement` being added
|
572
563
|
# to the list of requirements.
|
573
564
|
def parent_of(requirement)
|
@@ -577,6 +568,7 @@ module Bundler::Molinillo
|
|
577
568
|
parent_state.requirement
|
578
569
|
end
|
579
570
|
|
571
|
+
# @param [String] name
|
580
572
|
# @return [Object] the requirement that led to a version of a possibility
|
581
573
|
# with the given name being activated.
|
582
574
|
def requirement_for_existing_name(name)
|
@@ -585,6 +577,7 @@ module Bundler::Molinillo
|
|
585
577
|
states.find { |s| s.name == name }.requirement
|
586
578
|
end
|
587
579
|
|
580
|
+
# @param [Object] requirement
|
588
581
|
# @return [ResolutionState] the state whose `requirement` is the given
|
589
582
|
# `requirement`.
|
590
583
|
def find_state_for(requirement)
|
@@ -592,6 +585,7 @@ module Bundler::Molinillo
|
|
592
585
|
states.find { |i| requirement == i.requirement }
|
593
586
|
end
|
594
587
|
|
588
|
+
# @param [Object] underlying_error
|
595
589
|
# @return [Conflict] a {Conflict} that reflects the failure to activate
|
596
590
|
# the {#possibility} in conjunction with the current {#state}
|
597
591
|
def create_conflict(underlying_error = nil)
|
@@ -628,6 +622,7 @@ module Bundler::Molinillo
|
|
628
622
|
vertex.requirements.map { |r| requirement_tree_for(r) }
|
629
623
|
end
|
630
624
|
|
625
|
+
# @param [Object] requirement
|
631
626
|
# @return [Array<Object>] the list of requirements that led to
|
632
627
|
# `requirement` being required.
|
633
628
|
def requirement_tree_for(requirement)
|
@@ -673,9 +668,8 @@ module Bundler::Molinillo
|
|
673
668
|
attempt_to_filter_existing_spec(existing_vertex)
|
674
669
|
else
|
675
670
|
latest = possibility.latest_version
|
676
|
-
|
677
|
-
|
678
|
-
!requirement_satisfied_by?(requirement, activated, possibility)
|
671
|
+
possibility.possibilities.select! do |possibility|
|
672
|
+
requirement_satisfied_by?(requirement, activated, possibility)
|
679
673
|
end
|
680
674
|
if possibility.latest_version.nil?
|
681
675
|
# ensure there's a possibility for better error messages
|
@@ -705,7 +699,7 @@ module Bundler::Molinillo
|
|
705
699
|
|
706
700
|
# Generates a filtered version of the existing vertex's `PossibilitySet` using the
|
707
701
|
# current state's `requirement`
|
708
|
-
# @param [Object] existing vertex
|
702
|
+
# @param [Object] vertex existing vertex
|
709
703
|
# @return [PossibilitySet] filtered possibility set
|
710
704
|
def filtered_possibility_set(vertex)
|
711
705
|
PossibilitySet.new(vertex.payload.dependencies, vertex.payload.possibilities & possibility.possibilities)
|
@@ -730,7 +724,7 @@ module Bundler::Molinillo
|
|
730
724
|
end
|
731
725
|
|
732
726
|
# Requires the dependencies that the recently activated spec has
|
733
|
-
# @param [Object]
|
727
|
+
# @param [Object] possibility_set the PossibilitySet that has just been
|
734
728
|
# activated
|
735
729
|
# @return [void]
|
736
730
|
def require_nested_dependencies_for(possibility_set)
|
@@ -749,6 +743,8 @@ module Bundler::Molinillo
|
|
749
743
|
# Pushes a new {DependencyState} that encapsulates both existing and new
|
750
744
|
# requirements
|
751
745
|
# @param [Array] new_requirements
|
746
|
+
# @param [Boolean] requires_sort
|
747
|
+
# @param [Object] new_activated
|
752
748
|
# @return [void]
|
753
749
|
def push_state_for_requirements(new_requirements, requires_sort = true, new_activated = activated)
|
754
750
|
new_requirements = sort_dependencies(new_requirements.uniq, new_activated, conflicts) if requires_sort
|
@@ -767,7 +763,8 @@ module Bundler::Molinillo
|
|
767
763
|
|
768
764
|
# Checks a proposed requirement with any existing locked requirement
|
769
765
|
# before generating an array of possibilities for it.
|
770
|
-
# @param [Object] the proposed requirement
|
766
|
+
# @param [Object] requirement the proposed requirement
|
767
|
+
# @param [Object] activated
|
771
768
|
# @return [Array] possibilities
|
772
769
|
def possibilities_for_requirement(requirement, activated = self.activated)
|
773
770
|
return [] unless requirement
|
@@ -778,7 +775,8 @@ module Bundler::Molinillo
|
|
778
775
|
group_possibilities(search_for(requirement))
|
779
776
|
end
|
780
777
|
|
781
|
-
# @param [Object] the proposed requirement
|
778
|
+
# @param [Object] requirement the proposed requirement
|
779
|
+
# @param [Object] activated
|
782
780
|
# @return [Array] possibility set containing only the locked requirement, if any
|
783
781
|
def locked_requirement_possibility_set(requirement, activated = self.activated)
|
784
782
|
all_possibilities = search_for(requirement)
|
@@ -797,8 +795,8 @@ module Bundler::Molinillo
|
|
797
795
|
# Build an array of PossibilitySets, with each element representing a group of
|
798
796
|
# dependency versions that all have the same sub-dependency version constraints
|
799
797
|
# and are contiguous.
|
800
|
-
# @param [Array] an array of possibilities
|
801
|
-
# @return [Array] an array of possibility sets
|
798
|
+
# @param [Array] possibilities an array of possibilities
|
799
|
+
# @return [Array<PossibilitySet>] an array of possibility sets
|
802
800
|
def group_possibilities(possibilities)
|
803
801
|
possibility_sets = []
|
804
802
|
current_possibility_set = nil
|
@@ -3,6 +3,8 @@ require_relative '../../../../uri/lib/uri'
|
|
3
3
|
require 'cgi' # for escaping
|
4
4
|
require_relative '../../../../connection_pool/lib/connection_pool'
|
5
5
|
|
6
|
+
autoload :OpenSSL, 'openssl'
|
7
|
+
|
6
8
|
##
|
7
9
|
# Persistent connections for Net::HTTP
|
8
10
|
#
|
@@ -147,14 +149,9 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
147
149
|
EPOCH = Time.at 0 # :nodoc:
|
148
150
|
|
149
151
|
##
|
150
|
-
# Is OpenSSL available?
|
152
|
+
# Is OpenSSL available? This test works with autoload
|
151
153
|
|
152
|
-
HAVE_OPENSSL =
|
153
|
-
require 'openssl'
|
154
|
-
true
|
155
|
-
rescue LoadError
|
156
|
-
false
|
157
|
-
end
|
154
|
+
HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
|
158
155
|
|
159
156
|
##
|
160
157
|
# The default connection pool size is 1/4 the allowed open files
|
@@ -0,0 +1,154 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# tmpdir - retrieve temporary directory path
|
4
|
+
#
|
5
|
+
# $Id$
|
6
|
+
#
|
7
|
+
|
8
|
+
require_relative '../../fileutils/lib/fileutils'
|
9
|
+
begin
|
10
|
+
require 'etc.so'
|
11
|
+
rescue LoadError # rescue LoadError for miniruby
|
12
|
+
end
|
13
|
+
|
14
|
+
class Bundler::Dir < Dir
|
15
|
+
|
16
|
+
@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '/tmp'
|
17
|
+
|
18
|
+
##
|
19
|
+
# Returns the operating system's temporary file path.
|
20
|
+
|
21
|
+
def self.tmpdir
|
22
|
+
tmp = nil
|
23
|
+
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @systmpdir], ['/tmp']*2, ['.']*2].each do |name, dir = ENV[name]|
|
24
|
+
next if !dir
|
25
|
+
dir = File.expand_path(dir)
|
26
|
+
stat = File.stat(dir) rescue next
|
27
|
+
case
|
28
|
+
when !stat.directory?
|
29
|
+
warn "#{name} is not a directory: #{dir}"
|
30
|
+
when !stat.writable?
|
31
|
+
warn "#{name} is not writable: #{dir}"
|
32
|
+
when stat.world_writable? && !stat.sticky?
|
33
|
+
warn "#{name} is world-writable: #{dir}"
|
34
|
+
else
|
35
|
+
tmp = dir
|
36
|
+
break
|
37
|
+
end
|
38
|
+
end
|
39
|
+
raise ArgumentError, "could not find a temporary directory" unless tmp
|
40
|
+
tmp
|
41
|
+
end
|
42
|
+
|
43
|
+
# Bundler::Dir.mktmpdir creates a temporary directory.
|
44
|
+
#
|
45
|
+
# The directory is created with 0700 permission.
|
46
|
+
# Application should not change the permission to make the temporary directory accessible from other users.
|
47
|
+
#
|
48
|
+
# The prefix and suffix of the name of the directory is specified by
|
49
|
+
# the optional first argument, <i>prefix_suffix</i>.
|
50
|
+
# - If it is not specified or nil, "d" is used as the prefix and no suffix is used.
|
51
|
+
# - If it is a string, it is used as the prefix and no suffix is used.
|
52
|
+
# - If it is an array, first element is used as the prefix and second element is used as a suffix.
|
53
|
+
#
|
54
|
+
# Bundler::Dir.mktmpdir {|dir| dir is ".../d..." }
|
55
|
+
# Bundler::Dir.mktmpdir("foo") {|dir| dir is ".../foo..." }
|
56
|
+
# Bundler::Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" }
|
57
|
+
#
|
58
|
+
# The directory is created under Bundler::Dir.tmpdir or
|
59
|
+
# the optional second argument <i>tmpdir</i> if non-nil value is given.
|
60
|
+
#
|
61
|
+
# Bundler::Dir.mktmpdir {|dir| dir is "#{Bundler::Dir.tmpdir}/d..." }
|
62
|
+
# Bundler::Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." }
|
63
|
+
#
|
64
|
+
# If a block is given,
|
65
|
+
# it is yielded with the path of the directory.
|
66
|
+
# The directory and its contents are removed
|
67
|
+
# using Bundler::FileUtils.remove_entry before Bundler::Dir.mktmpdir returns.
|
68
|
+
# The value of the block is returned.
|
69
|
+
#
|
70
|
+
# Bundler::Dir.mktmpdir {|dir|
|
71
|
+
# # use the directory...
|
72
|
+
# open("#{dir}/foo", "w") { ... }
|
73
|
+
# }
|
74
|
+
#
|
75
|
+
# If a block is not given,
|
76
|
+
# The path of the directory is returned.
|
77
|
+
# In this case, Bundler::Dir.mktmpdir doesn't remove the directory.
|
78
|
+
#
|
79
|
+
# dir = Bundler::Dir.mktmpdir
|
80
|
+
# begin
|
81
|
+
# # use the directory...
|
82
|
+
# open("#{dir}/foo", "w") { ... }
|
83
|
+
# ensure
|
84
|
+
# # remove the directory.
|
85
|
+
# Bundler::FileUtils.remove_entry dir
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
def self.mktmpdir(prefix_suffix=nil, *rest, **options)
|
89
|
+
base = nil
|
90
|
+
path = Tmpname.create(prefix_suffix || "d", *rest, **options) {|p, _, _, d|
|
91
|
+
base = d
|
92
|
+
mkdir(p, 0700)
|
93
|
+
}
|
94
|
+
if block_given?
|
95
|
+
begin
|
96
|
+
yield path.dup
|
97
|
+
ensure
|
98
|
+
unless base
|
99
|
+
stat = File.stat(File.dirname(path))
|
100
|
+
if stat.world_writable? and !stat.sticky?
|
101
|
+
raise ArgumentError, "parent directory is world writable but not sticky"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
Bundler::FileUtils.remove_entry path
|
105
|
+
end
|
106
|
+
else
|
107
|
+
path
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
module Tmpname # :nodoc:
|
112
|
+
module_function
|
113
|
+
|
114
|
+
def tmpdir
|
115
|
+
Bundler::Dir.tmpdir
|
116
|
+
end
|
117
|
+
|
118
|
+
UNUSABLE_CHARS = [File::SEPARATOR, File::ALT_SEPARATOR, File::PATH_SEPARATOR, ":"].uniq.join("").freeze
|
119
|
+
|
120
|
+
class << (RANDOM = Random.new)
|
121
|
+
MAX = 36**6 # < 0x100000000
|
122
|
+
def next
|
123
|
+
rand(MAX).to_s(36)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
private_constant :RANDOM
|
127
|
+
|
128
|
+
def create(basename, tmpdir=nil, max_try: nil, **opts)
|
129
|
+
origdir = tmpdir
|
130
|
+
tmpdir ||= tmpdir()
|
131
|
+
n = nil
|
132
|
+
prefix, suffix = basename
|
133
|
+
prefix = (String.try_convert(prefix) or
|
134
|
+
raise ArgumentError, "unexpected prefix: #{prefix.inspect}")
|
135
|
+
prefix = prefix.delete(UNUSABLE_CHARS)
|
136
|
+
suffix &&= (String.try_convert(suffix) or
|
137
|
+
raise ArgumentError, "unexpected suffix: #{suffix.inspect}")
|
138
|
+
suffix &&= suffix.delete(UNUSABLE_CHARS)
|
139
|
+
begin
|
140
|
+
t = Time.now.strftime("%Y%m%d")
|
141
|
+
path = "#{prefix}#{t}-#{$$}-#{RANDOM.next}"\
|
142
|
+
"#{n ? %[-#{n}] : ''}#{suffix||''}"
|
143
|
+
path = File.join(tmpdir, path)
|
144
|
+
yield(path, n, opts, origdir)
|
145
|
+
rescue Errno::EEXIST
|
146
|
+
n ||= 0
|
147
|
+
n += 1
|
148
|
+
retry if !max_try or n < max_try
|
149
|
+
raise "cannot generate temporary name using `#{basename}' under `#{tmpdir}'"
|
150
|
+
end
|
151
|
+
path
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|