From facd76bc51a68c66ca7c5b02840614472466c8f6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 29 Jun 2018 19:51:18 +0100 Subject: [PATCH] portable-ruby: respect HOMEBREW_BOTTLE_DOMAIN variable. This was requested in: https://discourse.brew.sh/t/adding-additional-download-sources-to-homebrew/2446 With this change you can use e.g. Artifactory for Homebrew's portable ruby. --- Library/Homebrew/brew.sh | 6 ++++++ Library/Homebrew/cmd/vendor-install.sh | 6 +++--- Library/Homebrew/dev-cmd/bottle.rb | 2 +- Library/Homebrew/global.rb | 3 +++ Library/Homebrew/software_spec.rb | 3 +-- Library/Homebrew/system_config.rb | 2 ++ 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 984571de1f..6173638b30 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -264,6 +264,12 @@ then export HOMEBREW_RUBY_WARNINGS="-W0" fi +export HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://homebrew.bintray.com" +if [[ -z "$HOMEBREW_BOTTLE_DOMAIN" ]] +then + export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN" +fi + if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]] then HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index bea320f711..2c06f41db3 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -13,7 +13,7 @@ if [[ -n "$HOMEBREW_MACOS" ]] then if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]] then - ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz" + ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz" ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3_2/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz" ruby_SHA="f1db8863543d256e6a8e704bf618025030b3d22a7a6b19749d19f599b5554212" fi @@ -21,12 +21,12 @@ elif [[ -n "$HOMEBREW_LINUX" ]] then case "$HOMEBREW_PROCESSOR" in x86_64) - ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3_2.x86_64_linux.bottle.tar.gz" + ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.3_2.x86_64_linux.bottle.tar.gz" ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3_2/portable-ruby-2.3.3_2.x86_64_linux.bottle.tar.gz" ruby_SHA="b5c320c1bc2c4d42d4674643855c582ba2772fc951689d298ee079b74bac29a7" ;; armv[67]*) - ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3_2.armv6_linux.bottle.tar.gz" + ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.3_2.armv6_linux.bottle.tar.gz" ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3_2/portable-ruby-2.3.3_2.armv6_linux.bottle.tar.gz" ruby_SHA="6ac992c4620912b50b3c74f2d4447d541bac4f1839e557c3edcfdebb141c9802" ;; diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index a521c53308..ef01f1d3d6 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -42,7 +42,7 @@ require "erb" BOTTLE_ERB = <<-EOS.freeze bottle do - <% if !root_url.start_with?(BottleSpecification::DEFAULT_DOMAIN) %> + <% if !root_url.start_with?(HOMEBREW_BOTTLE_DEFAULT_DOMAIN) %> root_url "<%= root_url %>" <% end %> <% if prefix != BottleSpecification::DEFAULT_PREFIX %> diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 49f0e0f566..5eda607832 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -25,6 +25,9 @@ HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"] HOMEBREW_USER_AGENT_RUBY = "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".freeze HOMEBREW_USER_AGENT_FAKE_SAFARI = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8".freeze +HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"] +HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"] + require "extend/fileutils" module Homebrew diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index ce3cac8064..d0a104bb7a 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -327,7 +327,6 @@ end class BottleSpecification DEFAULT_PREFIX = "/usr/local".freeze DEFAULT_CELLAR = "/usr/local/Cellar".freeze - DEFAULT_DOMAIN = (ENV["HOMEBREW_BOTTLE_DOMAIN"] || "https://homebrew.bintray.com").freeze attr_rw :prefix, :cellar, :rebuild attr_accessor :tap @@ -343,7 +342,7 @@ class BottleSpecification def root_url(var = nil, specs = {}) if var.nil? - @root_url ||= "#{DEFAULT_DOMAIN}/#{Utils::Bottles::Bintray.repository(tap)}" + @root_url ||= "#{HOMEBREW_BOTTLE_DOMAIN}/#{Utils::Bottles::Bintray.repository(tap)}" else @root_url = var @root_url_specs.merge!(specs) diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index f42572add0..512ca16d54 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -124,6 +124,8 @@ class SystemConfig HOMEBREW_ANALYTICS_ID HOMEBREW_ANALYTICS_USER_UUID HOMEBREW_AUTO_UPDATE_CHECKED + HOMEBREW_BOTTLE_DEFAULT_DOMAIN + HOMEBREW_BOTTLE_DOMAIN HOMEBREW_BREW_FILE HOMEBREW_COMMAND_DEPTH HOMEBREW_CURL