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

Merge pull request #2579 from MikeMcQuaid/install-etc-var-postinstall

Install etc/var files on postinstall.
parents 6b005abd f951a22b
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,10 @@ module Homebrew
module_function
def postinstall
ARGV.resolved_formulae.each { |f| run_post_install(f) if f.post_install_defined? }
ARGV.resolved_formulae.each do |f|
ohai "Postinstalling #{f}"
run_post_install(f)
end
end
def run_post_install(formula)
......
......@@ -1004,11 +1004,6 @@ class Formula
# Can be overridden to run commands on both source and bottle installation.
def post_install; end
# @private
def post_install_defined?
method(:post_install).owner == self.class
end
# @private
def run_post_install
@prefix_returns_versioned_prefix = true
......@@ -1025,6 +1020,11 @@ class Formula
ENV.clear_sensitive_environment!
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
end
......
......@@ -564,13 +564,11 @@ class FormulaInstaller
fix_dynamic_linkage(keg)
end
if formula.post_install_defined?
if build_bottle?
ohai "Not running post_install as we're building a bottle"
puts "You can run it manually using `brew postinstall #{formula.full_name}`"
else
post_install
end
if build_bottle?
ohai "Not running post_install as we're building a bottle"
puts "You can run it manually using `brew postinstall #{formula.full_name}`"
else
post_install
end
caveats
......@@ -832,12 +830,6 @@ class FormulaInstaller
skip_linkage = formula.bottle_specification.skip_relocation?
keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
path.extend(InstallRenamed)
path.cp_path_sub(formula.bottle_prefix, HOMEBREW_PREFIX)
end
FileUtils.rm_rf formula.bottle_prefix
tab = Tab.for_keg(keg)
CxxStdlib.check_compatibility(
......
......@@ -10,7 +10,6 @@ RSpec::Matchers.alias_matcher :supersede_an_installed_formula, :be_supersedes_an
RSpec::Matchers.alias_matcher :have_changed_alias, :be_alias_changed
RSpec::Matchers.alias_matcher :have_option_defined, :be_option_defined
RSpec::Matchers.alias_matcher :have_post_install_defined, :be_post_install_defined
RSpec::Matchers.alias_matcher :have_test_defined, :be_test_defined
RSpec::Matchers.alias_matcher :pour_bottle, :be_pour_bottle
......@@ -624,23 +623,6 @@ describe Formula do
expect(f.desc).to eq("a formula")
end
specify "#post_install_defined?" do
f1 = formula do
url "foo-1.0"
def post_install
# do nothing
end
end
f2 = formula do
url "foo-1.0"
end
expect(f1).to have_post_install_defined
expect(f2).not_to have_post_install_defined
end
specify "#test_defined?" do
f1 = formula do
url "foo-1.0"
......
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