Spec-Zone.ru › Homebrew

Class: Cleaner Private

Inherits:
Object
  • Object
  • Cleaner
show all
Includes:
Context, OS::Linux::Cleaner, OS::Mac::Cleaner, Utils::Output::Mixin
Defined in:
cleaner.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Cleans a newly installed keg. By default:

  • removes .la files
  • removes .tbd files
  • removes perllocal.pod files
  • removes .packlist files
  • removes empty directories
  • sets permissions on executables
  • removes unresolved symlinks

Instance Method Summary collapse

  • #clean ⇒ void private

    Clean the keg of the formula.

  • #initialize(formula) ⇒ void constructor private

    Create a cleaner for the given formula.

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable, #pretty_warning

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(formula) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Create a cleaner for the given formula.

Parameters:

  • formula (Formula)


22
23
24
# File 'cleaner.rb', line 22

def initialize(formula)
  @formula = formula
end

Instance Method Details

#clean ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Clean the keg of the formula.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'cleaner.rb', line 28

def clean
  ObserverPathnameExtension.reset_counts!

  # Many formulae include `lib/charset.alias`, but it is not strictly needed
  # and will conflict if more than one formula provides it.
  observe_file_removal @formula.lib/"charset.alias"

  [@formula.bin, @formula.sbin, @formula.lib].each { |dir| clean_dir(dir) if dir.exist? }

  # Get rid of any info `dir` files, so they don't conflict at the link stage.
  #
  # The `dir` files come in at least 3 locations:
  #
  # 1. `info/dir`
  # 2. `info/#{name}/dir`
  # 3. `info/#{arch}/dir`
  #
  # Of these 3 only `info/#{name}/dir` is safe to keep since the rest will
  # conflict with other formulae because they use a shared location.
  #
  # See
  # [cleaner: recursively delete info `dir`s][1],
  # [emacs 28.1 bottle does not contain `dir` file][2] and
  # [Keep `info/#{f.name}/dir` files in cleaner][3]
  # for more info.
  #
  # [1]: https://github.com/Homebrew/brew/pull/11597
  # [2]: https://github.com/Homebrew/homebrew-core/issues/100190
  # [3]: https://github.com/Homebrew/brew/pull/13215
  @formula.info.glob("**/dir").each do |info_dir_file|
    next unless info_dir_file.file?
    next if info_dir_file == @formula.info/@formula.name/"dir"
    next if @formula.skip_clean?(info_dir_file)

    observe_file_removal info_dir_file
  end

  rewrite_shebangs
  clean_python_metadata

  prune
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Cleaner.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API