mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 13:34:17 +02:00
parent
7cb0bb43b9
commit
10d694a1ff
8 changed files with 59 additions and 14 deletions
|
@ -651,6 +651,15 @@ module Bundler
|
||||||
incomplete_specs = still_incomplete_specs
|
incomplete_specs = still_incomplete_specs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
insecurely_materialized_specs = specs.insecurely_materialized_specs
|
||||||
|
|
||||||
|
if insecurely_materialized_specs.any?
|
||||||
|
Bundler.ui.warn "The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version:\n" \
|
||||||
|
" * #{insecurely_materialized_specs.map(&:full_name).join("\n * ")}\n" \
|
||||||
|
"Please run `bundle lock --normalize-platforms` and commit the resulting lockfile.\n" \
|
||||||
|
"Alternatively, you may run `bundle lock --add-platform <list-of-platforms-that-you-want-to-support>`"
|
||||||
|
end
|
||||||
|
|
||||||
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
||||||
specs["bundler"] = bundler
|
specs["bundler"] = bundler
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Bundler
|
||||||
include MatchRemoteMetadata
|
include MatchRemoteMetadata
|
||||||
|
|
||||||
attr_reader :name, :version, :platform, :checksum
|
attr_reader :name, :version, :platform, :checksum
|
||||||
attr_accessor :remote, :dependencies
|
attr_accessor :remote, :dependencies, :locked_platform
|
||||||
|
|
||||||
def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil)
|
def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil)
|
||||||
super()
|
super()
|
||||||
|
@ -18,10 +18,15 @@ module Bundler
|
||||||
|
|
||||||
@loaded_from = nil
|
@loaded_from = nil
|
||||||
@remote_specification = nil
|
@remote_specification = nil
|
||||||
|
@locked_platform = nil
|
||||||
|
|
||||||
parse_metadata(metadata)
|
parse_metadata(metadata)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def insecurely_materialized?
|
||||||
|
@locked_platform.to_s != @platform.to_s
|
||||||
|
end
|
||||||
|
|
||||||
def fetch_platform
|
def fetch_platform
|
||||||
@platform
|
@platform
|
||||||
end
|
end
|
||||||
|
|
|
@ -99,15 +99,24 @@ module Bundler
|
||||||
out
|
out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def materialize_strictly
|
||||||
|
source.local!
|
||||||
|
|
||||||
|
matching_specs = source.specs.search(self)
|
||||||
|
return self if matching_specs.empty?
|
||||||
|
|
||||||
|
__materialize__(matching_specs)
|
||||||
|
end
|
||||||
|
|
||||||
def materialize_for_installation(most_specific_locked_platform = nil)
|
def materialize_for_installation(most_specific_locked_platform = nil)
|
||||||
source.local!
|
source.local!
|
||||||
|
|
||||||
matching_specs = source.specs.search(use_exact_resolved_specifications?(most_specific_locked_platform) ? self : [name, version])
|
if use_exact_resolved_specifications?(most_specific_locked_platform)
|
||||||
|
materialize_strictly
|
||||||
|
else
|
||||||
|
matching_specs = source.specs.search([name, version])
|
||||||
return self if matching_specs.empty?
|
return self if matching_specs.empty?
|
||||||
|
|
||||||
candidates = if use_exact_resolved_specifications?(most_specific_locked_platform)
|
|
||||||
matching_specs
|
|
||||||
else
|
|
||||||
target_platform = source.is_a?(Source::Path) ? platform : local_platform
|
target_platform = source.is_a?(Source::Path) ? platform : local_platform
|
||||||
|
|
||||||
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
|
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
|
||||||
|
@ -119,10 +128,8 @@ module Bundler
|
||||||
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
|
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
|
||||||
end
|
end
|
||||||
|
|
||||||
installable_candidates
|
__materialize__(installable_candidates)
|
||||||
end
|
end
|
||||||
|
|
||||||
__materialize__(candidates)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# If in frozen mode, we fallback to a non-installable candidate because by
|
# If in frozen mode, we fallback to a non-installable candidate because by
|
||||||
|
@ -143,9 +150,13 @@ module Bundler
|
||||||
# `bundler/setup` performance
|
# `bundler/setup` performance
|
||||||
if search.is_a?(StubSpecification)
|
if search.is_a?(StubSpecification)
|
||||||
search.dependencies = dependencies
|
search.dependencies = dependencies
|
||||||
elsif !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort
|
else
|
||||||
|
if !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort
|
||||||
raise IncorrectLockfileDependencies.new(self)
|
raise IncorrectLockfileDependencies.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
search
|
search
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Bundler
|
||||||
|
|
||||||
attr_reader :name, :version, :platform
|
attr_reader :name, :version, :platform
|
||||||
attr_writer :dependencies
|
attr_writer :dependencies
|
||||||
attr_accessor :source, :remote
|
attr_accessor :source, :remote, :locked_platform
|
||||||
|
|
||||||
def initialize(name, version, platform, spec_fetcher)
|
def initialize(name, version, platform, spec_fetcher)
|
||||||
@name = name
|
@name = name
|
||||||
|
@ -21,6 +21,11 @@ module Bundler
|
||||||
@platform = Gem::Platform.new(platform)
|
@platform = Gem::Platform.new(platform)
|
||||||
@spec_fetcher = spec_fetcher
|
@spec_fetcher = spec_fetcher
|
||||||
@dependencies = nil
|
@dependencies = nil
|
||||||
|
@locked_platform = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def insecurely_materialized?
|
||||||
|
@locked_platform.to_s != @platform.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
# Needed before installs, since the arch matters then and quick
|
# Needed before installs, since the arch matters then and quick
|
||||||
|
|
|
@ -150,6 +150,10 @@ module Gem
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def insecurely_materialized?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def groups
|
def groups
|
||||||
@groups ||= []
|
@groups ||= []
|
||||||
end
|
end
|
||||||
|
|
|
@ -143,7 +143,7 @@ module Bundler
|
||||||
@specs.map do |s|
|
@specs.map do |s|
|
||||||
next s unless s.is_a?(LazySpecification)
|
next s unless s.is_a?(LazySpecification)
|
||||||
s.source.remote!
|
s.source.remote!
|
||||||
spec = s.materialize_for_installation
|
spec = s.materialize_strictly
|
||||||
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
||||||
spec
|
spec
|
||||||
end
|
end
|
||||||
|
@ -162,6 +162,10 @@ module Bundler
|
||||||
@specs.select {|s| s.is_a?(LazySpecification) }
|
@specs.select {|s| s.is_a?(LazySpecification) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def insecurely_materialized_specs
|
||||||
|
@specs.select(&:insecurely_materialized?)
|
||||||
|
end
|
||||||
|
|
||||||
def -(other)
|
def -(other)
|
||||||
SpecSet.new(to_a - other.to_a)
|
SpecSet.new(to_a - other.to_a)
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,10 @@ module Bundler
|
||||||
spec
|
spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def insecurely_materialized?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
attr_reader :checksum
|
attr_reader :checksum
|
||||||
attr_accessor :stub, :ignored
|
attr_accessor :stub, :ignored
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ RSpec.describe "bundle install with specific platforms" do
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "install --verbose"
|
bundle "install --verbose"
|
||||||
|
expect(err).to include("The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version")
|
||||||
expect(out).to include("Installing sass-embedded 1.72.0 (x86_64-darwin-15)")
|
expect(out).to include("Installing sass-embedded 1.72.0 (x86_64-darwin-15)")
|
||||||
|
|
||||||
expect(the_bundle).to include_gem("sass-embedded 1.72.0 x86_64-darwin-15")
|
expect(the_bundle).to include_gem("sass-embedded 1.72.0 x86_64-darwin-15")
|
||||||
|
@ -130,6 +130,7 @@ RSpec.describe "bundle install with specific platforms" do
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "update"
|
bundle "update"
|
||||||
|
expect(err).to include("The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version")
|
||||||
|
|
||||||
checksums.checksum gem_repo2, "google-protobuf", "3.0.0.alpha.5.0.5.1"
|
checksums.checksum gem_repo2, "google-protobuf", "3.0.0.alpha.5.0.5.1"
|
||||||
|
|
||||||
|
@ -238,6 +239,7 @@ RSpec.describe "bundle install with specific platforms" do
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "install --verbose"
|
bundle "install --verbose"
|
||||||
|
expect(err).to include("The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version")
|
||||||
expect(out).to include("Installing libv8 8.4.255.0 (universal-darwin)")
|
expect(out).to include("Installing libv8 8.4.255.0 (universal-darwin)")
|
||||||
|
|
||||||
bundle "add mini_racer --verbose"
|
bundle "add mini_racer --verbose"
|
||||||
|
@ -275,6 +277,7 @@ RSpec.describe "bundle install with specific platforms" do
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "install --verbose", artifice: "compact_index_precompiled_before"
|
bundle "install --verbose", artifice: "compact_index_precompiled_before"
|
||||||
|
expect(err).to include("The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version")
|
||||||
expect(out).to include("Installing grpc 1.50.0 (universal-darwin)")
|
expect(out).to include("Installing grpc 1.50.0 (universal-darwin)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue