[rubygems/rubygems] Print a better debug message when lockfile does not include the current platform
https://github.com/rubygems/rubygems/commit/afb7a6d754
This commit is contained in:
parent
997642cfbd
commit
0dda30d9eb
@ -137,7 +137,7 @@ module Bundler
|
|||||||
end
|
end
|
||||||
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
||||||
|
|
||||||
add_current_platform unless Bundler.frozen_bundle?
|
@current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
|
||||||
|
|
||||||
converge_path_sources_to_gemspec_sources
|
converge_path_sources_to_gemspec_sources
|
||||||
@path_changes = converge_paths
|
@path_changes = converge_paths
|
||||||
@ -484,6 +484,7 @@ module Bundler
|
|||||||
|
|
||||||
!@source_changes &&
|
!@source_changes &&
|
||||||
!@dependency_changes &&
|
!@dependency_changes &&
|
||||||
|
!@current_platform_missing &&
|
||||||
@new_platforms.empty? &&
|
@new_platforms.empty? &&
|
||||||
!@path_changes &&
|
!@path_changes &&
|
||||||
!@local_changes &&
|
!@local_changes &&
|
||||||
@ -676,7 +677,8 @@ module Bundler
|
|||||||
@most_specific_non_local_locked_ruby_platform = find_most_specific_locked_ruby_platform
|
@most_specific_non_local_locked_ruby_platform = find_most_specific_locked_ruby_platform
|
||||||
return if @most_specific_non_local_locked_ruby_platform
|
return if @most_specific_non_local_locked_ruby_platform
|
||||||
|
|
||||||
add_platform(local_platform)
|
@platforms << local_platform
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_most_specific_locked_ruby_platform
|
def find_most_specific_locked_ruby_platform
|
||||||
@ -704,6 +706,7 @@ module Bundler
|
|||||||
[
|
[
|
||||||
[@source_changes, "the list of sources changed"],
|
[@source_changes, "the list of sources changed"],
|
||||||
[@dependency_changes, "the dependencies in your gemfile changed"],
|
[@dependency_changes, "the dependencies in your gemfile changed"],
|
||||||
|
[@current_platform_missing, "your lockfile does not include the current platform"],
|
||||||
[@new_platforms.any?, "you added a new platform to your gemfile"],
|
[@new_platforms.any?, "you added a new platform to your gemfile"],
|
||||||
[@path_changes, "the gemspecs for path gems changed"],
|
[@path_changes, "the gemspecs for path gems changed"],
|
||||||
[@local_changes, "the gemspecs for git local gems changed"],
|
[@local_changes, "the gemspecs for git local gems changed"],
|
||||||
|
@ -1136,12 +1136,16 @@ RSpec.describe "bundle install with gem sources" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "in a frozen bundle" do
|
context "when current platform not included in the lockfile" do
|
||||||
before do
|
around do |example|
|
||||||
build_repo4 do
|
build_repo4 do
|
||||||
build_gem "libv8", "8.4.255.0" do |s|
|
build_gem "libv8", "8.4.255.0" do |s|
|
||||||
s.platform = "x86_64-darwin-19"
|
s.platform = "x86_64-darwin-19"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
build_gem "libv8", "8.4.255.0" do |s|
|
||||||
|
s.platform = "x86_64-linux"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
gemfile <<-G
|
gemfile <<-G
|
||||||
@ -1166,11 +1170,36 @@ RSpec.describe "bundle install with gem sources" do
|
|||||||
#{Bundler::VERSION}
|
#{Bundler::VERSION}
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "config set --local deployment true"
|
simulate_platform("x86_64-linux", &example)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should fail loudly if the lockfile platforms don't include the current platform" do
|
it "adds the current platform to the lockfile" do
|
||||||
simulate_platform("x86_64-linux") { bundle "install", raise_on_error: false }
|
bundle "install --verbose"
|
||||||
|
|
||||||
|
expect(out).to include("re-resolving dependencies because your lockfile does not include the current platform")
|
||||||
|
|
||||||
|
expect(lockfile).to eq <<~L
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo4/
|
||||||
|
specs:
|
||||||
|
libv8 (8.4.255.0-x86_64-darwin-19)
|
||||||
|
libv8 (8.4.255.0-x86_64-linux)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-darwin-19
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
libv8
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
end
|
||||||
|
|
||||||
|
it "fails loudly if frozen mode set" do
|
||||||
|
bundle "config set --local deployment true"
|
||||||
|
bundle "install", raise_on_error: false
|
||||||
|
|
||||||
expect(err).to eq(
|
expect(err).to eq(
|
||||||
"Your bundle only supports platforms [\"x86_64-darwin-19\"] but your local platform is x86_64-linux. " \
|
"Your bundle only supports platforms [\"x86_64-darwin-19\"] but your local platform is x86_64-linux. " \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user