diff options
52 files changed, 572 insertions, 241 deletions
diff --git a/.travis.yml b/.travis.yml index a5cf08cd9..b9549eb16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ cache: - $HOME/.gem/ruby - $HOME/Library/Caches/Homebrew/style - $HOME/Library/Caches/Homebrew/tests - - Library/Homebrew/vendor/bundle matrix: include: diff --git a/Library/.auditcops.yml b/Library/.auditcops.yml new file mode 100644 index 000000000..b5b7a8b58 --- /dev/null +++ b/Library/.auditcops.yml @@ -0,0 +1,5 @@ +inherit_from: + - ./.rubocop.yml + +NewFormulaAudit: + Enabled: true diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index dbff189ef..cb065a1a4 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -6,35 +6,14 @@ AllCops: require: ./Homebrew/rubocops.rb -FormulaAudit/Text: +FormulaAudit: Enabled: true -FormulaAudit/Caveats: +FormulaAuditStrict: Enabled: true -FormulaAudit/Checksum: - Enabled: true - -FormulaAudit/ChecksumCase: - Enabled: true - -FormulaAuditStrict/BottleBlock: - Enabled: true - -FormulaAuditStrict/Desc: - Enabled: true - -FormulaAuditStrict/ComponentsOrder: - Enabled: true - -FormulaAuditStrict/ComponentsRedundancy: - Enabled: true - -FormulaAudit/Homepage: - Enabled: true - -FormulaAudit/LegacyPatches: - Enabled: true +NewFormulaAudit: + Enabled: false # `system` is a special case and aligns on second argument Layout/AlignParameters: diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 11ea8df67..ec86bd794 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -11,7 +11,9 @@ raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent require "English" -$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s) +unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) + $LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s) +end require "global" require "tap" diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 97c3b7f86..638e9dc19 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -1,4 +1,4 @@ -HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty 2>/dev/null)" +HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)" HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION" if [[ -z "$HOMEBREW_VERSION" ]] then diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index c0f15158d..8dd4fb245 100644 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -102,53 +102,52 @@ class Build end end - old_tmpdir = ENV["TMPDIR"] - old_temp = ENV["TEMP"] - old_tmp = ENV["TMP"] - ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP + new_env = { + "TMPDIR" => HOMEBREW_TEMP, + "TEMP" => HOMEBREW_TEMP, + "TMP" => HOMEBREW_TEMP, + } - formula.extend(Debrew::Formula) if ARGV.debug? + with_env(new_env) do + formula.extend(Debrew::Formula) if ARGV.debug? - formula.brew do |_formula, staging| - staging.retain! if ARGV.keep_tmp? - formula.patch - - if ARGV.git? - system "git", "init" - system "git", "add", "-A" - end - if ARGV.interactive? - ohai "Entering interactive mode" - puts "Type `exit' to return and finalize the installation" - puts "Install to this prefix: #{formula.prefix}" + formula.brew do |_formula, staging| + staging.retain! if ARGV.keep_tmp? + formula.patch if ARGV.git? - puts "This directory is now a git repo. Make your changes and then use:" - puts " git diff | pbcopy" - puts "to copy the diff to the clipboard." + system "git", "init" + system "git", "add", "-A" + end + if ARGV.interactive? + ohai "Entering interactive mode" + puts "Type `exit' to return and finalize the installation" + puts "Install to this prefix: #{formula.prefix}" + + if ARGV.git? + puts "This directory is now a git repo. Make your changes and then use:" + puts " git diff | pbcopy" + puts "to copy the diff to the clipboard." + end + + interactive_shell(formula) + else + formula.prefix.mkpath + + (formula.logs/"00.options.out").write \ + "#{formula.full_name} #{formula.build.used_options.sort.join(" ")}".strip + formula.install + + stdlibs = detect_stdlibs(ENV.compiler) + tab = Tab.create(formula, ENV.compiler, stdlibs.first) + tab.write + + # Find and link metafiles + formula.prefix.install_metafiles formula.buildpath + formula.prefix.install_metafiles formula.libexec if formula.libexec.exist? end - - interactive_shell(formula) - else - formula.prefix.mkpath - - (formula.logs/"00.options.out").write \ - "#{formula.full_name} #{formula.build.used_options.sort.join(" ")}".strip - formula.install - - stdlibs = detect_stdlibs(ENV.compiler) - tab = Tab.create(formula, ENV.compiler, stdlibs.first) - tab.write - - # Find and link metafiles - formula.prefix.install_metafiles formula.buildpath - formula.prefix.install_metafiles formula.libexec if formula.libexec.exist? end end - ensure - ENV["TMPDIR"] = old_tmpdir - ENV["TEMP"] = old_temp - ENV["TMP"] = old_tmp end def detect_stdlibs(compiler) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index e413bac6f..da48582d2 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -1,4 +1,4 @@ -#: * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=`<compiler>] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] <formula>: +#: * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=`<compiler>] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] <formula> [<options> ...]: #: Install <formula>. #: #: <formula> is usually the name of the formula to install, but it can be specified @@ -47,6 +47,9 @@ #: If `--build-bottle` is passed, prepare the formula for eventual bottling #: during installation. #: +#: Installation options specific to <formula> may be appended to the command, +#: and can be listed with `brew options` <formula>. +#: #: * `install` `--interactive` [`--git`] <formula>: #: If `--interactive` (or `-i`) is passed, download and patch <formula>, then #: open a shell. This allows the user to run `./configure --help` and diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 7158fe5b9..b0f46fadc 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -47,7 +47,9 @@ module Homebrew elsif !except_cops.empty? options[:except_cops] = except_cops elsif only_cops.empty? && except_cops.empty? - options[:except_cops] = %w[FormulaAuditStrict FormulaAudit] + options[:except_cops] = %w[FormulaAudit + FormulaAuditStrict + NewFormulaAudit] end Homebrew.failed = check_style_and_print(target, options) @@ -107,7 +109,7 @@ module Homebrew args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml" args << HOMEBREW_LIBRARY_PATH else - args << "--config" << HOMEBREW_LIBRARY/".rubocop.yml" + args << "--config" << HOMEBREW_LIBRARY/".auditcops.yml" args += files end diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 77a5c1cd2..fb6a3459c 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -336,7 +336,7 @@ homebrew-update() { *) odie <<EOS This command updates brew itself, and does not take formula names. -Use 'brew upgrade <formula>'. +Use 'brew upgrade $@' instead. EOS ;; esac diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index ff6b17b45..4bcfdd128 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -87,10 +87,14 @@ module Homebrew if !only_cops.empty? options[:only_cops] = only_cops ARGV.push("--only=style") + elsif new_formula + options[:only_cops] = [:FormulaAudit, :FormulaAuditStrict, :NewFormulaAudit] + elsif strict + options[:only_cops] = [:FormulaAudit, :FormulaAuditStrict] elsif !except_cops.empty? options[:except_cops] = except_cops elsif !strict - options[:except_cops] = [:FormulaAuditStrict] + options[:except_cops] = [:FormulaAuditStrict, :NewFormulaAudit] end # Check style in a single batch run up front for performance @@ -519,15 +523,6 @@ class FormulaAuditor problem "Ambiguous conflicting formula #{c.name.inspect}." end end - - versioned_conflicts_whitelist = %w[node@ bash-completion@].freeze - - return unless formula.conflicts.any? && formula.versioned_formula? - return if formula.name.start_with?(*versioned_conflicts_whitelist) - problem <<-EOS - Versioned formulae should not use `conflicts_with`. - Use `keg_only :versioned_formula` instead. - EOS end def audit_keg_only_style @@ -562,34 +557,6 @@ class FormulaAuditor problem "keg_only reason should not end with a period." end - def audit_options - formula.options.each do |o| - if o.name == "32-bit" - problem "macOS has been 64-bit only since 10.6 so 32-bit options are deprecated." - end - - next unless @strict - - if o.name == "universal" - problem "macOS has been 64-bit only since 10.6 so universal options are deprecated." - end - - if o.name !~ /with(out)?-/ && o.name != "c++11" && o.name != "universal" - problem "Options should begin with with/without. Migrate '--#{o.name}' with `deprecated_option`." - end - - next unless o.name =~ /^with(out)?-(?:checks?|tests)$/ - unless formula.deps.any? { |d| d.name == "check" && (d.optional? || d.recommended?) } - problem "Use '--with#{Regexp.last_match(1)}-test' instead of '--#{o.name}'. Migrate '--#{o.name}' with `deprecated_option`." - end - end - - return unless @new_formula - return if formula.deprecated_options.empty? - return if formula.versioned_formula? - problem "New formulae should not use `deprecated_option`." - end - def audit_homepage homepage = formula.homepage diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 7ca22575f..472bb7c2b 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -65,7 +65,9 @@ module Homebrew readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:maintainers] = readme.read[/(Homebrew's current maintainers .*\.)/, 1] + variables[:core_maintainer] = readme.read[%r{(Homebrew/homebrew-core's lead maintainer .*\.)}, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:maintainers] = readme.read[/(Homebrew's other current maintainers .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') variables[:former_maintainers] = readme.read[/(Former maintainers .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 658f2e2f3..af9dcc575 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -53,10 +53,7 @@ module Homebrew ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" end - # TODO: unpin this version when this error no longer shows: - # bundler-1.15.0/lib/bundler/shared_helpers.rb:25: - # stack level too deep (SystemStackError) - Homebrew.install_gem_setup_path! "bundler", "1.14.6" + Homebrew.install_gem_setup_path! "bundler" system "bundle", "install" unless quiet_system("bundle", "check") parallel = true diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index a5adfeb63..ceb6ad4d1 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -98,6 +98,17 @@ module Homebrew EOS end + def check_build_from_source + return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"] + + <<-EOS.undent + You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is + intended for use by Homebrew developers. If you are encountering errors, + please try unsetting this. Please do not file issues if you encounter + errors when using this environment variable. + EOS + end + # See https://github.com/Homebrew/legacy-homebrew/pull/9986 def check_path_for_trailing_slashes bad_paths = PATH.new(ENV["HOMEBREW_PATH"]).select { |p| p.end_with?("/") } diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index 287a1408f..52d4cbf51 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -111,10 +111,18 @@ module FileUtils # path to the actually-installed make on Tiger or older. def make(*args) if Utils.popen_read("/usr/bin/make", "--version").match(/Make (\d\.\d+)/)[1] > "3.80" - system "/usr/bin/make", *args + make_path = "/usr/bin/make" else make = Formula["make"].opt_bin/"make" make_path = make.exist? ? make.to_s : (Formula["make"].opt_bin/"gmake").to_s + end + + if superenv? + make_name = File.basename(make_path) + with_env "HOMEBREW_MAKE" => make_name do + system "make", *args + end + else system make_path, *args end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index da375d8a7..b2e4ff988 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -955,30 +955,27 @@ class Formula build = self.build self.build = Tab.for_formula(self) - old_tmpdir = ENV["TMPDIR"] - old_temp = ENV["TEMP"] - old_tmp = ENV["TMP"] - old_path = ENV["HOMEBREW_PATH"] - - ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP - ENV["HOMEBREW_PATH"] = nil + new_env = { + "TMPDIR" => HOMEBREW_TEMP, + "TEMP" => HOMEBREW_TEMP, + "TMP" => HOMEBREW_TEMP, + "HOMEBREW_PATH" => nil, + } - ENV.clear_sensitive_environment! + with_env(new_env) do + ENV.clear_sensitive_environment! - Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| - path.extend(InstallRenamed) - path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) - end + Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| + path.extend(InstallRenamed) + path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) + end - with_logging("post_install") do - post_install + with_logging("post_install") do + post_install + end end ensure self.build = build - ENV["TMPDIR"] = old_tmpdir - ENV["TEMP"] = old_temp - ENV["TMP"] = old_tmp - ENV["HOMEBREW_PATH"] = old_path @prefix_returns_versioned_prefix = false end diff --git a/Library/Homebrew/language/python_virtualenv_constants.rb b/Library/Homebrew/language/python_virtualenv_constants.rb index c8b71aa85..4efd2ce1d 100644 --- a/Library/Homebrew/language/python_virtualenv_constants.rb +++ b/Library/Homebrew/language/python_virtualenv_constants.rb @@ -1,2 +1,2 @@ -PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/5c/79/5dae7494b9f5ed061cff9a8ab8d6e1f02db352f3facf907d9eb614fb80e9/virtualenv-15.0.2.tar.gz".freeze -PYTHON_VIRTUALENV_SHA256 = "fab40f32d9ad298fba04a260f3073505a16d52539a84843cf8c8369d4fd17167".freeze +PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz".freeze +PYTHON_VIRTUALENV_SHA256 = "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a".freeze diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 0baa96755..589527d20 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -260,6 +260,8 @@ Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/> <%= lead_maintainer.concat("\n") %> +<%= core_maintainer.concat("\n") %> + <%= maintainers.concat("\n") %> <%= former_maintainers.concat("\n") %> diff --git a/Library/Homebrew/os/mac/linkage_checker.rb b/Library/Homebrew/os/mac/linkage_checker.rb index f332c2d7a..786827852 100644 --- a/Library/Homebrew/os/mac/linkage_checker.rb +++ b/Library/Homebrew/os/mac/linkage_checker.rb @@ -118,9 +118,12 @@ class LinkageChecker # Whether or not dylib is a harmless broken link, meaning that it's # okay to skip (and not report) as broken. def harmless_broken_link?(dylib) - # libgcc_s_ppc64 is referenced by programs that use the Java Service Wrapper, + # libgcc_s_* is referenced by programs that use the Java Service Wrapper, # and is harmless on x86(_64) machines - ["/usr/lib/libgcc_s_ppc64.1.dylib"].include?(dylib) + [ + "/usr/lib/libgcc_s_ppc64.1.dylib", + "/opt/local/lib/libgcc/libgcc_s.1.dylib", + ].include?(dylib) end # Display a list of things. diff --git a/Library/Homebrew/os/mac/pkgconfig/10.13/sqlite3.pc b/Library/Homebrew/os/mac/pkgconfig/10.13/sqlite3.pc index aa78d2c1d..86ac8b0ce 100644 --- a/Library/Homebrew/os/mac/pkgconfig/10.13/sqlite3.pc +++ b/Library/Homebrew/os/mac/pkgconfig/10.13/sqlite3.pc @@ -5,7 +5,7 @@ includedir=${prefix}/include Name: SQLite Description: SQL database engine -Version: 3.18.0 +Version: 3.19.3 Libs: -L${libdir} -lsqlite3 Libs.private: Cflags: -I${includedir} diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 1d70c3981..ec38512e8 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -216,7 +216,7 @@ module OS # on the older supported platform for that Xcode release, i.e there's no # CLT package for 10.11 that contains the Clang version from Xcode 8. case MacOS.version - when "10.13" then "900.0.26" + when "10.13" then "900.0.28.1" when "10.12" then "802.0.42" when "10.11" then "800.0.42.1" when "10.10" then "700.1.81" diff --git a/Library/Homebrew/requirements/python_requirement.rb b/Library/Homebrew/requirements/python_requirement.rb index e62ec4cfe..c162b072c 100644 --- a/Library/Homebrew/requirements/python_requirement.rb +++ b/Library/Homebrew/requirements/python_requirement.rb @@ -18,11 +18,12 @@ class PythonRequirement < Requirement if !system_python? && short_version == Version.create("2.7") ENV.prepend_path "PATH", which_python.dirname - # Homebrew Python should take precedence over older Pythons in the PATH - elsif short_version != Version.create("2.7") - ENV.prepend_path "PATH", Formula["python"].opt_bin end + # Homebrew Python should take precedence over other Pythons in the PATH + ENV.prepend_path "PATH", Formula["python"].opt_bin + ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin" + ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages" end diff --git a/Library/Homebrew/rubocops.rb b/Library/Homebrew/rubocops.rb index e27f91867..f673720a6 100644 --- a/Library/Homebrew/rubocops.rb +++ b/Library/Homebrew/rubocops.rb @@ -7,3 +7,5 @@ require_relative "./rubocops/text_cop" require_relative "./rubocops/caveats_cop" require_relative "./rubocops/checksum_cop" require_relative "./rubocops/legacy_patches_cop" +require_relative "./rubocops/conflicts_cop" +require_relative "./rubocops/options_cop" diff --git a/Library/Homebrew/rubocops/conflicts_cop.rb b/Library/Homebrew/rubocops/conflicts_cop.rb new file mode 100644 index 000000000..c1b801559 --- /dev/null +++ b/Library/Homebrew/rubocops/conflicts_cop.rb @@ -0,0 +1,27 @@ +require_relative "./extend/formula_cop" +require_relative "../extend/string" + +module RuboCop + module Cop + module FormulaAudit + # This cop audits versioned Formulae for `conflicts_with` + class Conflicts < FormulaCop + MSG = <<-EOS.undent + Versioned formulae should not use `conflicts_with`. + Use `keg_only :versioned_formula` instead. + EOS + + WHITELIST = %w[ + node@ + bash-completion@ + ].freeze + + def audit_formula(_node, _class_node, _parent_class_node, body) + return unless versioned_formula? + problem MSG if !formula_file_name.start_with?(*WHITELIST) && + method_called_ever?(body, :conflicts_with) + end + end + end + end +end diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index 439fde6a5..7165ee354 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -102,14 +102,11 @@ module RuboCop # Returns nil if does not depend on dependency_name # args: node - dependency_name - dependency's name - def depends_on?(dependency_name) + def depends_on?(dependency_name, *types) + types = [:required, :build, :optional, :recommended, :run] if types.empty? dependency_nodes = find_every_method_call_by_name(@body, :depends_on) idx = dependency_nodes.index do |n| - depends_on_name_type?(n, dependency_name, :required) || - depends_on_name_type?(n, dependency_name, :build) || - depends_on_name_type?(n, dependency_name, :optional) || - depends_on_name_type?(n, dependency_name, :recommended) || - depends_on_name_type?(n, dependency_name, :run) + types.any? { |type| depends_on_name_type?(n, dependency_name, type) } end return if idx.nil? @offense_source_range = dependency_nodes[idx].source_range @@ -138,6 +135,8 @@ module RuboCop if type_match && !name_match name_match = node_equals?(node.method_args.first.keys.first.children.first, name) end + else + type_match = false end if type_match || name_match @@ -334,16 +333,28 @@ module RuboCop def string_content(node) case node.type when :str - return node.str_content if node.type == :str + node.str_content when :dstr - return node.each_child_node(:str).map(&:str_content).join("") if node.type == :dstr + node.each_child_node(:str).map(&:str_content).join("") when :const - return node.const_name if node.type == :const + node.const_name + when :sym + node.children.first.to_s else "" end end + # Returns true if the formula is versioned + def versioned_formula? + formula_file_name.include?("@") || @formula_name.match(/AT\d+/) + end + + # Returns filename of the formula without the extension + def formula_file_name + File.basename(processed_source.buffer.name, ".rb") + end + # Returns printable component name def format_component(component_node) return component_node.method_name if component_node.send_type? || component_node.block_type? diff --git a/Library/Homebrew/rubocops/options_cop.rb b/Library/Homebrew/rubocops/options_cop.rb new file mode 100644 index 000000000..c16244161 --- /dev/null +++ b/Library/Homebrew/rubocops/options_cop.rb @@ -0,0 +1,58 @@ +require_relative "./extend/formula_cop" + +module RuboCop + module Cop + module FormulaAudit + # This cop audits `options` in Formulae + class Options < FormulaCop + DEPRECATION_MSG = "macOS has been 64-bit only since 10.6 so 32-bit options are deprecated.".freeze + + def audit_formula(_node, _class_node, _parent_class_node, body_node) + option_call_nodes = find_every_method_call_by_name(body_node, :option) + option_call_nodes.each do |option_call| + option = parameters(option_call).first + problem DEPRECATION_MSG if regex_match_group(option, /32-bit/) + end + end + end + end + + module FormulaAuditStrict + class Options < FormulaCop + DEPRECATION_MSG = "macOS has been 64-bit only since 10.6 so universal options are deprecated.".freeze + + def audit_formula(_node, _class_node, _parent_class_node, body_node) + option_call_nodes = find_every_method_call_by_name(body_node, :option) + option_call_nodes.each do |option_call| + offending_node(option_call) + option = string_content(parameters(option_call).first) + problem DEPRECATION_MSG if option == "universal" + + if option !~ /with(out)?-/ && + option != "cxx11" && + option != "universal" + problem "Options should begin with with/without."\ + " Migrate '--#{option}' with `deprecated_option`." + end + + next unless option =~ /^with(out)?-(?:checks?|tests)$/ + next if depends_on?("check", :optional, :recommended) + problem "Use '--with#{Regexp.last_match(1)}-test' instead of '--#{option}'."\ + " Migrate '--#{option}' with `deprecated_option`." + end + end + end + end + + module NewFormulaAudit + class Options < FormulaCop + MSG = "New Formula should not use `deprecated_option`".freeze + + def audit_formula(_node, _class_node, _parent_class_node, body_node) + return if versioned_formula? + problem MSG if method_called_ever?(body_node, :deprecated_option) + end + end + end + end +end diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index e2ff84ac5..e72ecb950 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -156,6 +156,7 @@ class Sandbox (literal "/dev/ptmx") (literal "/dev/dtracehelper") (literal "/dev/null") + (literal "/dev/random") (literal "/dev/zero") (regex #"^/dev/fd/[0-9]+$") (regex #"^/dev/ttys?[0-9]*$") diff --git a/Library/Homebrew/shims/super/make b/Library/Homebrew/shims/super/make index 028e3462a..7b49e56c0 100755 --- a/Library/Homebrew/shims/super/make +++ b/Library/Homebrew/shims/super/make @@ -1,4 +1,5 @@ #!/bin/bash +export MAKE=${HOMEBREW_MAKE:-make} export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG" -exec xcrun make "$@" +exec xcrun $MAKE "$@" diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index f89c79306..5663295c2 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -77,7 +77,14 @@ class SystemConfig end def describe_python - python = which "python" + python = begin + python_path = PATH.new(ENV["HOMEBREW_PATH"]) + .prepend(Formula["python"].opt_libexec/"bin") + which "python", python_path + rescue FormulaUnavailableError + which "python" + end + return "N/A" if python.nil? python_binary = Utils.popen_read python, "-c", "import sys; sys.stdout.write(sys.executable)" python_binary = Pathname.new(python_binary).realpath diff --git a/Library/Homebrew/test/cmd/style_spec.rb b/Library/Homebrew/test/cmd/style_spec.rb index 3c4c3f809..4701036f1 100644 --- a/Library/Homebrew/test/cmd/style_spec.rb +++ b/Library/Homebrew/test/cmd/style_spec.rb @@ -4,12 +4,12 @@ describe "brew style" do around(:each) do |example| begin FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew" - FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop.yml" + FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".auditcops.yml" example.run ensure FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" - FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml" + FileUtils.rm_f HOMEBREW_LIBRARY/".auditcops.yml" end end diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb index 058b9823c..8a25413ed 100644 --- a/Library/Homebrew/test/diagnostic_spec.rb +++ b/Library/Homebrew/test/diagnostic_spec.rb @@ -12,6 +12,12 @@ describe Homebrew::Diagnostic::Checks do .to match("Some directories in your path end in a slash") end + specify "#check_build_from_source" do + ENV["HOMEBREW_BUILD_FROM_SOURCE"] = "1" + expect(subject.check_build_from_source) + .to match("You have HOMEBREW_BUILD_FROM_SOURCE set.") + end + specify "#check_for_anaconda" do mktmpdir do |path| anaconda = "#{path}/anaconda" diff --git a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb index a775b0b17..563f7ad4b 100644 --- a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb @@ -18,7 +18,7 @@ describe RuboCop::Cop::FormulaAuditStrict::BottleBlock do end EOS - expected_offenses = [{ message: "Use rebuild instead of revision in bottle block", + expected_offenses = [{ message: described_class::MSG, severity: :convention, line: 5, column: 4, diff --git a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb new file mode 100644 index 000000000..4fbab6c9e --- /dev/null +++ b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb @@ -0,0 +1,43 @@ +require "rubocop" +require "rubocop/rspec/support" +require_relative "../../extend/string" +require_relative "../../rubocops/conflicts_cop" + +describe RuboCop::Cop::FormulaAudit::Conflicts do + subject(:cop) { described_class.new } + + context "When auditing formula for conflicts with" do + it "multiple conflicts_with" do + source = <<-EOS.undent + class FooAT20 < Formula + url 'http://example.com/foo-2.0.tgz' + conflicts_with "mysql", "mariadb", "percona-server", + :because => "both install plugins" + end + EOS + + expected_offenses = [{ message: described_class::MSG, + severity: :convention, + line: 3, + column: 2, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + + it "no conflicts_with" do + source = <<-EOS.undent + class FooAT20 < Formula + url 'http://example.com/foo-2.0.tgz' + desc 'Bar' + end + EOS + inspect_source(cop, source) + expect(cop.offenses).to eq([]) + end + end +end diff --git a/Library/Homebrew/test/rubocops/options_cop_spec.rb b/Library/Homebrew/test/rubocops/options_cop_spec.rb new file mode 100644 index 000000000..b89b3d9b5 --- /dev/null +++ b/Library/Homebrew/test/rubocops/options_cop_spec.rb @@ -0,0 +1,132 @@ +require "rubocop" +require "rubocop/rspec/support" +require_relative "../../extend/string" +require_relative "../../rubocops/options_cop" + +describe RuboCop::Cop::FormulaAudit::Options do + subject(:cop) { described_class.new } + + context "When auditing options" do + it "32-bit" do + source = <<-EOS.undent + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + option "32-bit", "with 32-bit" + end + EOS + + expected_offenses = [{ message: described_class::DEPRECATION_MSG, + severity: :convention, + line: 3, + column: 10, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + end +end + +describe RuboCop::Cop::FormulaAuditStrict::Options do + subject(:cop) { described_class.new } + + context "When auditing options strictly" do + it "with universal" do + source = <<-EOS.undent + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + option :universal + end + EOS + + expected_offenses = [{ message: described_class::DEPRECATION_MSG, + severity: :convention, + line: 3, + column: 2, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + + it "with deprecated options" do + source = <<-EOS.undent + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + option :cxx11 + option "examples", "with-examples" + end + EOS + + MSG_1 = "Options should begin with with/without."\ + " Migrate '--examples' with `deprecated_option`.".freeze + expected_offenses = [{ message: MSG_1, + severity: :convention, + line: 4, + column: 2, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + + it "with misc deprecated options" do + source = <<-EOS.undent + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + option "without-check" + end + EOS + + MSG_2 = "Use '--without-test' instead of '--without-check'."\ + " Migrate '--without-check' with `deprecated_option`.".freeze + expected_offenses = [{ message: MSG_2, + severity: :convention, + line: 3, + column: 2, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + end +end + +describe RuboCop::Cop::NewFormulaAudit::Options do + subject(:cop) { described_class.new } + + context "When auditing options for a new formula" do + it "with deprecated options" do + source = <<-EOS.undent + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + deprecated_option "examples" => "with-examples" + end + EOS + + expected_offenses = [{ message: described_class::MSG, + severity: :convention, + line: 3, + column: 2, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + end +end diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index d04ca0088..222f85fc4 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -42,6 +42,8 @@ TEST_DIRECTORIES = [ RSpec.configure do |config| config.order = :random + config.filter_run_when_matching :focus + config.include(Test::Helper::Shutup) config.include(Test::Helper::Fixtures) config.include(Test::Helper::Formula) diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index ae1854f58..cf9c13fb8 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -77,20 +77,43 @@ RSpec.shared_context "integration test" do "HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args), "HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR, "HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"], + "GEM_HOME" => nil, ) - ruby_args = [ - "-W0", - "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib", - "-I", HOMEBREW_LIBRARY_PATH.to_s, - "-rconfig" - ] - ruby_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"] - ruby_args << "-rtest/support/helper/integration_mocks" - ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s - - Bundler.with_original_env do - stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *ruby_args, *args) + @ruby_args ||= begin + ruby_args = [ + "-W0", + "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib", + "-I", HOMEBREW_LIBRARY_PATH.to_s, + "-rconfig" + ] + if ENV["HOMEBREW_TESTS_COVERAGE"] + simplecov_spec = Gem.loaded_specs["simplecov"] + specs = [simplecov_spec] + simplecov_spec.runtime_dependencies.each do |dep| + begin + specs += dep.to_specs + rescue Gem::LoadError => e + onoe e + end + end + libs = specs.flat_map do |spec| + full_gem_path = spec.full_gem_path + # full_require_paths isn't available in RubyGems < 2.2. + spec.require_paths.map do |lib| + next lib if lib.include?(full_gem_path) + "#{full_gem_path}/#{lib}" + end + end + libs.each { |lib| ruby_args << "-I" << lib } + ruby_args << "-rsimplecov" + end + ruby_args << "-rtest/support/helper/integration_mocks" + ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s + end + + Bundler.with_clean_env do + stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *@ruby_args, *args) $stdout.print stdout $stderr.print stderr status diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index f3bf98486..37bd83c4f 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -270,4 +270,30 @@ describe "globally-scoped helper methods" do }.to raise_error(MethodDeprecatedError, %r{method.*replacement.*homebrew/homebrew-core.*homebrew/core}m) end end + + describe "#with_env" do + it "sets environment variables within the block" do + expect(ENV["PATH"]).not_to eq("/bin") + with_env "PATH" => "/bin" do + expect(ENV["PATH"]).to eq("/bin") + end + end + + it "restores ENV after the block" do + with_env "PATH" => "/bin" do + expect(ENV["PATH"]).to eq("/bin") + end + expect(ENV["PATH"]).not_to eq("/bin") + end + + it "restores ENV if an exception is raised" do + expect { + with_env "PATH" => "/bin" do + raise StandardError, "boom" + end + }.to raise_error(StandardError) + + expect(ENV["PATH"]).not_to eq("/bin") + end + end end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 529f3492d..5a6295394 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -287,10 +287,9 @@ ensure end def run_as_not_developer(&_block) - old = ENV.delete "HOMEBREW_DEVELOPER" - yield -ensure - ENV["HOMEBREW_DEVELOPER"] = old + with_env "HOMEBREW_DEVELOPER" => nil do + yield + end end # Kernel.system but with exceptions @@ -533,3 +532,27 @@ def migrate_legacy_keg_symlinks_if_necessary end FileUtils.rm_rf legacy_pinned_kegs end + +# Calls the given block with the passed environment variables +# added to ENV, then restores ENV afterwards. +# Example: +# with_env "PATH" => "/bin" do +# system "echo $PATH" +# end +# +# Note that this method is *not* thread-safe - other threads +# which happen to be scheduled during the block will also +# see these environment variables. +def with_env(hash) + old_values = {} + begin + hash.each do |key, value| + old_values[key] = ENV.delete(key) + ENV[key] = value + end + + yield if block_given? + ensure + ENV.update(old_values) + end +end diff --git a/Library/README.md b/Library/README.md new file mode 100644 index 000000000..1b3977172 --- /dev/null +++ b/Library/README.md @@ -0,0 +1,3 @@ +# Library + +This directory contains all the code run by the official `brew` and `brew cask` commands in `Homebrew` and all formulae (package descriptions) in taps (repositories containing formulae) in `Taps` subdirectories. @@ -3,12 +3,6 @@ Features, usage and installation instructions are [summarised on the homepage](https://brew.sh). Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is [explained here](docs/Formula-Cookbook.md#homebrew-terminology). -## Update Bug -If Homebrew was updated on Aug 10-11th 2016 and `brew update` always says `Already up-to-date.` you need to run: -```bash -cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update -``` - ## What Packages Are Available? 1. Type `brew search` for a list. 2. Or visit [braumeister.org](http://braumeister.org) to browse packages online. @@ -40,7 +34,9 @@ Please report security issues to our [HackerOne](https://hackerone.com/homebrew/ ## Who Are You? Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid). -Homebrew's current maintainers are [Alyssa Ross](https://github.com/alyssais), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [FX Coudert](https://github.com/fxcoudert), [ilovezfs](https://github.com/ilovezfs), [Josh Hagins](https://github.com/jawshooah), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Markus Reiter](https://github.com/reitermarkus), [Tim Smith](https://github.com/tdsmith), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky) and [William Woodruff](https://github.com/woodruffw). +Homebrew/homebrew-core's lead maintainer is [ilovezfs](https://github.com/ilovezfs). + +Homebrew's other current maintainers are [Alyssa Ross](https://github.com/alyssais), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [FX Coudert](https://github.com/fxcoudert), [Josh Hagins](https://github.com/jawshooah), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Markus Reiter](https://github.com/reitermarkus), [Tim Smith](https://github.com/tdsmith), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky) and [William Woodruff](https://github.com/woodruffw). Former maintainers with significant contributions include [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl). diff --git a/completions/README.md b/completions/README.md new file mode 100644 index 000000000..48cfa95c9 --- /dev/null +++ b/completions/README.md @@ -0,0 +1,2 @@ +# Completions +This directory contains subdirectories for `brew`'s tab completions for `bash` and `zsh`. diff --git a/docs/Acceptable-Formulae.md b/docs/Acceptable-Formulae.md index 0773d12d9..df799bb1a 100644 --- a/docs/Acceptable-Formulae.md +++ b/docs/Acceptable-Formulae.md @@ -2,43 +2,14 @@ Some formulae should not go in [homebrew/core](https://github.com/Homebrew/homebrew-core). But there are -additional [Interesting Taps & Forks](Interesting-Taps-&-Forks.md) and anyone can start their +additional [Interesting Taps and Forks](Interesting-Taps-and-Forks.md) and anyone can start their own! -### We try hard to avoid dupes in `homebrew/core` -Stuff that comes with macOS or libraries that are provided by -[RubyGems, CPAN or PyPi](Gems,-Eggs-and-Perl-Modules.md) -should not be duplicated. There are good reasons for this: - -* Duplicate libraries regularly break builds -* Subtle bugs emerge with duplicate libraries, and to a lesser extent, - duplicate tools -* We want our formulae to work with what comes with macOS - -There are exceptions: - -* OpenSSL - Apple has formally deprecated OpenSSL on macOS in favour of their own Security Framework - & consequently the macOS OpenSSL is rarely updated and frequently falls behind important security updates. - Homebrew endeavours to use our shipped OpenSSL as much as possible. -* Programs that a user will regularly interact with directly, like editors and - language runtimes -* Libraries that provide functionality or contain security updates not found in - the system version -* Things that are **designed to be installed in parallel to earlier versions of - themselves** - -#### Examples - -| Formula | Reason | -|--------------------|-------------------------------------------------------------------------------------------------------| -| ruby, python, perl | People want newer versions | -| bash | macOS's bash is stuck at 3.2 because newer versions are licensed under GPLv3 | -| zsh | This was a mistake, but it’s too late to remove it | -| emacs, vim | [Too popular to move to dupes](https://github.com/Homebrew/homebrew/pull/21594#issuecomment-21968819) | -| subversion | Originally added for 10.5, but people want the latest version | -| libcurl | Some formulae require a newer version than macOS provides | -| openssl | macOS's openssl is deprecated & outdated | -| libxml2 | Historically, macOS's libxml2 has been buggy | +### Dupes in `homebrew/core` +We now accept stuff that comes with macOS as long as it uses `keg_only :provided_by_macos` to be keg-only by default. + +### Versioned formulae in `homebrew/core` +We now accept versioned formulae as long as they [meet the requirements](Versions.md). ### We don’t like tools that upgrade themselves Software that can upgrade itself does not integrate well with Homebrew's own @@ -74,7 +45,7 @@ etc. If not, then put bindings in the formula they bind to. This is more useful to people. Just install the stuff! Having to faff around with -foo-ruby, foo-perl etc. sucks. +foo-ruby, foo-perl etc. is a bad user experience. ### Niche (or self-submitted) stuff The software in question must: @@ -100,9 +71,16 @@ running a package manager. ### Stuff that builds an `.app` Don’t make your formula build an `.app` (native macOS Application); we -don’t want those things in Homebrew (but -[Homebrew Cask](https://github.com/caskroom/homebrew-cask) does). -Make it build a command-line tool or a library. +don’t want those things in Homebrew. Encourage upstream projects to build and support a `.app` that can be distributed by [Homebrew Cask](https://github.com/caskroom/homebrew-cask) (and used without it, too). + +### Stuff that builds a GUI by default (but doesn't have to) +Make it build a command-line tool or a library by default and, if the GUI is useful and would be widely used, add an option to build the GUI. Don't offer an option for multiple GUI backends e.g. X11 is a bad user experience for GUIs on macOS. + +### Stuff that doesn't build with the latest, stable Xcode's Clang +Clang is the default C/C++ compiler on macOS (and has been for a long time). Software that doesn't build with it hasn't been adequately ported to macOS. + +### Stuff that requires heavy manual pre/post-install intervention +We're a package manager so we want to do things like resolve dependencies and setup applications for our users. If things require too much manual intervention then they aren't useful in a package manager. ### Sometimes there are exceptions Even if all criteria are met we may not accept the formula. diff --git a/docs/FAQ.md b/docs/FAQ.md index 4fe11530e..23f53d54c 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -89,16 +89,13 @@ following conditions: will use a bottled version of the formula, but `brew install <formula> --enable-bar` will trigger a source build. * The `--build-from-source` option is invoked. -* The environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set. +* The environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set +(intended for developers only). * The machine is not running a supported version of macOS as all bottled builds are generated only for supported macOS versions. * Homebrew is installed to a prefix other than the standard `/usr/local` (although some bottles support this). -In order to completely disable bottled builds, simply add a value for -the environment variable `HOMEBREW_BUILD_FROM_SOURCE` to -your profile. - We aim to bottle everything. ## How do I get a formula from someone else’s branch? diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 03f1d6817..c9fe614ba 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -9,12 +9,12 @@ Homebrew provides formulae to brew a more up-to-date Python 2.7.x and 3.x. **Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team can only provide limited support. ## Python 2.x or Python 3.x -Homebrew provides a formula for Python 2.7.x and one for Python 3.x. They don't conflict, so they can both be installed. The executable `python` will always point to the 2.x and `python3` to the 3.x version. +Homebrew provides a formula for Python 2.7.x and one for Python 3.x. They don't conflict, so they can both be installed. The executable `python2` will always point to the 2.x and `python3` to the 3.x version. The executable `python` will always point to the macOS system Python. ([Wondering which one to choose?](https://wiki.python.org/moin/Python2orPython3)) ## Setuptools, Pip, etc. -The Python formulae install [`pip`](http://www.pip-installer.org) and [Setuptools](https://pypi.python.org/pypi/setuptools). +The Python formulae install [pip](http://www.pip-installer.org) (as `pip2` or `pip3`) and [Setuptools](https://pypi.python.org/pypi/setuptools). Setuptools can be updated via pip, without having to re-brew Python: diff --git a/docs/Manpage.md b/docs/Manpage.md index 583a858c1..3a90c239a 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -198,7 +198,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note See the docs for examples of using the JSON output: <http://docs.brew.sh/Querying-Brew.html> - * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=``compiler`] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] `formula`: + * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=``compiler`] [`--build-from-source`|`--force-bottle`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] `formula` [`options` ...]: Install `formula`. `formula` is usually the name of the formula to install, but it can be specified @@ -247,6 +247,9 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--build-bottle` is passed, prepare the formula for eventual bottling during installation. + Installation options specific to `formula` may be appended to the command, + and can be listed with `brew options` `formula`. + * `install` `--interactive` [`--git`] `formula`: If `--interactive` (or `-i`) is passed, download and patch `formula`, then open a shell. This allows the user to run `./configure --help` and @@ -1069,7 +1072,9 @@ Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/> Homebrew's lead maintainer is Mike McQuaid. -Homebrew's current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff. +Homebrew/homebrew-core's lead maintainer is ilovezfs. + +Homebrew's other current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff. Former maintainers with significant contributions include Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell. diff --git a/docs/New-Maintainer-Checklist.md b/docs/New-Maintainer-Checklist.md index f0f3f38a0..37c15e62c 100644 --- a/docs/New-Maintainer-Checklist.md +++ b/docs/New-Maintainer-Checklist.md @@ -49,7 +49,7 @@ If they accept, follow a few steps to get them set up: - Ask them to sign in to [Bintray](https://bintray.com) using their GitHub account and they should auto-sync to [Bintray's Homebrew organisation](https://bintray.com/homebrew/organization/edit/members) as a member so they can publish new bottles - Add them to the [Jenkins' GitHub Authorization Settings admin user names](https://jenkins.brew.sh/configureSecurity/) so they can adjust settings and restart jobs - Add them to the [Jenkins' GitHub Pull Request Builder admin list](https://jenkins.brew.sh/configure) to enable `@BrewTestBot test this please` for them -- Invite them to the [`homebrew-dev` private maintainers mailing list](https://groups.google.com/forum/#!managemembers/homebrew-dev/invite) +- Invite them to the [`homebrew-maintainers` private maintainers mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-maintainers/members/add) - Invite them to the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin/invites) - Invite them to the [`homebrew` private maintainers 1Password](https://homebrew.1password.com/signin) - Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/) diff --git a/docs/Node-for-Formula-Authors.md b/docs/Node-for-Formula-Authors.md index a3d0624f2..f1a50a8c3 100644 --- a/docs/Node-for-Formula-Authors.md +++ b/docs/Node-for-Formula-Authors.md @@ -113,3 +113,7 @@ end ``` For examples using the `local_npm_install_args` method look at the [`elixirscript`](https://github.com/Homebrew/homebrew-core/blob/ec1e40d37e81af63122a354f0101c377f6a4e66d/Formula/elixirscript.rb) or [`kibana`](https://github.com/Homebrew/homebrew-core/blob/c6202f91a129e2f994d904f299a308cc6fbd58e5/Formula/kibana.rb) formulae. + +## Tooling + +You can use [homebrew-npm-noob](https://github.com/zmwangx/homebrew-npm-noob) to automatically generate a formula like the example above for an npm package. diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index 8b4bc2cb4..5b9d6ced6 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -2,13 +2,13 @@ This document explains how to successfully use Python in a Homebrew formula. -Homebrew draws a distinction between Python **applications** and Python **libraries**. The difference is that users generally do not care that applications are written in Python; it is unusual that a user would expect to be able to `import foo` after installing an application. Examples of applications are `ansible` and `jrnl`. +Homebrew draws a distinction between Python **applications** and Python **libraries**. The difference is that users generally do not care that applications are written in Python; it is unusual that a user would expect to be able to `import foo` after installing an application. Examples of applications are [`ansible`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/ansible.rb) and [`jrnl`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/jrnl.rb). -Python libraries exist to be imported by other Python modules; they are often dependencies of Python applications. They are usually no more than incidentally useful from a Terminal.app command line. Examples of libraries are `py2cairo` and the bindings that are installed by `protobuf --with-python`. +Python libraries exist to be imported by other Python modules; they are often dependencies of Python applications. They are usually no more than incidentally useful from a Terminal.app command line. Examples of libraries are [`py2cairo`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/py2cairo.rb) and the bindings that are installed by [`protobuf --with-python`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/protobuf.rb). Bindings are a special case of libraries that allow Python code to interact with a library or application implemented in another language. -Homebrew is happy to accept applications that are built in Python, whether the apps are available from PyPI or not. Homebrew generally won't accept libraries that can be installed correctly with `pip install foo`. Libraries that can be `pip`-installed but have several Homebrew dependencies may be appropriate for the [homebrew/python](https://github.com/Homebrew/homebrew-python) tap. Bindings may be installed for packages that provide them, especially if equivalent functionality isn't available through pip. +Homebrew is happy to accept applications that are built in Python, whether the apps are available from PyPI or not. Homebrew generally won't accept libraries that can be installed correctly with `pip install foo`. Bindings may be installed for packages that provide them, especially if equivalent functionality isn't available through pip. ## Running `setup.py` @@ -40,8 +40,6 @@ If you submit a formula with this syntax to core, you may be asked to rewrite it ## Applications -`ansible.rb` and `jrnl.rb` are good examples of applications that follow this advice. - ### Python declarations Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. To do this, declare: diff --git a/docs/README.md b/docs/README.md index 420038ca6..07ff9074c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,7 +10,7 @@ - [Tips and Tricks](Tips-N'-Tricks.md) - [Bottles (binary packages)](Bottles.md) - [Taps (third-party repositories)](brew-tap.md) -- [Interesting Taps and Forks](Interesting-Taps-&-Forks.md) +- [Interesting Taps and Forks](Interesting-Taps-and-Forks.md) - [Anonymous Aggregate User Behaviour Analytics](Analytics.md) - [Querying `brew`](Querying-Brew.md) diff --git a/docs/css/screen.scss b/docs/css/screen.scss index 5acdf4657..d81a1f858 100644 --- a/docs/css/screen.scss +++ b/docs/css/screen.scss @@ -111,7 +111,7 @@ html { margin: 0; padding: 0; font-size: 62.5%; - font-family: "-apple-system", "BlinkMacSystemFont", "Helvetica Neue", "Roboto", "sans-serif"; + font-family: "-apple-system", "BlinkMacSystemFont", "Helvetica Neue", "Roboto", sans-serif; height: 100%; } @@ -176,7 +176,7 @@ pre { @include border-radius(0.4em); overflow-x: auto; code { - font-family: "Monaco", "Menlo", "monospace"; + font-family: "Monaco", "Menlo", monospace; font-size: 11px; line-height: 1.6; } diff --git a/manpages/README.md b/manpages/README.md new file mode 100644 index 000000000..580342535 --- /dev/null +++ b/manpages/README.md @@ -0,0 +1,3 @@ +# Manual pages + +This directory contains the generated Homebrew man pages from the `brew man` command. This command creates the output from `#:` comments in files, sections extracted from the repository's `README.md` and `brew.1.md.erb`. diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 49be14c57..f11d48c09 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "June 2017" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "July 2017" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS diff --git a/manpages/brew.1 b/manpages/brew.1 index 3ea05848e..7341b3244 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "June 2017" "Homebrew" "brew" +.TH "BREW" "1" "July 2017" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -216,7 +216,7 @@ Pass \fB\-\-all\fR to get information on all formulae, or \fB\-\-installed\fR to See the docs for examples of using the JSON output: \fIhttp://docs\.brew\.sh/Querying\-Brew\.html\fR . .TP -\fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR(\fBstd\fR|\fBsuper\fR)] [\fB\-\-ignore\-dependencies\fR|\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-build\-bottle\fR] \fIformula\fR +\fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR(\fBstd\fR|\fBsuper\fR)] [\fB\-\-ignore\-dependencies\fR|\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-build\-bottle\fR] \fIformula\fR [\fIoptions\fR \.\.\.] Install \fIformula\fR\. . .IP @@ -261,6 +261,9 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installatio .IP If \fB\-\-build\-bottle\fR is passed, prepare the formula for eventual bottling during installation\. . +.IP +Installation options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. +. .TP \fBinstall\fR \fB\-\-interactive\fR [\fB\-\-git\fR] \fIformula\fR If \fB\-\-interactive\fR (or \fB\-i\fR) is passed, download and patch \fIformula\fR, then open a shell\. This allows the user to run \fB\./configure \-\-help\fR and otherwise determine how to turn the software package into a Homebrew formula\. @@ -1114,7 +1117,10 @@ Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/\f Homebrew\'s lead maintainer is Mike McQuaid\. . .P -Homebrew\'s current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff\. +Homebrew/homebrew\-core\'s lead maintainer is ilovezfs\. +. +.P +Homebrew\'s other current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff\. . .P Former maintainers with significant contributions include Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg and Homebrew\'s creator: Max Howell\. |
