- We have some Linux-only formulae that don't have bottles.
- Previously, bumping a Linux-only formula that didn't have a bottle
line - eg, `adoptopenjdk` which is `bottle :unneeded` - would fail:
```
Error: inreplace failed
/app/linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/adoptopenjdk.rb:
expected replacement of /^ sha256 ".+" => :x86_64_linux\n/m with "\2"
```
- We used to use `# tag "linux"` in Homebrew/linuxbrew-core for the ~50
Linux-only formulae. As of
6578a4aa86,
we're using `depends_on :linux` to have a consistent syntax between
Linux and macOS.
- Therefore, we have to change the search string for Linux-only formulae
that determines whether or not `brew bump-formula-pr` deletes the bottle
line.
- The `--local` option doesn't exist in early versions of git (~1.7),
but its behaviour is the default (saving in the current repo's .git
directory).
- As it's the default across versions, we don't need to specify it
everywhere.
- Reported in Linuxbrew/install issue 78.
This commit makes it possible to use `bump-formula-pr` on linux to
contribute to `homebrew-core` as easily as it is on macOS, but with some
additional steps made before actual bumping of the formula.
Differences in the process (before bumping):
- add `homebrew-core` remote named `homebrew`
- fetch `homebrew/master`
- check if formula exists in `homebrew-core`
- switch to `homebrew/master` ref
This saves an API call, and is more accurate, because the repo API
doesn't actually say whether forking is enabled, but this error message
does.
To do this, the original GitHub error message had to be accessible on
the GitHub exceptions.
GitHub seems to be discouraging forking private repositories[0]:
> By default, new organizations are configured to disallow the forking
> of private repositories.
bump-formula-pr tries to create its pull requests from a fork, so it
can't be used for private taps set up in this way.
I've added a --no-fork option that will create PRs in the tap repo
itself, rather than in a fork, to accommodate this use case.
[0]: https://help.github.com/articles/allowing-people-to-fork-private-repositories-in-your-organization/