[rubygems/rubygems] Don't remove existing platform gems when PLATFORMS section is badly indented
https://github.com/rubygems/rubygems/commit/ec099ebf1e
This commit is contained in:
parent
540bcf5248
commit
3005ed6816
@ -272,7 +272,7 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse_platform(line)
|
def parse_platform(line)
|
||||||
@platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
|
@platforms << Gem::Platform.new($1.strip) if line =~ /^ (.*)$/
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_bundled_with(line)
|
def parse_bundled_with(line)
|
||||||
|
@ -1990,4 +1990,64 @@ RSpec.describe "bundle lock" do
|
|||||||
L
|
L
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when lockfile has incorrectly indented platforms" do
|
||||||
|
before do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "ffi", "1.1.0" do |s|
|
||||||
|
s.platform = "x86_64-linux"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "ffi", "1.1.0" do |s|
|
||||||
|
s.platform = "arm64-darwin"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
gemfile <<~G
|
||||||
|
source "https://gem.repo4"
|
||||||
|
|
||||||
|
gem "ffi"
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<~L
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo4/
|
||||||
|
specs:
|
||||||
|
ffi (1.1.0-arm64-darwin)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
arm64-darwin
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
ffi
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not remove any gems" do
|
||||||
|
simulate_platform "x86_64-linux" do
|
||||||
|
bundle "lock --update"
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(lockfile).to eq <<~L
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo4/
|
||||||
|
specs:
|
||||||
|
ffi (1.1.0-arm64-darwin)
|
||||||
|
ffi (1.1.0-x86_64-linux)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
arm64-darwin
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
ffi
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user