diff options
| author | Alex Dunn | 2015-10-31 21:42:43 -0700 |
|---|---|---|
| committer | Alex Dunn | 2015-11-01 17:34:28 -0800 |
| commit | 168a2687f8ca00d59d8c4e1d1c50dc650f67cab8 (patch) | |
| tree | e756de33fc0c01a11baddc06962a3c10e33c485a /Library | |
| parent | 91dd4d56d426ed47c4e042f7b17d6560245fd60f (diff) | |
| download | brew-168a2687f8ca00d59d8c4e1d1c50dc650f67cab8.tar.bz2 | |
stricter audit for Emacs Lisp installs
Require that the subdirectory in site-lisp match the formula name
exactly. This lets us provide better information in the caveats and
will make it easier for helper methods to write to the correct
location (as in in Homebrew/homebrew-emacs#13).
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/caveats.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/formula_cellar_checks.rb | 26 | ||||
| -rw-r--r-- | Library/Homebrew/keg.rb | 2 |
3 files changed, 23 insertions, 12 deletions
diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index e4e880fa2..c1da2c4ea 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -143,12 +143,7 @@ class Caveats if keg && keg.elisp_installed? <<-EOS.undent Emacs Lisp files have been installed to: - #{HOMEBREW_PREFIX}/share/emacs/site-lisp/ - - Add the following to your init file to have packages installed by - Homebrew added to your load-path: - (let ((default-directory "#{HOMEBREW_PREFIX}/share/emacs/site-lisp/")) - (normal-top-level-add-subdirs-to-load-path)) + #{HOMEBREW_PREFIX}/share/emacs/site-lisp/#{f.name} EOS end end diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 071b3f4dd..9622c98e6 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -173,19 +173,34 @@ module FormulaCellarChecks EOS end - def check_emacs_lisp(share, name) + def check_elisp_dirname(share, name) return unless (share/"emacs/site-lisp").directory? + # Emacs itself can do what it wants + return if name == "emacs" + + bad_dir_name = (share/"emacs/site-lisp").children.any? do |child| + child.directory? && child.basename.to_s != name + end + return unless bad_dir_name + <<-EOS + Emacs Lisp files were installed into the wrong site-lisp subdirectory. + They should be installed into: + #{share}/emacs/site-lisp/#{name} + EOS + end + + def check_elisp_root(share, name) + return unless (share/"emacs/site-lisp").directory? # Emacs itself can do what it wants return if name == "emacs" elisps = (share/"emacs/site-lisp").children.select { |file| %w[.el .elc].include? file.extname } return if elisps.empty? - <<-EOS.undent Emacs Lisp files were linked directly to #{HOMEBREW_PREFIX}/share/emacs/site-lisp - - This may cause conflicts with other packages; install to a subdirectory instead, such as + This may cause conflicts with other packages. + They should instead be installed into: #{share}/emacs/site-lisp/#{name} The offending files are: @@ -206,7 +221,8 @@ module FormulaCellarChecks audit_check_output(check_easy_install_pth(formula.lib)) audit_check_output(check_openssl_links) audit_check_output(check_python_framework_links(formula.lib)) - audit_check_output(check_emacs_lisp(formula.share, formula.name)) + audit_check_output(check_elisp_dirname(formula.share, formula.name)) + audit_check_output(check_elisp_root(formula.share, formula.name)) end private diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 9b548b83a..4151895bc 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -263,7 +263,7 @@ class Keg end def elisp_installed? - Dir["#{path}/share/emacs/site-lisp/**/*.el"].any? + (path/"share/emacs/site-lisp"/name).children.any? { |f| %w[.el .elc].include? f.extname } end def version |
