From 3c4f9c746e88eb70eb8e4ac1245bd727e968f148 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Tue, 11 Sep 2018 14:16:27 -0700 Subject: [PATCH] Elide prefix "/usr/local" in bottle block brew test-bot --ci-upload is run on a Linux machine. The macOS bottles have a prefix of "/usr/local". The default prefix on Linux is /home/linuxbrew/.linuxbrew. Elide prefix "/usr/local" in the bottle block, even it does not match the default prefix. Ditto for cellar. --- Library/Homebrew/dev-cmd/bottle.rb | 4 ++-- Library/Homebrew/global.rb | 2 ++ Library/Homebrew/software_spec.rb | 5 ++--- Library/Homebrew/system_config.rb | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 24af39d15b..5d9f28154c 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -44,12 +44,12 @@ BOTTLE_ERB = <<-EOS.freeze <% if !root_url.start_with?(HOMEBREW_BOTTLE_DEFAULT_DOMAIN) %> root_url "<%= root_url %>" <% end %> - <% if prefix != BottleSpecification::DEFAULT_PREFIX %> + <% if ![Homebrew::DEFAULT_PREFIX, "/usr/local"].include?(prefix) %> prefix "<%= prefix %>" <% end %> <% if cellar.is_a? Symbol %> cellar :<%= cellar %> - <% elsif cellar != BottleSpecification::DEFAULT_CELLAR %> + <% elsif ![Homebrew::DEFAULT_CELLAR, "/usr/local/Cellar"].include?(cellar) %> cellar "<%= cellar %>" <% end %> <% if rebuild.positive? %> diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 72a785bed5..c6bddb5198 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -49,6 +49,8 @@ module Homebrew extend FileUtils DEFAULT_PREFIX ||= "/usr/local".freeze + DEFAULT_CELLAR = "#{DEFAULT_PREFIX}/Cellar".freeze + DEFAULT_REPOSITORY = "#{DEFAULT_PREFIX}/Homebrew".freeze class << self attr_writer :failed, :raise_deprecation_exceptions, :auditing, :args diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 74b5513c39..10a788aafa 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -327,7 +327,6 @@ end class BottleSpecification DEFAULT_PREFIX = Homebrew::DEFAULT_PREFIX - DEFAULT_CELLAR = "#{DEFAULT_PREFIX}/Cellar".freeze attr_rw :prefix, :cellar, :rebuild attr_accessor :tap @@ -335,8 +334,8 @@ class BottleSpecification def initialize @rebuild = 0 - @prefix = DEFAULT_PREFIX - @cellar = DEFAULT_CELLAR + @prefix = Homebrew::DEFAULT_PREFIX + @cellar = Homebrew::DEFAULT_CELLAR @collector = Utils::Bottles::Collector.new @root_url_specs = {} end diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index 6e6f29a127..4d26c6edbb 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -113,8 +113,8 @@ class SystemConfig end defaults_hash = { HOMEBREW_PREFIX: Homebrew::DEFAULT_PREFIX, - HOMEBREW_REPOSITORY: "#{Homebrew::DEFAULT_PREFIX}/Homebrew", - HOMEBREW_CELLAR: "#{Homebrew::DEFAULT_PREFIX}/Cellar", + HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY, + HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR, HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew", HOMEBREW_RUBY_WARNINGS: "-W0", HOMEBREW_TEMP: ENV["HOMEBREW_SYSTEM_TEMP"],