Skip to content

Commit b5d90b6

Browse files
iajoinerandygrove
andauthored
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 <[email protected]> * update homebrew publishing docs * add token-related instructions * doc prettier compliance Co-authored-by: Andy Grove <[email protected]>
1 parent e3f0fce commit b5d90b6

2 files changed

Lines changed: 45 additions & 4 deletions

File tree

‎dev/release/README.md‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,45 @@ The CLI needs a `--no-verify` argument because `build.rs` generates source into
317317

318318
### Publish datafusion-cli on Homebrew
319319

320-
Run `publish_homebrew.sh` to publish `datafusion-cli` on Homebrew.
320+
Run `publish_homebrew.sh` to publish `datafusion-cli` on Homebrew. In order to do so it is necessary to
321+
fork the `homebrew-core` repo https://github.com/Homebrew/homebrew-core/, have Homebrew installed on your
322+
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.
321323

324+
#### Fork the `homebrew-core` repo
325+
326+
Go to https://github.com/Homebrew/homebrew-core/ and fork the repo.
327+
328+
#### Install and configure Homebrew
329+
330+
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.
331+
332+
Before running the script make sure that you can run the following command in your bash to make sure
333+
that `brew` has been installed and configured properly:
334+
335+
```bash
336+
brew --version
322337
```
338+
339+
#### Create a Github Personal Access Token
340+
341+
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.
342+
343+
- Make sure to select either **All repositories** or **Only selected repositories** so that you have access to **Repository permissions**.
344+
- If you only use the token for selected repos make sure you include your
345+
fork of `homebrew-core` in the list of repos under **Selected repositories**.
346+
- Make sure to have **Read and write** access enabled for pull requests in your **Repository permissions**.
347+
348+
After all of the above is complete execute the following command:
349+
350+
```bash
323351
dev/release/publish_homebrew.sh <version> <github-user> <github-token> <homebrew-default-branch-name>
324352
```
325353

326-
Alternatively manually send a simple PR to update tag and commit hash for the datafusion
354+
Note that sometimes someone else has already submitted a PR to update the datafusion formula in homebrew.
355+
In this case you will get an error with a message that your PR is a duplicate of an existing one. In this
356+
case no further action is required.
357+
358+
Alternatively manually submit a simple PR to update tag and commit hash for the datafusion
327359
formula in homebrew-core. Here is an example PR:
328360
https://github.com/Homebrew/homebrew-core/pull/89562.
329361

‎dev/release/publish_homebrew.sh‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
set -ue
2121

22-
if [ "$#" -ne 3 ]; then
22+
if [ "$#" -ne 4 ]; then
2323
echo "Usage: $0 <version> <github-user> <github-token> <homebrew-default-branch-name>"
2424
exit 1
2525
fi
@@ -30,6 +30,15 @@ github_token=$3
3030
# Prepare for possible renaming of the default branch on Homebrew
3131
homebrew_default_branch_name=$4
3232

33+
# Git parallel fetch
34+
if sysctl -n hw.ncpu 2>/dev/null; then # macOS
35+
num_processing_units=$(sysctl -n hw.ncpu)
36+
elif [ -x "$(command -v nproc)" ]; then # Linux
37+
num_processing_units=$(nproc)
38+
else # Fallback
39+
num_processing_units=1
40+
fi
41+
3342
url="https://www.apache.org/dyn/closer.lua?path=arrow/arrow-datafusion-${version}/apache-arrow-datafusion-${version}.tar.gz"
3443
sha256="$(curl https://dist.apache.org/repos/dist/release/arrow/arrow-datafusion-${version}/apache-arrow-datafusion-${version}.tar.gz.sha256 | cut -d' ' -f1)"
3544

@@ -41,7 +50,7 @@ if ! git remote | grep -q --fixed-strings ${github_user}; then
4150
fi
4251

4352
echo "Updating working copy"
44-
git fetch --all --prune --tags --force -j$(nproc)
53+
git fetch --all --prune --tags --force -j$num_processing_units
4554

4655
branch=apache-arrow-datafusion-${version}
4756
echo "Creating branch: ${branch}"

0 commit comments

Comments
 (0)