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" ```
This commit is contained in:
parent
23ab620cd4
commit
1ab843ba47
@ -256,10 +256,11 @@ module Homebrew
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
# When bumping a linux-only formula,
|
# When bumping a linux-only formula, one needs to also delete the
|
||||||
# one needs to also delete the sha256 linux bottle line.
|
# sha256 linux bottle line if it exists. That's because of running
|
||||||
# That's because of running test-bot with --keep-old option in linuxbrew-core.
|
# test-bot with --keep-old option in linuxbrew-core.
|
||||||
if formula.path.read.include?("depends_on :linux")
|
formula_contents = formula.path.read
|
||||||
|
if formula_contents.include?("depends_on :linux") && formula_contents.include?("=> :x86_64_linux")
|
||||||
replacement_pairs << [
|
replacement_pairs << [
|
||||||
/^ sha256 ".+" => :x86_64_linux\n/m,
|
/^ sha256 ".+" => :x86_64_linux\n/m,
|
||||||
"\\2",
|
"\\2",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user