Merge pull request #2579 from MikeMcQuaid/install-etc-var-postinstall
Install etc/var files on postinstall.
This commit is contained in:
commit
935a3fd4fc
@ -7,7 +7,10 @@ module Homebrew
|
|||||||
module_function
|
module_function
|
||||||
|
|
||||||
def postinstall
|
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
|
end
|
||||||
|
|
||||||
def run_post_install(formula)
|
def run_post_install(formula)
|
||||||
|
|||||||
@ -1004,11 +1004,6 @@ class Formula
|
|||||||
# Can be overridden to run commands on both source and bottle installation.
|
# Can be overridden to run commands on both source and bottle installation.
|
||||||
def post_install; end
|
def post_install; end
|
||||||
|
|
||||||
# @private
|
|
||||||
def post_install_defined?
|
|
||||||
method(:post_install).owner == self.class
|
|
||||||
end
|
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def run_post_install
|
def run_post_install
|
||||||
@prefix_returns_versioned_prefix = true
|
@prefix_returns_versioned_prefix = true
|
||||||
@ -1025,6 +1020,11 @@ class Formula
|
|||||||
|
|
||||||
ENV.clear_sensitive_environment!
|
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
|
with_logging("post_install") do
|
||||||
post_install
|
post_install
|
||||||
end
|
end
|
||||||
|
|||||||
@ -564,13 +564,11 @@ class FormulaInstaller
|
|||||||
fix_dynamic_linkage(keg)
|
fix_dynamic_linkage(keg)
|
||||||
end
|
end
|
||||||
|
|
||||||
if formula.post_install_defined?
|
if build_bottle?
|
||||||
if build_bottle?
|
ohai "Not running post_install as we're building a bottle"
|
||||||
ohai "Not running post_install as we're building a bottle"
|
puts "You can run it manually using `brew postinstall #{formula.full_name}`"
|
||||||
puts "You can run it manually using `brew postinstall #{formula.full_name}`"
|
else
|
||||||
else
|
post_install
|
||||||
post_install
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
caveats
|
caveats
|
||||||
@ -832,12 +830,6 @@ class FormulaInstaller
|
|||||||
skip_linkage = formula.bottle_specification.skip_relocation?
|
skip_linkage = formula.bottle_specification.skip_relocation?
|
||||||
keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
|
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)
|
tab = Tab.for_keg(keg)
|
||||||
|
|
||||||
CxxStdlib.check_compatibility(
|
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_changed_alias, :be_alias_changed
|
||||||
|
|
||||||
RSpec::Matchers.alias_matcher :have_option_defined, :be_option_defined
|
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 :have_test_defined, :be_test_defined
|
||||||
RSpec::Matchers.alias_matcher :pour_bottle, :be_pour_bottle
|
RSpec::Matchers.alias_matcher :pour_bottle, :be_pour_bottle
|
||||||
|
|
||||||
@ -624,23 +623,6 @@ describe Formula do
|
|||||||
expect(f.desc).to eq("a formula")
|
expect(f.desc).to eq("a formula")
|
||||||
end
|
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
|
specify "#test_defined?" do
|
||||||
f1 = formula do
|
f1 = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user