Homebrew uses Git for downloading updates and contributing to the project. A package definition is known as a formula.
Formulae are organized into various git repositories known as taps. The apache-flink
formula is defined
in the homebrew-core tap.
Brew automatically clones the tap into a git workspace at /usr/local/Library/Taps/homebrew/homebrew-core
.
Creating or updating a formula is accomplished with ordinary git operations in the workspace.
The homebrew formula for apache-flink
points to a specific variant (Hadoop + Scala), summarized as follows:
Version | Hadoop | Scala |
---|---|---|
1.0.2+ | 2.6.0 | 2.10 |
$ brew update
Updated Homebrew from c5520d0 to 2044294.
Updated 1 tap (homebrew/core).
$ cd /usr/local/Library/Taps/homebrew/homebrew-core
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Update the repository configuration with your github information (user.name
, user.email
).
Calculate the SHA-256 hash for the release binary.
$ brew install coreutils
$ gsha256sum ~/Downloads/flink-1.0.3-bin-hadoop26-scala_2.10.tgz
7ace5440681d81c19b4ff191998e35a60dc8b2ce2421a61084f2821befd3b4a2
Create a new branch then open the apache-flink
formula for editing.
$ git checkout -b apache-flink-1.0.3
Switched to a new branch 'apache-flink-1.0.3'
$ vi Formula/apache-flink.rb
Edit the version
, url
, and sha256
fields as necessary.
Homebrew provides a few test procedures that must be executed prior to submission.
Install the package, which will verify the SHA hash.
$ brew uninstall apache-flink
$ brew install apache-flink
==> Downloading https://www.apache.org/dyn/closer.lua?path=flink/flink-1.0.3/flink-1.0.3-bin-hadoop26-scala_2.10.tgz
Already downloaded: /Library/Caches/Homebrew/apache-flink-1.0.3.tgz
🍺 /usr/local/Cellar/apache-flink/1.0.3: 86 files, 89.9M, built in 3 seconds
$ flink --version
Version: 1.0.3, Commit ID: f3a6b5f
Execute the formula's test code, which runs a simple Flink job in the scala shell. No error should occur; unfortunately there's no positive indicator either.
$ brew test apache-flink
Testing apache-flink
...
Audit the formula for style issues. Again, no output is good news.
$ brew audit --strict --online apache-flink
Commit your changes. Note that the formula cookbook prescribes the format of the commit message.
$ git add Formula/apache-flink.rb
$ git commit -m "apache-flink 1.0.3"
1 file changed, 3 insertions(+), 3 deletions(-)
Push to your fork.
$ git push https://github.com/EronWright/homebrew-core.git
Open a PR to be reviewed by the Homebrew maintainers. Example (1.0.3)