From 8f96ba3c1ebe789cbffab207e058ec21001cb4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?fn=20=E2=8C=83=20=E2=8C=A5?= <70830482+FnControlOption@users.noreply.github.com> Date: Thu, 18 Nov 2021 21:53:32 -0800 Subject: [PATCH] extract: remove bottle blocks --- Library/Homebrew/dev-cmd/extract.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index e60675eb88..eb690cc69f 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -64,6 +64,8 @@ module Homebrew module_function + BOTTLE_BLOCK_REGEX = / bottle do.+?end\n\n/m.freeze + sig { returns(CLI::Parser) } def extract_args Homebrew::CLI::Parser.new do @@ -184,7 +186,7 @@ module Homebrew result.sub!("class #{class_name} < Formula", "class #{versioned_name} < Formula") # Remove bottle blocks, they won't work. - result.sub!(/ bottle do.+?end\n\n/m, "") if destination_tap != source_tap + result.sub!(BOTTLE_BLOCK_REGEX, "") path = destination_tap.path/"Formula/#{name}@#{version.to_s.downcase}.rb" if path.exist? @@ -210,6 +212,7 @@ module Homebrew contents = Utils::Git.last_revision_of_file(repo, file, before_commit: rev) contents.gsub!("@url=", "url ") contents.gsub!("require 'brewkit'", "require 'formula'") + contents.sub!(BOTTLE_BLOCK_REGEX, "") with_monkey_patch { Formulary.from_contents(name, file, contents, ignore_errors: true) } end end