You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ag...@apache.org on 2023/01/24 23:56:02 UTC

[arrow-datafusion] branch master updated: Fix homebrew publish script (#5044)

This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new b5d90b6cb Fix homebrew publish script (#5044)
b5d90b6cb is described below

commit b5d90b6cb936a43b59dbb43e69f22c0e7b1b03ee
Author: Ian Alexander Joiner <14...@users.noreply.github.com>
AuthorDate: Tue Jan 24 18:55:55 2023 -0500

    Fix homebrew publish script (#5044)
    
    * fix homebrew publish script
    
    * fixed num_processing_units in the script
    
    * Update dev/release/publish_homebrew.sh
    
    Co-authored-by: Andy Grove <an...@gmail.com>
    
    * update homebrew publishing docs
    
    * add token-related instructions
    
    * doc prettier compliance
    
    Co-authored-by: Andy Grove <an...@gmail.com>
---
 dev/release/README.md           | 36 ++++++++++++++++++++++++++++++++++--
 dev/release/publish_homebrew.sh | 13 +++++++++++--
 2 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/dev/release/README.md b/dev/release/README.md
index 07dd3c4c6..ce9467fec 100644
--- a/dev/release/README.md
+++ b/dev/release/README.md
@@ -317,13 +317,45 @@ The CLI needs a `--no-verify` argument because `build.rs` generates source into
 
 ### Publish datafusion-cli on Homebrew
 
-Run `publish_homebrew.sh` to publish `datafusion-cli` on Homebrew.
+Run `publish_homebrew.sh` to publish `datafusion-cli` on Homebrew. In order to do so it is necessary to
+fork the `homebrew-core` repo https://github.com/Homebrew/homebrew-core/, have Homebrew installed on your
+macOS/Linux/WSL2 and properly configured and have a Github Personal Access Token that has permission to file pull requests in the `homebrew-core` repo.
 
+#### Fork the `homebrew-core` repo
+
+Go to https://github.com/Homebrew/homebrew-core/ and fork the repo.
+
+#### Install and configure Homebrew
+
+Please visit https://brew.sh/ to obtain Homebrew. In addition to that please check out https://docs.brew.sh/Homebrew-on-Linux if you are on Linux or WSL2.
+
+Before running the script make sure that you can run the following command in your bash to make sure
+that `brew` has been installed and configured properly:
+
+```bash
+brew --version
 ```
+
+#### Create a Github Personal Access Token
+
+To create a Github Personal Access Token, please visit https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token for instructions.
+
+- Make sure to select either **All repositories** or **Only selected repositories** so that you have access to **Repository permissions**.
+- If you only use the token for selected repos make sure you include your
+  fork of `homebrew-core` in the list of repos under **Selected repositories**.
+- Make sure to have **Read and write** access enabled for pull requests in your **Repository permissions**.
+
+After all of the above is complete execute the following command:
+
+```bash
 dev/release/publish_homebrew.sh <version> <github-user> <github-token> <homebrew-default-branch-name>
 ```
 
-Alternatively manually send a simple PR to update tag and commit hash for the datafusion
+Note that sometimes someone else has already submitted a PR to update the datafusion formula in homebrew.
+In this case you will get an error with a message that your PR is a duplicate of an existing one. In this
+case no further action is required.
+
+Alternatively manually submit a simple PR to update tag and commit hash for the datafusion
 formula in homebrew-core. Here is an example PR:
 https://github.com/Homebrew/homebrew-core/pull/89562.
 
diff --git a/dev/release/publish_homebrew.sh b/dev/release/publish_homebrew.sh
index 876a974e9..1cf7160d4 100644
--- a/dev/release/publish_homebrew.sh
+++ b/dev/release/publish_homebrew.sh
@@ -19,7 +19,7 @@
 
 set -ue
 
-if [ "$#" -ne 3 ]; then
+if [ "$#" -ne 4 ]; then
   echo "Usage: $0 <version> <github-user> <github-token> <homebrew-default-branch-name>"
   exit 1
 fi
@@ -30,6 +30,15 @@ github_token=$3
 # Prepare for possible renaming of the default branch on Homebrew
 homebrew_default_branch_name=$4
 
+# Git parallel fetch
+if sysctl -n hw.ncpu 2>/dev/null; then # macOS
+  num_processing_units=$(sysctl -n hw.ncpu)
+elif [ -x "$(command -v nproc)" ]; then # Linux
+  num_processing_units=$(nproc)
+else # Fallback
+  num_processing_units=1
+fi
+
 url="https://www.apache.org/dyn/closer.lua?path=arrow/arrow-datafusion-${version}/apache-arrow-datafusion-${version}.tar.gz"
 sha256="$(curl https://dist.apache.org/repos/dist/release/arrow/arrow-datafusion-${version}/apache-arrow-datafusion-${version}.tar.gz.sha256 | cut -d' ' -f1)"
 
@@ -41,7 +50,7 @@ if ! git remote | grep -q --fixed-strings ${github_user}; then
 fi
 
 echo "Updating working copy"
-git fetch --all --prune --tags --force -j$(nproc)
+git fetch --all --prune --tags --force -j$num_processing_units
 
 branch=apache-arrow-datafusion-${version}
 echo "Creating branch: ${branch}"