Skip to content
Snippets Groups Projects
Commit aa926a1b authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #1813 from MikeMcQuaid/installed_as_dependency

tab: store installed_as_dependency, installed_on_request.
parents 22e8ddc7 89d8864b
No related branches found
No related tags found
No related merge requests found
......@@ -184,6 +184,14 @@ module Homebrew
# FormulaInstaller will handle this case.
formulae << f
end
# Even if we don't install this formula mark it as no longer just
# installed as a dependency.
next unless f.opt_prefix.directory?
keg = Keg.new(f.opt_prefix.resolved_path)
tab = Tab.for_keg(keg)
tab.installed_on_request = true
tab.write
end
perform_preinstall_checks
......
......@@ -94,14 +94,24 @@ module Homebrew
.select(&:directory?)
.map { |k| Keg.new(k.resolved_path) }
if f.opt_prefix.directory?
keg = Keg.new(f.opt_prefix.resolved_path)
tab = Tab.for_keg(keg)
end
fi = FormulaInstaller.new(f)
fi.options = f.build.used_options
fi.options &= f.options
fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
fi.verbose = ARGV.verbose?
fi.quieter = ARGV.quieter?
fi.debug = ARGV.debug?
fi.options = f.build.used_options
fi.options &= f.options
fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
fi.verbose = ARGV.verbose?
fi.quieter = ARGV.quieter?
fi.debug = ARGV.debug?
fi.installed_on_request = !ARGV.named.empty?
if tab
fi.installed_as_dependency = tab.installed_as_dependency
fi.installed_on_request ||= tab.installed_on_request
end
fi.prelude
oh1 "Upgrading #{f.full_specified_name} #{fi.options.to_a.join " "}"
......
......@@ -1629,6 +1629,8 @@ class Formula
"built_as_bottle" => tab.built_as_bottle,
"poured_from_bottle" => tab.poured_from_bottle,
"runtime_dependencies" => tab.runtime_dependencies,
"installed_as_dependency" => tab.installed_as_dependency,
"installed_on_request" => tab.installed_on_request,
}
end
......
......@@ -36,6 +36,7 @@ class FormulaInstaller
mode_attr_accessor :build_from_source, :force_bottle
mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git
mode_attr_accessor :verbose, :debug, :quieter
mode_attr_accessor :installed_as_dependency, :installed_on_request
def initialize(formula)
@formula = formula
......@@ -50,6 +51,8 @@ class FormulaInstaller
@verbose = false
@quieter = false
@debug = false
@installed_as_dependency = false
@installed_on_request = true
@options = Options.new
@invalid_option_names = []
@requirement_messages = []
......@@ -250,6 +253,12 @@ class FormulaInstaller
category = "install"
action = ([formula.full_name] + options).join(" ")
Utils::Analytics.report_event(category, action)
if installed_on_request
category = "install_on_request"
action = ([formula.full_name] + options).join(" ")
Utils::Analytics.report_event(category, action)
end
end
@@attempted << formula
......@@ -287,6 +296,12 @@ class FormulaInstaller
brew_prefix = formula.prefix/".brew"
brew_prefix.mkdir
Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s)
keg = Keg.new(formula.prefix)
tab = Tab.for_keg(keg)
tab.installed_as_dependency = installed_as_dependency
tab.installed_on_request = installed_on_request
tab.write
end
build_bottle_postinstall if build_bottle?
......@@ -483,6 +498,8 @@ class FormulaInstaller
fi.build_from_source = ARGV.build_formula_from_source?(df)
fi.verbose = verbose? && !quieter?
fi.debug = debug?
fi.installed_as_dependency = true
fi.installed_on_request = false
fi.prelude
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"
fi.install
......@@ -809,6 +826,8 @@ class FormulaInstaller
tab.time = Time.now.to_i
tab.head = HOMEBREW_REPOSITORY.git_head
tab.source["path"] = formula.specified_path.to_s
tab.installed_as_dependency = installed_as_dependency
tab.installed_on_request = installed_on_request
tab.write
end
......
......@@ -25,6 +25,8 @@ class Tab < OpenStruct
"unused_options" => build.unused_options.as_flags,
"tabfile" => formula.prefix.join(FILENAME),
"built_as_bottle" => build.bottle?,
"installed_as_dependency" => false,
"installed_on_request" => true,
"poured_from_bottle" => false,
"time" => Time.now.to_i,
"source_modified_time" => formula.source_modified_time.to_i,
......@@ -172,6 +174,8 @@ class Tab < OpenStruct
"used_options" => [],
"unused_options" => [],
"built_as_bottle" => false,
"installed_as_dependency" => false,
"installed_on_request" => true,
"poured_from_bottle" => false,
"time" => nil,
"source_modified_time" => 0,
......@@ -313,6 +317,8 @@ class Tab < OpenStruct
"unused_options" => unused_options.as_flags,
"built_as_bottle" => built_as_bottle,
"poured_from_bottle" => poured_from_bottle,
"installed_as_dependency" => installed_as_dependency,
"installed_on_request" => installed_on_request,
"changed_files" => changed_files && changed_files.map(&:to_s),
"time" => time,
"source_modified_time" => source_modified_time.to_i,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment