Skip to content

Commit

Permalink
Merge pull request #7289 from Homebrew/revert-7279-argv-cleanup-18
Browse files Browse the repository at this point in the history
Revert "ARGV: Deprecate ARGV.build_formula_from_source? and ARGV.build_from_source?"
  • Loading branch information
GauthamGoli committed Apr 5, 2020
2 parents 6f50801 + ad7e1d4 commit 64fd839
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
8 changes: 0 additions & 8 deletions Library/Homebrew/cli/args.rb
Expand Up @@ -158,14 +158,6 @@ def build_stable?
!(HEAD? || devel?)
end

# Whether a given formula should be built from source during the current
# installation run.
def build_formula_from_source?(f)
return false if !build_from_source && !build_bottle

formulae.any? { |args_f| args_f.full_name == f.full_name }
end

private

def downcased_unique_named
Expand Down
12 changes: 12 additions & 0 deletions Library/Homebrew/extend/ARGV.rb
Expand Up @@ -52,6 +52,18 @@ def bottle_arch
arch&.to_sym
end

def build_from_source?
switch?("s") || include?("--build-from-source")
end

# Whether a given formula should be built from source during the current
# installation run.
def build_formula_from_source?(f)
return false if !build_from_source? && !build_bottle?

formulae.any? { |argv_f| argv_f.full_name == f.full_name }
end

def force_bottle?
include?("--force-bottle")
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/fetch.rb
Expand Up @@ -7,7 +7,7 @@ module Fetch
def fetch_bottle?(f)
return true if ARGV.force_bottle? && f.bottle
return false unless f.bottle && f.pour_bottle?
return false if Homebrew.args.build_formula_from_source?(f)
return false if ARGV.build_formula_from_source?(f)
return false unless f.bottle.compatible_cellar?

true
Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/formula_installer.rb
Expand Up @@ -50,7 +50,7 @@ def initialize(formula)
@show_header = false
@ignore_deps = false
@only_deps = false
@build_from_source = Homebrew.args.build_from_source
@build_from_source = ARGV.build_from_source?
@build_bottle = false
@force_bottle = ARGV.force_bottle?
@include_test = ARGV.include?("--include-test")
Expand Down Expand Up @@ -98,7 +98,7 @@ def pour_bottle?(install_bottle_options = { warn: false })

return false if !formula.bottled? && !formula.local_bottle_path
return true if force_bottle?
return false if Homebrew.args.build_from_source || build_bottle? || interactive?
return false if build_from_source? || build_bottle? || interactive?
return false if ARGV.cc
return false unless options.empty?
return false if formula.bottle_disabled?
Expand Down Expand Up @@ -129,7 +129,7 @@ def pour_bottle?(install_bottle_options = { warn: false })

def install_bottle_for?(dep, build)
return pour_bottle? if dep == formula
return false if Homebrew.args.build_formula_from_source?(dep)
return false if ARGV.build_formula_from_source?(dep)
return false unless dep.bottle && dep.pour_bottle?
return false unless build.used_options.empty?
return false unless dep.bottle.compatible_cellar?
Expand Down Expand Up @@ -592,7 +592,7 @@ def install_dependency(dep, inherited_options)
fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options)
fi.options |= inherited_options
fi.options &= df.options
fi.build_from_source = Homebrew.args.build_formula_from_source?(df)
fi.build_from_source = ARGV.build_formula_from_source?(df)
fi.force_bottle = false
fi.verbose = verbose?
fi.quiet = quiet?
Expand Down

0 comments on commit 64fd839

Please sign in to comment.