From 623eeb4e47fc7f19fd2f1c6217e61b0384f279e2 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Thu, 6 Jul 2023 17:33:49 +0100 Subject: [PATCH] cmd/update-report: tweak messages for CI --- Dockerfile | 3 ++- Library/Homebrew/cmd/update-report.rb | 17 ++++++++++------- bin/brew | 5 +++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c92a9a0f8..26e84d2da4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,4 +77,5 @@ RUN mkdir -p \ && brew cleanup \ && { git -C .linuxbrew/Homebrew config --unset gc.auto; true; } \ && { git -C .linuxbrew/Homebrew config --unset homebrew.devcmdrun; true; } \ - && rm -rf .cache + && rm -rf .cache \ + && touch .linuxbrew/.homebrewdocker diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index a1088b3c5a..ef58ff4c58 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -376,16 +376,17 @@ module Homebrew api_auto_update_secs = Homebrew::EnvConfig.api_auto_update_secs.to_i api_auto_update_secs_default = Homebrew::EnvConfig::ENVS.fetch(:HOMEBREW_API_AUTO_UPDATE_SECS).fetch(:default) auto_update_secs_set = api_auto_update_secs.positive? && api_auto_update_secs != api_auto_update_secs_default - if !Homebrew::EnvConfig.no_auto_update? && !Homebrew::EnvConfig.no_install_from_api? && !auto_update_secs_set - return - end + no_auto_update_set = Homebrew::EnvConfig.no_auto_update? && + !ENV["HOMEBREW_GITHUB_HOSTED_RUNNER"] && + !ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"] + no_install_from_api_set = Homebrew::EnvConfig.no_install_from_api? && + !Homebrew::EnvConfig.automatically_set_no_install_from_api? + return if !no_auto_update_set && !no_install_from_api_set && !auto_update_secs_set ohai "You have set:" - puts " HOMEBREW_NO_AUTO_UPDATE" if Homebrew::EnvConfig.no_auto_update? + puts " HOMEBREW_NO_AUTO_UPDATE" if no_auto_update_set puts " HOMEBREW_API_AUTO_UPDATE_SECS" if auto_update_secs_set - if Homebrew::EnvConfig.no_install_from_api? && !Homebrew::EnvConfig.automatically_set_no_install_from_api? - puts " HOMEBREW_NO_INSTALL_FROM_API" - end + puts " HOMEBREW_NO_INSTALL_FROM_API" if no_install_from_api_set puts "but we have dramatically sped up and fixed many bugs in the way we do Homebrew updates since." puts "Please consider unsetting these and tweaking the values based on the new behaviour." puts "\n\n" @@ -397,6 +398,8 @@ module Homebrew def untap_message return if Homebrew::EnvConfig.no_install_from_api? return if Homebrew::EnvConfig.developer? || ENV["HOMEBREW_DEV_CMD_RUN"] + return if ENV["HOMEBREW_GITHUB_HOSTED_RUNNER"] || ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"] + return if (HOMEBREW_PREFIX/".homebrewdocker").exist? core_tap = CoreTap.instance cask_tap = Tap.default_cask_tap diff --git a/bin/brew b/bin/brew index 18a4c2d333..afc02e9eb8 100755 --- a/bin/brew +++ b/bin/brew @@ -139,6 +139,11 @@ then export CI="1" fi +if [[ -n "${GITHUB_ACTIONS:-}" && -n "${ImageOS:-}" && -n "${ImageVersion:-}" ]] +then + export HOMEBREW_GITHUB_HOSTED_RUNNER=1 +fi + # filter the user environment PATH="/usr/bin:/bin:/usr/sbin:/sbin"