| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | # Maintainer Guidelines
 | 
					
						
							| 
									
										
										
										
											2017-01-04 16:16:00 -06:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | **This guide is for maintainers.** These special people have **write | 
					
						
							|  |  |  |  | access** to Homebrew’s repository and help merge the contributions of | 
					
						
							|  |  |  |  | others. You may find what is written here interesting, but it’s | 
					
						
							|  |  |  |  | definitely not a beginner’s guide. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Maybe you were looking for the [Formula Cookbook](Formula-Cookbook.md)? | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | ## Quick checklist
 | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | This is all that really matters: | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | - Ensure the name seems reasonable. | 
					
						
							|  |  |  |  | - Add aliases. | 
					
						
							| 
									
										
										
										
											2017-07-24 21:28:29 -04:00
										 |  |  |  | - Ensure it uses `keg_only :provided_by_macos` if it already comes with macOS. | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | - Ensure it is not a library that can be installed with | 
					
						
							|  |  |  |  |   [gem](https://en.wikipedia.org/wiki/RubyGems), | 
					
						
							|  |  |  |  |   [cpan](https://en.wikipedia.org/wiki/Cpan) or | 
					
						
							| 
									
										
										
										
											2015-08-11 16:42:05 +08:00
										 |  |  |  |   [pip](https://pip.pypa.io/en/stable/). | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | - Ensure that any dependencies are accurate and minimal. We don't need to | 
					
						
							|  |  |  |  |   support every possible optional feature for the software. | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | - Use the GitHub squash & merge workflow where bottles aren't required. | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | - Use `brew pull` otherwise, which adds messages to auto-close pull requests and pull bottles built by the Brew Test Bot. | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | - Thank people for contributing. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Checking dependencies is important, because they will probably stick around | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | forever. Nobody really checks if they are necessary or not. Use the | 
					
						
							|  |  |  |  | `:optional` and `:recommended` modifiers as appropriate. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | Depend on as little stuff as possible. Disable X11 functionality by default. | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | For example, we build Wireshark, but not the heavy GTK/Qt GUI by default. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | Homebrew is about Unix software. Stuff that builds to an `.app` should | 
					
						
							| 
									
										
										
										
											2015-12-06 22:18:16 +00:00
										 |  |  |  | probably be in Homebrew Cask instead. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | ### Naming
 | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | The name is the strictest item, because avoiding a later name change is | 
					
						
							|  |  |  |  | desirable. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-06 22:18:16 +00:00
										 |  |  |  | Choose a name that’s the most common name for the project. | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | For example, we initially chose `objective-caml` but we should have chosen `ocaml`. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | Choose what people say to each other when talking about the project. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | Add other names as aliases as symlinks in `Aliases` in the tap root. Ensure the | 
					
						
							|  |  |  |  | name referenced on the homepage is one of these, as it may be different and have | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | underscores and hyphens and so on. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-24 21:28:29 -04:00
										 |  |  |  | We now accept versioned formulae as long as they [meet the requirements](Versions.md). | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | ### Merging, rebasing, cherry-picking
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | Merging should be done in the `Homebrew/brew` repository to preserve history & GPG commit signing, | 
					
						
							| 
									
										
										
										
											2016-09-14 19:53:35 +01:00
										 |  |  |  | and squash/merge via GitHub should be used for formulae where those formulae | 
					
						
							|  |  |  |  | don't need bottles or the change does not require new bottles to be pulled. | 
					
						
							|  |  |  |  | Otherwise, you should use `brew pull` (or `rebase`/`cherry-pick` contributions). | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | Don’t `rebase` until you finally `push`. Once `master` is pushed, you can’t | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | `rebase`: **you’re a maintainer now!** | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | Cherry-picking changes the date of the commit, which kind of sucks. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | Don’t `merge` unclean branches. So if someone is still learning `git` and | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | their branch is filled with nonsensical merges, then `rebase` and squash | 
					
						
							|  |  |  |  | the commits. Our main branch history should be useful to other people, | 
					
						
							|  |  |  |  | not confusing. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ### Testing
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot.md) for this. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | Verify the formula works if possible. If you can’t tell (e.g. if it’s a | 
					
						
							|  |  |  |  | library) trust the original contributor, it worked for them, so chances are it | 
					
						
							|  |  |  |  | is fine. If you aren’t an expert in the tool in question, you can’t really | 
					
						
							|  |  |  |  | gauge if the formula installed the program correctly. At some point an expert | 
					
						
							|  |  |  |  | will come along, cry blue murder that it doesn’t work, and fix it. This is how | 
					
						
							|  |  |  |  | open source works. Ideally, request a `test do` block to test that | 
					
						
							|  |  |  |  | functionality is consistently available. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | If the formula uses a repository, then the `url` parameter should have a | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | tag or revision. `url`s have versions and are stable (not yet | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | implemented!). | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | ## Common “gotchas”
 | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 1.  [Ensure you have set your username and email address | 
					
						
							| 
									
										
										
										
											2015-01-04 04:27:16 +01:00
										 |  |  |  |     properly](https://help.github.com/articles/setting-your-email-in-git/) | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | 2.  Sign off cherry-picks if you amended them ([GitX-dev](https://github.com/rowanj/gitx) | 
					
						
							|  |  |  |  |     can do this, otherwise there is a command-line flag for it) | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 3.  If the commit fixes a bug, use “Fixes \#104” syntax to close the bug | 
					
						
							|  |  |  |  |     report and link to the commit | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | ### Duplicates
 | 
					
						
							| 
									
										
										
										
											2017-07-24 21:28:29 -04:00
										 |  |  |  | We now accept stuff that comes with macOS as long as it uses `keg_only :provided_by_macos` to be keg-only by default. | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:45:12 -04:00
										 |  |  |  | ### Add comments
 | 
					
						
							|  |  |  |  | It may be enough to refer to an issue ticket, but make sure changes are clear so that | 
					
						
							|  |  |  |  | if you came to them unaware of the surrounding issues they would make sense | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | to you. Many times on other projects I’ve seen code removed because the | 
					
						
							|  |  |  |  | new guy didn’t know why it was there. Regressions suck. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ### Don’t allow bloated diffs
 | 
					
						
							|  |  |  |  | Amend a cherry-pick to remove commits that are only changes in | 
					
						
							|  |  |  |  | whitespace. They are not acceptable because our history is important and | 
					
						
							|  |  |  |  | `git blame` should be useful. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-27 11:10:06 +01:00
										 |  |  |  | Whitespace corrections (to Ruby standard etc.) are allowed (in fact this | 
					
						
							| 
									
										
										
										
											2014-10-26 14:54:36 +00:00
										 |  |  |  | is a good opportunity to do it) provided the line itself has some kind | 
					
						
							|  |  |  |  | of modification that is not whitespace in it. But be careful about | 
					
						
							|  |  |  |  | making changes to inline patches—make sure they still apply. |