Skip to content
Snippets Groups Projects
Unverified Commit 1ab843ba authored by Issy Long's avatar Issy Long
Browse files

bump-formula-pr: Only delete Linux bottle line if it exists

- 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"
```
parent 23ab620c
No related branches found
No related tags found
No related merge requests found
......@@ -256,10 +256,11 @@ module Homebrew
]
end
# When bumping a linux-only formula,
# one needs to also delete the sha256 linux bottle line.
# That's because of running test-bot with --keep-old option in linuxbrew-core.
if formula.path.read.include?("depends_on :linux")
# When bumping a linux-only formula, one needs to also delete the
# sha256 linux bottle line if it exists. That's because of running
# test-bot with --keep-old option in linuxbrew-core.
formula_contents = formula.path.read
if formula_contents.include?("depends_on :linux") && formula_contents.include?("=> :x86_64_linux")
replacement_pairs << [
/^ sha256 ".+" => :x86_64_linux\n/m,
"\\2",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment