diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 213883b22d2..37253370022 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -683,6 +683,12 @@ jobs: # allowed in official Homebrew taps. Remove it so the formula can be installed from # this local dev tap. It must remain in the released formula, so we only strip it here. sed -i '' '/no_autobump!/d' $(brew --repository)/Library/Taps/dev/homebrew-azure-cli/Formula/azure-cli.rb + # TODO(packaging): remove once the macOS CI agent image's Homebrew provides formula_opt_prefix. + # The upstream homebrew-core formula calls `formula_opt_prefix("openssl@3")`, a newer + # Homebrew DSL helper not available on the older Homebrew on the macOS CI agent image + # (NoMethodError). Rewrite it to the backward-compatible `Formula["openssl@3"].opt_prefix` + # form for the local test install only; the generated/submitted formula stays upstream-faithful. + sed -E -i '' 's/formula_opt_prefix\(?[[:space:]]*"([^"]+)"[[:space:]]*\)?/Formula["\1"].opt_prefix/g' $(brew --repository)/Library/Taps/dev/homebrew-azure-cli/Formula/azure-cli.rb brew install --build-from-source dev/homebrew-azure-cli/azure-cli echo == Az Version == diff --git a/scripts/release/homebrew/test_homebrew_package.sh b/scripts/release/homebrew/test_homebrew_package.sh index f55d9ab5074..c0471691cef 100755 --- a/scripts/release/homebrew/test_homebrew_package.sh +++ b/scripts/release/homebrew/test_homebrew_package.sh @@ -8,6 +8,12 @@ echo == Remove pre-installed azure-cli == brew uninstall azure-cli echo == Install azure-cli.rb formula == +# TODO(packaging): remove once the macOS CI agent image's Homebrew provides formula_opt_prefix. +# The upstream homebrew-core formula calls `formula_opt_prefix("openssl@3")`, a newer +# Homebrew DSL helper not available on the older Homebrew on the macOS CI agent image +# (NoMethodError). Rewrite it to the backward-compatible `Formula["openssl@3"].opt_prefix` +# form for the local test install only; the generated/submitted formula stays upstream-faithful. +sed -E -i '' 's/formula_opt_prefix\(?[[:space:]]*"([^"]+)"[[:space:]]*\)?/Formula["\1"].opt_prefix/g' $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb AZ_BASE=/usr/local/Cellar/azure-cli/$CLI_VERSION/libexec