From 0f26522fadebf1e03ec58d678228832e5393a6c7 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 30 Nov 2021 17:31:39 +0800 Subject: [PATCH] rubocops/lines: disallow `pyoxidizer` as a build/runtime dependency PyOxidizer downloads pre-built versions of Rust and Python, and embeds this Python into the binaries it produces. This goes against a number of our packaging policies, so let's make sure formulae in Homebrew/core don't do this. See Homebrew/homebrew-core#90025. --- Library/Homebrew/rubocops/lines.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 5f941a663e..dfbd45d529 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -211,6 +211,32 @@ module RuboCop end end + # This cop makes sure that formulae do not depend on `pyoxidizer` at build-time + # or run-time. + # + # @api private + class PyoxidizerCheck < FormulaCop + def audit_formula(_node, _class_node, _parent_class_node, body_node) + # Disallow use of PyOxidizer as a dependency in core + return unless formula_tap == "homebrew-core" + + find_method_with_args(body_node, :depends_on, "pyoxidizer") do + problem "Formulae in homebrew/core should not use '#{@offensive_node.source}'." + end + + [ + :build, + [:build], + [:build, :test], + [:test, :build], + ].each do |type| + find_method_with_args(body_node, :depends_on, "pyoxidizer" => type) do + problem "Formulae in homebrew/core should not use '#{@offensive_node.source}'." + end + end + end + end + # This cop makes sure that the safe versions of `popen_*` calls are used. # # @api private