From 6bcb41889ef6d246ad443d4e468d64a8a6db37d4 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 19 Jun 2024 16:45:28 +0900 Subject: [PATCH] GH-42197: [CI][Packaging][Java] Ensure updating "python@*" formulae on macOS (#42202) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change macOS GitHub Actions runners have Python not installed by Homebrew at `/usr/local/`. If we install `python@ XXX` Homebrew formula, it tries to overwrite `/usr/local/bin/2to3` and so on and causes a conflict error. NOTE: This is happen only when pre-installed Homebrew `python@ XXX` on macOS GitHub Actions runners is outdated. (`python@ XXX` is updated after macOS GitHub Actions runner image is created.) ### What changes are included in this PR? Ensure updating `pythone@ XXX` with `--overwrite` before we use `brew bundle`. `brew bundle` may update `python@ XXX` automatically without `--overwrite`. FYI: `brew bundle --force ...` will also work. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #42197 Authored-by: Sutou Kouhei Signed-off-by: Raúl Cumplido --- dev/tasks/java-jars/github.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dev/tasks/java-jars/github.yml b/dev/tasks/java-jars/github.yml index eb9478ebaa6ef..43cf3f96442b8 100644 --- a/dev/tasks/java-jars/github.yml +++ b/dev/tasks/java-jars/github.yml @@ -108,6 +108,18 @@ jobs: # llvm@14 because llvm is newer than llvm@14. brew uninstall llvm || : + # Ensure updating python@XXX with the "--overwrite" option. + # If python@XXX is updated without "--overwrite", it causes + # a conflict error. Because Python 3 installed not by + # Homebrew exists in /usr/local on GitHub Actions. If + # Homebrew's python@XXX is updated without "--overwrite", it + # tries to replace /usr/local/bin/2to3 and so on and causes + # a conflict error. + brew update + for python_package in $(brew list | grep python@); do + brew install --overwrite ${python_package} + done + brew bundle --file=arrow/cpp/Brewfile # We want to link aws-sdk-cpp statically but Homebrew's # aws-sdk-cpp provides only shared library. If we have