bottle: Fix bottling for Linux

When there is no previous linux bottle, and the bottle block looks like this:
bottle do
  sha256 "5cbcce4556b41ece91f01778068f481514bc3a0d5447ddbff048797236cc9b29" => :mojave
  sha256 "15748ef1ffefa088f7c958e6935c6eec794781858e6190196e18e94ab768adc2" => :high_sierra
  sha256 "49eb0e5d27b8868b2dba20efbde3ef75becc0cbf5ea230c00e5745e2df697cb6" => :sierra
end

then the bottling fails with:
Error: --keep-old was passed but there are changes in:
cellar: old: "/home/linuxbrew/.linuxbrew/Cellar", new: :any_skip_relocation
==> FAILED

This change allows to run the bottling step for these cases.
This commit is contained in:
Michka Popoff 2018-12-01 10:06:12 +01:00
parent c79deae996
commit af92fe2f17

View File

@ -390,7 +390,10 @@ module Homebrew
mismatches = [:root_url, :prefix, :cellar, :rebuild].reject do |key|
old_spec.send(key) == bottle.send(key)
end
mismatches.delete(:cellar) if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation
if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation
mismatches.delete(:cellar)
bottle.cellar :any
end
unless mismatches.empty?
bottle_path.unlink if bottle_path.exist?