language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/extend/os/cmd/info.rb | @@ -1,3 +0,0 @@
-# frozen_string_literal: true
-
-require "extend/os/linux/info" if OS.linux? | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/extend/os/linux/info.rb | @@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-module Homebrew
- module_function
-
- def formula_path
- return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
-
- "formula-linux"
- end
-
- def analytics_path
- return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
-
- "analytics-linux"
- end
-end | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/extend/os/linux/utils/analytics.rb | @@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Utils
+ module Analytics
+ class << self
+ def formula_path
+ return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
+
+ "formula-linux"
+ end
+
+ def analytics_path
+ return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
+
+ "analytics-linux"
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/extend/os/utils/analytics.rb | @@ -1,3 +1,4 @@
# frozen_string_literal: true
+require "extend/os/linux/utils/analytics" if OS.linux?
require "extend/os/mac/utils/analytics" if OS.mac? | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/test/cmd/analytics_spec.rb | @@ -14,7 +14,7 @@
brew "analytics", "off"
expect { brew "analytics", "HOMEBREW_NO_ANALYTICS" => nil }
- .to output(/Analytics is disabled/).to_stdout
+ .to output(/Analytics are disabled/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/test/cmd/info_spec.rb | @@ -22,13 +22,6 @@
describe Homebrew do
let(:remote) { "https://github.com/Homebrew/homebrew-core" }
- specify "::analytics_table" do
- results = { ack: 10, wget: 100 }
- expect { subject.analytics_table("install", "30", results) }
- .to output(/110 | 100.00%/).to_stdout
- .and not_to_output.to_stderr
- end
-
specify "::github_remote_path" do
expect(subject.github_remote_path(remote, "Formula/git.rb"))
.to eq("https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb") | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/test/utils/analytics_spec.rb | @@ -86,4 +86,11 @@
end
end
end
+
+ specify "::table_output" do
+ results = { ack: 10, wget: 100 }
+ expect { described_class.table_output("install", "30", results) }
+ .to output(/110 | 100.00%/).to_stdout
+ .and not_to_output.to_stderr
+ end
end | true |
Other | Homebrew | brew | 3a9f585ebbd1893a034575b49f64a200c5385365.json | Move more code to utils/analytics. | Library/Homebrew/utils/analytics.rb | @@ -5,27 +5,8 @@
module Utils
module Analytics
class << self
- def custom_prefix_label
- "custom-prefix"
- end
-
- def clear_os_prefix_ci
- return unless instance_variable_defined?(:@os_prefix_ci)
-
- remove_instance_variable(:@os_prefix_ci)
- end
-
- def os_prefix_ci
- @os_prefix_ci ||= begin
- os = OS_VERSION
- prefix = ", #{custom_prefix_label}" unless Homebrew.default_prefix?
- ci = ", CI" if ENV["CI"]
- "#{os}#{prefix}#{ci}"
- end
- end
-
def report(type, metadata = {})
- return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"]
+ return if disabled?
args = []
@@ -90,8 +71,268 @@ def report_build_error(exception)
end
report_event("BuildError", action)
end
+
+ def messages_displayed?
+ config_true?(:analyticsmessage) && config_true?(:caskanalyticsmessage)
+ end
+
+ def disabled?
+ return true if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"]
+
+ config_true?(:analyticsdisabled)
+ end
+
+ def no_message_output?
+ # Used by Homebrew/install
+ ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"].present?
+ end
+
+ def uuid
+ config_get(:analyticsuuid)
+ end
+
+ def messages_displayed!
+ config_set(:analyticsmessage, true)
+ config_set(:caskanalyticsmessage, true)
+ end
+
+ def enable!
+ config_set(:analyticsdisabled, false)
+ messages_displayed!
+ end
+
+ def disable!
+ config_set(:analyticsdisabled, true)
+ regenerate_uuid!
+ end
+
+ def regenerate_uuid!
+ # it will be regenerated in next run unless disabled.
+ config_delete(:analyticsuuid)
+ end
+
+ def output(filter: nil)
+ days = Homebrew.args.days || "30"
+ category = Homebrew.args.category || "install"
+ json = formulae_api_json("analytics/#{category}/#{days}d.json")
+ return if json.blank? || json["items"].blank?
+
+ os_version = category == "os-version"
+ cask_install = category == "cask-install"
+ results = {}
+ json["items"].each do |item|
+ key = if os_version
+ item["os_version"]
+ elsif cask_install
+ item["cask"]
+ else
+ item["formula"]
+ end
+ if filter.present?
+ next if key != filter && !key.start_with?("#{filter} ")
+ end
+ results[key] = item["count"].tr(",", "").to_i
+ end
+
+ if filter.present? && results.blank?
+ onoe "No results matching `#{filter}` found!"
+ return
+ end
+
+ table_output(category, days, results, os_version: os_version, cask_install: cask_install)
+ end
+
+ def formula_output(f)
+ json = formulae_api_json("#{formula_path}/#{f}.json")
+ return if json.blank? || json["analytics"].blank?
+
+ full_analytics = Homebrew.args.analytics? || Homebrew.args.verbose?
+
+ ohai "Analytics"
+ json["analytics"].each do |category, value|
+ category = category.tr("_", "-")
+ analytics = []
+
+ value.each do |days, results|
+ days = days.to_i
+ if full_analytics
+ if Homebrew.args.days.present?
+ next if Homebrew.args.days&.to_i != days
+ end
+ if Homebrew.args.category.present?
+ next if Homebrew.args.category != category
+ end
+
+ analytics_table(category, days, results)
+ else
+ total_count = results.values.inject("+")
+ analytics << "#{number_readable(total_count)} (#{days} days)"
+ end
+ end
+
+ puts "#{category}: #{analytics.join(", ")}" unless full_analytics
+ end
+ end
+
+ def custom_prefix_label
+ "custom-prefix"
+ end
+
+ def clear_os_prefix_ci
+ return unless instance_variable_defined?(:@os_prefix_ci)
+
+ remove_instance_variable(:@os_prefix_ci)
+ end
+
+ def os_prefix_ci
+ @os_prefix_ci ||= begin
+ os = OS_VERSION
+ prefix = ", #{custom_prefix_label}" unless Homebrew.default_prefix?
+ ci = ", CI" if ENV["CI"]
+ "#{os}#{prefix}#{ci}"
+ end
+ end
+
+ def table_output(category, days, results, os_version: false, cask_install: false)
+ oh1 "#{category} (#{days} days)"
+ total_count = results.values.inject("+")
+ formatted_total_count = format_count(total_count)
+ formatted_total_percent = format_percent(100)
+
+ index_header = "Index"
+ count_header = "Count"
+ percent_header = "Percent"
+ name_with_options_header = if os_version
+ "macOS Version"
+ elsif cask_install
+ "Token"
+ else
+ "Name (with options)"
+ end
+
+ total_index_footer = "Total"
+ max_index_width = results.length.to_s.length
+ index_width = [
+ index_header.length,
+ total_index_footer.length,
+ max_index_width,
+ ].max
+ count_width = [
+ count_header.length,
+ formatted_total_count.length,
+ ].max
+ percent_width = [
+ percent_header.length,
+ formatted_total_percent.length,
+ ].max
+ name_with_options_width = Tty.width -
+ index_width -
+ count_width -
+ percent_width -
+ 10 # spacing and lines
+
+ formatted_index_header =
+ format "%#{index_width}s", index_header
+ formatted_name_with_options_header =
+ format "%-#{name_with_options_width}s",
+ name_with_options_header[0..name_with_options_width-1]
+ formatted_count_header =
+ format "%#{count_width}s", count_header
+ formatted_percent_header =
+ format "%#{percent_width}s", percent_header
+ puts "#{formatted_index_header} | #{formatted_name_with_options_header} | "\
+ "#{formatted_count_header} | #{formatted_percent_header}"
+
+ columns_line = "#{"-"*index_width}:|-#{"-"*name_with_options_width}-|-"\
+ "#{"-"*count_width}:|-#{"-"*percent_width}:"
+ puts columns_line
+
+ index = 0
+ results.each do |name_with_options, count|
+ index += 1
+ formatted_index = format "%0#{max_index_width}d", index
+ formatted_index = format "%-#{index_width}s", formatted_index
+ formatted_name_with_options =
+ format "%-#{name_with_options_width}s",
+ name_with_options[0..name_with_options_width-1]
+ formatted_count = format "%#{count_width}s", format_count(count)
+ formatted_percent = if total_count.zero?
+ format "%#{percent_width}s", format_percent(0)
+ else
+ format "%#{percent_width}s",
+ format_percent((count.to_i * 100) / total_count.to_f)
+ end
+ puts "#{formatted_index} | #{formatted_name_with_options} | " \
+ "#{formatted_count} | #{formatted_percent}%"
+ next if index > 10
+ end
+ return unless results.length > 1
+
+ formatted_total_footer =
+ format "%-#{index_width}s", total_index_footer
+ formatted_blank_footer =
+ format "%-#{name_with_options_width}s", ""
+ formatted_total_count_footer =
+ format "%#{count_width}s", formatted_total_count
+ formatted_total_percent_footer =
+ format "%#{percent_width}s", formatted_total_percent
+ puts "#{formatted_total_footer} | #{formatted_blank_footer} | "\
+ "#{formatted_total_count_footer} | #{formatted_total_percent_footer}%"
+ end
+
+ def config_true?(key)
+ config_get(key) == "true"
+ end
+
+ def config_get(key)
+ HOMEBREW_REPOSITORY.cd do
+ Utils.popen_read("git", "config", "--get", "homebrew.#{key}").chomp
+ end
+ end
+
+ def config_set(key, value)
+ HOMEBREW_REPOSITORY.cd do
+ safe_system "git", "config", "--replace-all", "homebrew.#{key}", value.to_s
+ end
+ end
+
+ def config_delete(key)
+ HOMEBREW_REPOSITORY.cd do
+ system "git", "config", "--unset-all", "homebrew.#{key}"
+ end
+ end
+
+ def formulae_api_json(endpoint)
+ return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_GITHUB_API"]
+
+ output, = curl_output("--max-time", "5",
+ "https://formulae.brew.sh/api/#{endpoint}")
+ return if output.blank?
+
+ JSON.parse(output)
+ rescue JSON::ParserError
+ nil
+ end
+
+ def format_count(count)
+ count.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
+ end
+
+ def format_percent(percent)
+ format("%<percent>.2f", percent: percent)
+ end
+
+ def formula_path
+ "formula"
+ end
+ alias generic_formula_path formula_path
+
+ def analytics_path
+ "analytics"
+ end
+ alias generic_analytics_path analytics_path
end
end
end
-require "extend/os/analytics"
+require "extend/os/utils/analytics" | true |
Other | Homebrew | brew | 727f9671c7a7ef0644b931fda17c1d4467cd4eb6.json | info: show Linux formulae details and analytics
- This makes use of the new /api/formula-linux and /api/analytics-linux
endpoints in formulae.brew.sh to give Linux users up to date formula and
analytics info for their installed core formulae.
Before, on Linux, the macOS stats for the `ack` formula:
```
$ brew info ack
[...]
==> Analytics
install: 12,422 (30 days), 32,742 (90 days), 97,788 (365 days)
install_on_request: 10,778 (30 days), 28,339 (90 days), 85,202 (365 days)
build_error: 0 (30 days)
```
Now, on Linux, the Linux stats for the `ack` formula:
```
$ brew info ack
[...]
==> Analytics
install: 95 (30 days), 242 (90 days), 737 (365 days)
install_on_request: 94 (30 days), 241 (90 days), 734 (365 days)
build_error: 0 (30 days)
``` | Library/Homebrew/cmd/info.rb | @@ -368,7 +368,7 @@ def output_analytics(filter: nil)
end
def output_formula_analytics(f)
- json = formulae_api_json("formula/#{f}.json")
+ json = formulae_api_json("#{formula_path}/#{f}.json")
return if json.blank? || json["analytics"].blank?
full_analytics = args.analytics? || args.verbose?
@@ -431,4 +431,16 @@ def format_count(count)
def format_percent(percent)
format("%<percent>.2f", percent: percent)
end
+
+ def formula_path
+ "formula"
+ end
+ alias_method :generic_formula_path, :formula_path
+
+ def analytics_path
+ "analytics"
+ end
+ alias_method :generic_analytics_path, :analytics_path
+
+ require "extend/os/cmd/info"
end | true |
Other | Homebrew | brew | 727f9671c7a7ef0644b931fda17c1d4467cd4eb6.json | info: show Linux formulae details and analytics
- This makes use of the new /api/formula-linux and /api/analytics-linux
endpoints in formulae.brew.sh to give Linux users up to date formula and
analytics info for their installed core formulae.
Before, on Linux, the macOS stats for the `ack` formula:
```
$ brew info ack
[...]
==> Analytics
install: 12,422 (30 days), 32,742 (90 days), 97,788 (365 days)
install_on_request: 10,778 (30 days), 28,339 (90 days), 85,202 (365 days)
build_error: 0 (30 days)
```
Now, on Linux, the Linux stats for the `ack` formula:
```
$ brew info ack
[...]
==> Analytics
install: 95 (30 days), 242 (90 days), 737 (365 days)
install_on_request: 94 (30 days), 241 (90 days), 734 (365 days)
build_error: 0 (30 days)
``` | Library/Homebrew/extend/os/cmd/info.rb | @@ -0,0 +1,3 @@
+# frozen_string_literal: true
+
+require "extend/os/linux/info" if OS.linux? | true |
Other | Homebrew | brew | 727f9671c7a7ef0644b931fda17c1d4467cd4eb6.json | info: show Linux formulae details and analytics
- This makes use of the new /api/formula-linux and /api/analytics-linux
endpoints in formulae.brew.sh to give Linux users up to date formula and
analytics info for their installed core formulae.
Before, on Linux, the macOS stats for the `ack` formula:
```
$ brew info ack
[...]
==> Analytics
install: 12,422 (30 days), 32,742 (90 days), 97,788 (365 days)
install_on_request: 10,778 (30 days), 28,339 (90 days), 85,202 (365 days)
build_error: 0 (30 days)
```
Now, on Linux, the Linux stats for the `ack` formula:
```
$ brew info ack
[...]
==> Analytics
install: 95 (30 days), 242 (90 days), 737 (365 days)
install_on_request: 94 (30 days), 241 (90 days), 734 (365 days)
build_error: 0 (30 days)
``` | Library/Homebrew/extend/os/linux/info.rb | @@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Homebrew
+ module_function
+
+ def formula_path
+ return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
+
+ "formula-linux"
+ end
+
+ def analytics_path
+ return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
+
+ "analytics-linux"
+ end
+end | true |
Other | Homebrew | brew | fbf4b0432d18e48b3b611b135e9b2e177e4e958d.json | Rescue more errors during `cask upgrade`. | Library/Homebrew/cask/cmd/upgrade.rb | @@ -46,7 +46,7 @@ def run
upgradable_casks.each do |(old_cask, new_cask)|
upgrade_cask(old_cask, new_cask)
- rescue CaskError => e
+ rescue => e
caught_exceptions << e
next
end
@@ -103,7 +103,7 @@ def upgrade_cask(old_cask, new_cask)
# If successful, wipe the old Cask from staging
old_cask_installer.finalize_upgrade
- rescue CaskError => e
+ rescue => e
new_cask_installer.uninstall_artifacts if new_artifacts_installed
new_cask_installer.purge_versioned_files
old_cask_installer.revert_upgrade if started_upgrade | false |
Other | Homebrew | brew | c7f065b8da7a0da65bc5a39a156a6a14eb28f834.json | utils/github.rb: use parallel assignments rather than indices
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/utils/github.rb | @@ -341,8 +341,8 @@ def create_fork(repo)
end
def check_fork_exists(repo)
- username = api_credentials[1]
- reponame = repo.split("/")[1]
+ _, username = api_credentials
+ _, reponame = repo.split("/")
json = open_api(url_to("repos", username, reponame))
return false if json["message"] == "Not Found"
| false |
Other | Homebrew | brew | ba7a05a9194458604d0feaad5c15e2565b61930f.json | bump-formula-pr.rb: Apply suggestions from code review
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -388,10 +388,10 @@ def forked_repo_info(tap_full_name)
else
# GitHub API responds immediately but fork takes a few seconds to be ready.
sleep 1 until GitHub.check_fork_exists(tap_full_name)
- if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
- remote_url = response.fetch("ssh_url")
+ remote_url = if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
+ response.fetch("ssh_url")
else
- remote_url = response.fetch("clone_url")
+ response.fetch("clone_url")
end
username = response.fetch("owner").fetch("login")
[remote_url, username] | false |
Other | Homebrew | brew | b4ff330ac1dc9d6ee60fdbcd1b3e0542c7416457.json | shims/super/cc: remove isysroot space to fix cpp
Fixes #5153 | Library/Homebrew/shims/super/cc | @@ -114,7 +114,7 @@ class Cmd
if tool == "ld"
args << "-syslibroot" << sysroot
else
- args << "-isysroot" << sysroot << "--sysroot=#{sysroot}"
+ args << "-isysroot#{sysroot}" << "--sysroot=#{sysroot}"
end
end
@@ -213,7 +213,7 @@ class Cmd
if mac?
sdk = enum.next
# We set the sysroot for macOS SDKs
- args << "-isysroot" << sdk unless sdk.downcase.include? "osx"
+ args << "-isysroot#{sdk}" unless sdk.downcase.include? "osx"
else
args << arg << enum.next
end | false |
Other | Homebrew | brew | 3cb2d62a1b13d4e71c8c5deeb6250fc594f14ec8.json | formula: copy hidden files from bottles. | Library/Homebrew/formula.rb | @@ -20,6 +20,7 @@
require "language/python"
require "tab"
require "mktemp"
+require "find"
# A formula provides instructions and metadata for Homebrew to install a piece
# of software. Every Homebrew formula is a {Formula}.
@@ -998,7 +999,9 @@ def run_post_install
with_env(new_env) do
ENV.clear_sensitive_environment!
- Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path|
+ etc_var_dirs = [bottle_prefix/"etc", bottle_prefix/"var"]
+ Find.find(*etc_var_dirs.select(&:directory?)) do |path|
+ path = Pathname.new(path)
path.extend(InstallRenamed)
path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX)
end | false |
Other | Homebrew | brew | 1ab86acb0fb13bb9f52189a2ca410c461ce084fc.json | move methods to analytics_table function | Library/Homebrew/cmd/info.rb | @@ -231,6 +231,18 @@ def formulae_api_json(endpoint)
end
def analytics_table(category, days, results, os_version: false, cask_install: false)
+ valid_days = %w[30 90 365]
+ if days.present?
+ raise UsageError, "day must be one of #{valid_days.join(", ")}" unless valid_days.include?(days.to_s)
+ end
+
+ valid_categories = %w[install install-on-request cask-install build-error os-version]
+ if category.present?
+ unless valid_categories.include?(category.tr("_", "-"))
+ raise UsageError, "category must be one of #{valid_categories.join(", ")}"
+ end
+ end
+
oh1 "#{category} (#{days} days)"
total_count = results.values.inject("+")
formatted_total_count = format_count(total_count)
@@ -357,8 +369,6 @@ def output_analytics(filter: nil)
end
def output_formula_analytics(f)
- valid_days = %w[30 90 365]
- valid_categories = %w[install install-on-request build-error]
json = formulae_api_json("formula/#{f}.json")
return if json.blank? || json["analytics"].blank?
@@ -372,14 +382,10 @@ def output_formula_analytics(f)
days = days.to_i
if full_analytics
if args.days.present?
- raise UsageError, "day must be one of #{valid_days.join(", ")}" unless valid_days.include?(args.days)
next if args.days&.to_i != days
end
if args.category.present?
- unless valid_categories.include?(args.category)
- raise UsageError, "category must be one of #{valid_categories.join(", ")}"
- end
next if args.category.tr("-", "_") != category
end
| false |
Other | Homebrew | brew | d6d857c154fb9cdb7dc1f81a1cc8a2302b9a3996.json | cmd/upgrade: fix exit logic.
Fixes #6739 | Library/Homebrew/cmd/upgrade.rb | @@ -81,7 +81,7 @@ def upgrade
opoo "#{f.full_specified_name} #{version} already installed"
end
end
- exit
+ return if outdated.empty?
end
pinned = outdated.select(&:pinned?) | false |
Other | Homebrew | brew | 38f9e6b0442ded3f28630825b97c5b4972c36206.json | README: add GitHub Sponsors link.
Let people know we support this now. Don't need a dedicated link because we have one at the top of the page. | README.md | @@ -57,7 +57,7 @@ Documentation is under the [Creative Commons Attribution license](https://creati
## Donations
Homebrew is a non-profit project run entirely by unpaid volunteers. We need your funds to pay for software, hardware and hosting around continuous integration and future improvements to the project. Every donation will be spent on making Homebrew better for our users.
-Please consider a regular donation through Patreon:
+Please consider a regular donation through [GitHub Sponsors](https://github.com/sponsors/Homebrew) or [Patreon](https://www.patreon.com/homebrew):
[](https://www.patreon.com/homebrew)
| false |
Other | Homebrew | brew | 8244a869f63f7d10e8533df7705a7fec5d596315.json | add empty line after guard clause | Library/Homebrew/cmd/info.rb | @@ -371,6 +371,7 @@ def output_formula_analytics(f)
if full_analytics
next if args.days.present? && args.days&.to_i != days
next if args.category.present? && args.category != category
+
analytics_table(category, days, results)
else
total_count = results.values.inject("+") | false |
Other | Homebrew | brew | b4f8671849e7bdac249c0d220cf25d054b956eaa.json | formula_installer: copy hidden files into bottles. | Library/Homebrew/formula_installer.rb | @@ -18,6 +18,7 @@
require "install"
require "messages"
require "cask/cask_loader"
+require "find"
class FormulaInstaller
include FormulaCellarChecks
@@ -201,12 +202,12 @@ def check_install_sanity
end
def build_bottle_preinstall
- @etc_var_glob ||= "#{HOMEBREW_PREFIX}/{etc,var}/**/*"
- @etc_var_preinstall = Dir[@etc_var_glob]
+ @etc_var_dirs ||= [HOMEBREW_PREFIX/"etc", HOMEBREW_PREFIX/"var"]
+ @etc_var_preinstall = Find.find(*@etc_var_dirs.select(&:directory?)).to_a
end
def build_bottle_postinstall
- @etc_var_postinstall = Dir[@etc_var_glob]
+ @etc_var_postinstall = Find.find(*@etc_var_dirs.select(&:directory?)).to_a
(@etc_var_postinstall - @etc_var_preinstall).each do |file|
Pathname.new(file).cp_path_sub(HOMEBREW_PREFIX, formula.bottle_prefix)
end | false |
Other | Homebrew | brew | f3afedb4ff2c43d6840dfbdc5dc6a8c157c9489e.json | utils#system: improve verbose output.
This previously output the hilarious long and unnecessary LOAD_PATH. | Library/Homebrew/dev-cmd/ruby.rb | @@ -26,7 +26,7 @@ def ruby
ruby_args.parse
begin
- safe_system ENV["HOMEBREW_RUBY_PATH"],
+ safe_system RUBY_PATH,
"-I", $LOAD_PATH.join(File::PATH_SEPARATOR),
"-rglobal", "-rdev-cmd/irb",
*ARGV | true |
Other | Homebrew | brew | f3afedb4ff2c43d6840dfbdc5dc6a8c157c9489e.json | utils#system: improve verbose output.
This previously output the hilarious long and unnecessary LOAD_PATH. | Library/Homebrew/utils.rb | @@ -35,7 +35,10 @@ def _system(cmd, *args, **options)
end
def system(cmd, *args, **options)
- puts "#{cmd} #{args * " "}" if ARGV.verbose?
+ if ARGV.verbose?
+ puts "#{cmd} #{args * " "}".gsub(RUBY_PATH, "ruby")
+ .gsub($LOAD_PATH.join(File::PATH_SEPARATOR).to_s, "$LOAD_PATH")
+ end
_system(cmd, *args, **options)
end
| true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/cmd/tap-pin.rb | @@ -7,29 +7,12 @@ module Homebrew
def tap_pin_args
Homebrew::CLI::Parser.new do
- usage_banner <<~EOS
- `tap-pin` <tap>
-
- Pin <tap>, prioritising its formulae over core when formula names are supplied
- by the user. See also `tap-unpin`.
- EOS
- switch :debug
hide_from_man_page!
end
end
def tap_pin
- odeprecated "brew tap-pin user/tap",
- "fully-scoped user/tap/formula naming"
-
- tap_pin_args.parse
-
- ARGV.named.each do |name|
- tap = Tap.fetch(name)
- raise "pinning #{tap} is not allowed" if tap.core_tap?
-
- tap.pin
- ohai "Pinned #{tap}"
- end
+ odisabled "brew tap-pin user/tap",
+ "fully-scoped user/tap/formula naming"
end
end | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/cmd/tap-unpin.rb | @@ -7,28 +7,12 @@ module Homebrew
def tap_unpin_args
Homebrew::CLI::Parser.new do
- usage_banner <<~EOS
- `tap-unpin` <tap>
-
- Unpin <tap> so its formulae are no longer prioritised. See also `tap-pin`.
- EOS
- switch :debug
hide_from_man_page!
end
end
def tap_unpin
- odeprecated "brew tap-pin user/tap",
- "fully-scoped user/tap/formula naming"
-
- tap_unpin_args.parse
-
- ARGV.named.each do |name|
- tap = Tap.fetch(name)
- raise "unpinning #{tap} is not allowed" if tap.core_tap?
-
- tap.unpin
- ohai "Unpinned #{tap}"
- end
+ odisabled "brew tap-pin user/tap",
+ "fully-scoped user/tap/formula naming"
end
end | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/compat/cask/dsl/version.rb | @@ -5,18 +5,15 @@ class DSL
class Version < ::String
module Compat
def dots_to_slashes
- odeprecated "#dots_to_slashes"
- version { tr(".", "/") }
+ odisabled "#dots_to_slashes"
end
def hyphens_to_slashes
- odeprecated "#hyphens_to_slashes"
- version { tr("-", "/") }
+ odisabled "#hyphens_to_slashes"
end
def underscores_to_slashes
- odeprecated "#underscores_to_slashes"
- version { tr("_", "/") }
+ odisabled "#underscores_to_slashes"
end
end
| true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/compat/requirements/macos_requirement.rb | @@ -11,9 +11,8 @@ def initialize(tags = [], comparator: ">=")
sym = MacOS::Version.new(v).to_sym
- odeprecated "depends_on macos: #{v.inspect}", "depends_on macos: #{sym.inspect}",
- disable_on: Time.parse("2019-10-15")
-
+ odisabled "depends_on macos: #{v.inspect}",
+ "depends_on macos: #{sym.inspect}"
sym
end
@@ -22,8 +21,8 @@ def initialize(tags = [], comparator: ">=")
v, *rest = tags
sym = MacOS::Version.new(v).to_sym
- odeprecated "depends_on macos: #{v.inspect}", "depends_on macos: #{sym.inspect}",
- disable_on: Time.parse("2019-10-15")
+ odisabled "depends_on macos: #{v.inspect}",
+ "depends_on macos: #{sym.inspect}"
tags = [sym, *rest]
end | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/dev-cmd/bottle.rb | @@ -28,7 +28,7 @@
<% checksums.each do |checksum_type, checksum_values| %>
<% checksum_values.each do |checksum_value| %>
<% checksum, macos = checksum_value.shift %>
- <%= checksum_type %> "<%= checksum %>" => :<%= macos %><%= "_or_later" if Homebrew.args.or_later? %>
+ <%= checksum_type %> "<%= checksum %>" => :<%= macos %>
<% end %>
<% end %>
end
@@ -52,8 +52,6 @@ def bottle_args
EOS
switch "--skip-relocation",
description: "Do not check if the bottle can be marked as relocatable."
- switch "--or-later",
- description: "Append `_or_later` to the bottle tag."
switch "--force-core-tap",
description: "Build a bottle even if <formula> is not in `homebrew/core` or any installed taps."
switch "--no-rebuild",
@@ -396,8 +394,6 @@ def bottle_formula(f)
return unless args.json?
- tag = Utils::Bottles.tag.to_s
- tag += "_or_later" if args.or_later?
json = {
f.full_name => {
"formula" => {
@@ -410,7 +406,7 @@ def bottle_formula(f)
"cellar" => bottle.cellar.to_s,
"rebuild" => bottle.rebuild,
"tags" => {
- tag => {
+ Utils::Bottles.tag.to_s => {
"filename" => filename.bintray,
"local_filename" => filename.to_s,
"sha256" => sha256, | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/extend/os/mac/utils/bottles.rb | @@ -25,25 +25,18 @@ def find_matching_tag(tag)
end
end
- def tag_without_or_later(tag)
- tag
- end
-
# Find a bottle built for a previous version of macOS.
def find_older_compatible_tag(tag)
- begin
- tag_version = MacOS::Version.from_symbol(tag)
+ tag_version = begin
+ MacOS::Version.from_symbol(tag)
rescue ArgumentError
return
end
keys.find do |key|
- key_tag_version = tag_without_or_later(key)
- begin
- MacOS::Version.from_symbol(key_tag_version) <= tag_version
- rescue ArgumentError
- false
- end
+ MacOS::Version.from_symbol(key) <= tag_version
+ rescue ArgumentError
+ false
end
end
end | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/formulary.rb | @@ -490,14 +490,8 @@ def self.find_with_priority(ref, spec = :stable)
if possible_pinned_tap_formulae.size == 1
selected_formula = factory(possible_pinned_tap_formulae.first, spec)
if core_path(ref).file?
- odeprecated "brew tap-pin user/tap",
- "fully-scoped user/tap/formula naming"
- opoo <<~EOS
- #{ref} is provided by core, but is now shadowed by #{selected_formula.full_name}.
- This behaviour is deprecated and will be removed in Homebrew 2.2.0.
- To refer to the core formula, use Homebrew/core/#{ref} instead.
- To refer to the tap formula, use #{selected_formula.full_name} instead.
- EOS
+ odisabled "brew tap-pin user/tap",
+ "fully-scoped user/tap/formula naming"
end
selected_formula
else | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | Library/Homebrew/software_spec.rb | @@ -261,7 +261,7 @@ def self.create(formula, tag, rebuild)
def initialize(name, version, tag, rebuild)
@name = File.basename name
@version = version
- @tag = tag.to_s.gsub(/_or_later$/, "")
+ @tag = tag.to_s
@rebuild = rebuild
end
| true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | docs/Manpage.md | @@ -717,8 +717,6 @@ at its original value, while `--no-rebuild` will remove it.
* `--skip-relocation`:
Do not check if the bottle can be marked as relocatable.
-* `--or-later`:
- Append `_or_later` to the bottle tag.
* `--force-core-tap`:
Build a bottle even if *`formula`* is not in `homebrew/core` or any installed taps.
* `--no-rebuild`: | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | manpages/brew-cask.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW\-CASK" "1" "October 2019" "Homebrew" "brew-cask"
+.TH "BREW\-CASK" "1" "November 2019" "Homebrew" "brew-cask"
.
.SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS | true |
Other | Homebrew | brew | 176297d361e68ae3deeacb76c20245dfb08998e5.json | Handle 2.2.0 deprecations/disableds
- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles | manpages/brew.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW" "1" "October 2019" "Homebrew" "brew"
+.TH "BREW" "1" "November 2019" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The missing package manager for macOS
@@ -898,10 +898,6 @@ Generate a bottle (binary package) from a formula that was installed with \fB\-\
Do not check if the bottle can be marked as relocatable\.
.
.TP
-\fB\-\-or\-later\fR
-Append \fB_or_later\fR to the bottle tag\.
-.
-.TP
\fB\-\-force\-core\-tap\fR
Build a bottle even if \fIformula\fR is not in \fBhomebrew/core\fR or any installed taps\.
. | true |
Other | Homebrew | brew | 95a1c8570a28ac98ff1266e45b00122a025b22cf.json | cleanup: rescue more cask errors.
This will avoid a wider degree of failures. | Library/Homebrew/cleanup.rb | @@ -97,7 +97,7 @@ def stale_cask?(scrub)
cask = begin
Cask::CaskLoader.load(name)
- rescue Cask::CaskUnavailableError
+ rescue Cask::CaskError
return false
end
@@ -196,7 +196,7 @@ def clean!(quiet: false, periodic: false)
cask = begin
Cask::CaskLoader.load(arg)
- rescue Cask::CaskUnavailableError
+ rescue Cask::CaskError
nil
end
| false |
Other | Homebrew | brew | 6a3395988831a4fab8a187c292738af2e82b5d2c.json | test/subversion: fix subversion paths/detection. | Library/Homebrew/test/spec_helper.rb | @@ -124,8 +124,19 @@
end
config.before(:each, :needs_svn) do
- homebrew_bin = File.dirname HOMEBREW_BREW_FILE
- skip "subversion not installed." unless %W[/usr/bin/svn #{homebrew_bin}/svn].map { |x| File.executable?(x) }.any?
+ svn_paths = PATH.new(ENV["PATH"])
+ if OS.mac?
+ xcrun_svn = Utils.popen_read("xcrun", "-f", "svn")
+ svn_paths.append(File.dirname(xcrun_svn)) if $CHILD_STATUS.success? && xcrun_svn.present?
+ end
+
+ svn = which("svn", svn_paths)
+ svnadmin = which("svnadmin", svn_paths)
+ skip "subversion not installed." if !svn || !svnadmin
+
+ ENV["PATH"] = PATH.new(ENV["PATH"])
+ .append(svn.dirname)
+ .append(svnadmin.dirname)
end
config.before(:each, :needs_unzip) do | true |
Other | Homebrew | brew | 6a3395988831a4fab8a187c292738af2e82b5d2c.json | test/subversion: fix subversion paths/detection. | Library/Homebrew/test/unpack_strategy/subversion_spec.rb | @@ -8,9 +8,7 @@
let(:path) { working_copy }
before do
- svnadmin = ["svnadmin"]
- svnadmin = ["xcrun", *svnadmin] if OS.mac? && MacOS.version >= :catalina
- safe_system(*svnadmin, "create", repo)
+ safe_system "svnadmin", "create", repo
safe_system "svn", "checkout", "file://#{repo}", working_copy
FileUtils.touch working_copy/"test" | true |
Other | Homebrew | brew | 924af100b73d24dffb2199fa46ae118e8b3bbb29.json | cask/pkg_spec: remove flaky test. | Library/Homebrew/test/cask/pkg_spec.rb | @@ -6,34 +6,6 @@
let(:empty_response) { double(stdout: "", plist: { "volume" => "/", "install-location" => "", "paths" => {} }) }
let(:pkg) { described_class.new("my.fake.pkg", fake_system_command) }
- it "removes files and dirs referenced by the pkg" do
- some_files = Array.new(3) { Pathname.new(Tempfile.new("plain_file").path) }
- allow(pkg).to receive(:pkgutil_bom_files).and_return(some_files)
-
- some_specials = Array.new(3) { Pathname.new(Tempfile.new("special_file").path) }
- allow(pkg).to receive(:pkgutil_bom_specials).and_return(some_specials)
-
- some_dirs = Array.new(3) { mktmpdir }
- allow(pkg).to receive(:pkgutil_bom_dirs).and_return(some_dirs)
-
- root_dir = Pathname.new(mktmpdir)
- allow(pkg).to receive(:root).and_return(root_dir)
-
- allow(pkg).to receive(:forget)
-
- pkg.uninstall
-
- some_files.each do |file|
- expect(file).not_to exist
- end
-
- some_dirs.each do |dir|
- expect(dir).not_to exist
- end
-
- expect(root_dir).not_to exist
- end
-
context "pkgutil" do
it "forgets the pkg" do
allow(fake_system_command).to receive(:run!).with( | false |
Other | Homebrew | brew | 6670ae620229d7030b0e0feee96cd550c686e117.json | global: require rubygems for activesupport. | Library/Homebrew/cask/dsl/depends_on.rb | @@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "rubygems"
-
module Cask
class DSL
class DependsOn < DelegateClass(Hash) | true |
Other | Homebrew | brew | 6670ae620229d7030b0e0feee96cd550c686e117.json | global: require rubygems for activesupport. | Library/Homebrew/cask/installer.rb | @@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "rubygems"
-
require "formula_installer"
require "unpack_strategy"
| true |
Other | Homebrew | brew | 6670ae620229d7030b0e0feee96cd550c686e117.json | global: require rubygems for activesupport. | Library/Homebrew/formula_assertions.rb | @@ -2,7 +2,6 @@
module Homebrew
module Assertions
- require "rubygems"
require "test/unit/assertions"
include ::Test::Unit::Assertions
| true |
Other | Homebrew | brew | 6670ae620229d7030b0e0feee96cd550c686e117.json | global: require rubygems for activesupport. | Library/Homebrew/global.rb | @@ -9,6 +9,7 @@
require_relative "load_path"
+require "rubygems"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/numeric/time"
require "active_support/core_ext/array/access" | true |
Other | Homebrew | brew | 6670ae620229d7030b0e0feee96cd550c686e117.json | global: require rubygems for activesupport. | Library/Homebrew/test/cask/cmd/style_spec.rb | @@ -1,7 +1,6 @@
# frozen_string_literal: true
require "open3"
-require "rubygems"
require_relative "shared_examples/invalid_option"
| true |
Other | Homebrew | brew | 6670ae620229d7030b0e0feee96cd550c686e117.json | global: require rubygems for activesupport. | Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb | @@ -88,7 +88,6 @@ def brew(*args)
"-I", $LOAD_PATH.join(File::PATH_SEPARATOR)
]
if ENV["HOMEBREW_TESTS_COVERAGE"]
- require "rubygems"
simplecov_spec = Gem.loaded_specs["simplecov"]
specs = [simplecov_spec]
simplecov_spec.runtime_dependencies.each do |dep| | true |
Other | Homebrew | brew | b6116c5a0323c61bd49ce19919f667b5b41bedd5.json | deps: use Formulary factory cache. | Library/Homebrew/cmd/deps.rb | @@ -58,6 +58,9 @@ def deps_args
def deps
deps_args.parse
+
+ Formulary.enable_factory_cache!
+
mode = OpenStruct.new(
installed?: args.installed?,
tree?: args.tree?, | false |
Other | Homebrew | brew | 22795d7e306704527137d3c1920bae358b00ab03.json | spec_helper: do cache clearing in single location. | Library/Homebrew/test/dependency_collector_spec.rb | @@ -13,10 +13,6 @@ def find_requirement(klass)
subject.requirements.find { |req| req.is_a? klass }
end
- after do
- described_class.clear_cache
- end
-
describe "#add" do
specify "dependency creation" do
subject.add "foo" => :build | true |
Other | Homebrew | brew | 22795d7e306704527137d3c1920bae358b00ab03.json | spec_helper: do cache clearing in single location. | Library/Homebrew/test/missing_formula_spec.rb | @@ -38,7 +38,6 @@
subject { described_class.tap_migration_reason(formula) }
before do
- Tap.clear_cache
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
tap_path.mkpath
(tap_path/"tap_migrations.json").write <<~JSON
@@ -63,7 +62,6 @@
subject { described_class.deleted_reason(formula, silent: true) }
before do
- Tap.clear_cache
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
tap_path.mkpath
(tap_path/"deleted-formula.rb").write "placeholder" | true |
Other | Homebrew | brew | 22795d7e306704527137d3c1920bae358b00ab03.json | spec_helper: do cache clearing in single location. | Library/Homebrew/test/os/linux/dependency_collector_spec.rb | @@ -5,10 +5,6 @@
describe DependencyCollector do
alias_matcher :be_a_build_requirement, :be_build
- after do
- described_class.clear_cache
- end
-
describe "#add" do
resource = Resource.new
| true |
Other | Homebrew | brew | 22795d7e306704527137d3c1920bae358b00ab03.json | spec_helper: do cache clearing in single location. | Library/Homebrew/test/os/mac/dependency_collector_spec.rb | @@ -5,10 +5,6 @@
describe DependencyCollector do
alias_matcher :need_tar_xz_dependency, :be_tar_needs_xz_dependency
- after do
- described_class.clear_cache
- end
-
specify "Resource dependency from a '.xz' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.tar.xz") | true |
Other | Homebrew | brew | 22795d7e306704527137d3c1920bae358b00ab03.json | spec_helper: do cache clearing in single location. | Library/Homebrew/test/spec_helper.rb | @@ -145,9 +145,13 @@ def find_files
begin
Homebrew.raise_deprecation_exceptions = true
+
+ Formulary.clear_cache
+ Tap.clear_cache
+ DependencyCollector.clear_cache
Formula.clear_cache
Keg.clear_cache
- Tap.clear_cache
+ Tab.clear_cache
FormulaInstaller.clear_attempted
TEST_DIRECTORIES.each(&:mkpath)
@@ -178,9 +182,12 @@ def find_files
@__stderr.close
end
- Tab.clear_cache
+ Formulary.clear_cache
+ Tap.clear_cache
+ DependencyCollector.clear_cache
Formula.clear_cache
Keg.clear_cache
+ Tab.clear_cache
FileUtils.rm_rf [
TEST_DIRECTORIES.map(&:children), | true |
Other | Homebrew | brew | 22795d7e306704527137d3c1920bae358b00ab03.json | spec_helper: do cache clearing in single location. | Library/Homebrew/test/tap_spec.rb | @@ -78,8 +78,6 @@ def setup_git_repo
expect {
described_class.fetch("homebrew", "homebrew/baz")
}.to raise_error(/Invalid tap name/)
- ensure
- described_class.clear_cache
end
describe "::from_path" do | true |
Other | Homebrew | brew | 893474d0374125c832f06e3d4e90c847095e62e7.json | formulary: add cache to factory. | Library/Homebrew/formulary.rb | @@ -9,6 +9,14 @@
module Formulary
extend Cachable
+ def self.enable_factory_cache!
+ @factory_cache = true
+ end
+
+ def self.factory_cached?
+ !@factory_cache.nil?
+ end
+
def self.formula_class_defined?(path)
cache.key?(path)
end
@@ -314,7 +322,18 @@ def klass
def self.factory(ref, spec = :stable, alias_path: nil, from: nil)
raise ArgumentError, "Formulae must have a ref!" unless ref
- loader_for(ref, from: from).get_formula(spec, alias_path: alias_path)
+ cache_key = "#{ref}-#{spec}-#{alias_path}-#{from}"
+ if factory_cached? && cache[:formulary_factory] &&
+ cache[:formulary_factory][cache_key]
+ return cache[:formulary_factory][cache_key]
+ end
+
+ formula = loader_for(ref, from: from).get_formula(spec, alias_path: alias_path)
+ if factory_cached?
+ cache[:formulary_factory] ||= {}
+ cache[:formulary_factory][cache_key] ||= formula
+ end
+ formula
end
# Return a Formula instance for the given rack. | false |
Other | Homebrew | brew | 7d77a9e97d43ee5bda273277da093078e00325b5.json | formula: add runtime_installed_formula_dependents method. | Library/Homebrew/formula.rb | @@ -1570,6 +1570,23 @@ def runtime_formula_dependencies(read_from_tab: true, undeclared: true)
end.compact
end
+ def runtime_installed_formula_dependents
+ # `opt_or_installed_prefix_keg` and `runtime_dependencies` `select`s ensure
+ # that we don't end up with something `Formula#runtime_dependencies` can't
+ # read from a `Tab`.
+ Formula.cache[:runtime_installed_formula_dependents] = {}
+ Formula.cache[:runtime_installed_formula_dependents][name] ||= Formula.installed
+ .select(&:opt_or_installed_prefix_keg)
+ .select(&:runtime_dependencies)
+ .select do |f|
+ f.runtime_formula_dependencies.any? do |dep|
+ full_name == dep.full_name
+ rescue
+ name == dep.name
+ end
+ end
+ end
+
# Returns a list of formulae depended on by this formula that aren't
# installed
def missing_dependencies(hide: nil) | false |
Other | Homebrew | brew | add10c64f12d65e7d1950633c991c1c78ca59b27.json | Linux Maintainer Guide: Reflect recent changes to tap commands
- We recently changed the name of the Linux commands tap from
Linuxbrew/homebrew-developer to Homebrew/homebrew-linux-dev in our
continual efforts to move away from the Linuxbrew name. Related to
this, we changed the comment produced by `brew build-bottle-pr` to
simply "Linux".
- We also [changed `brew
find-formulae-to-bottle`](https://github.com/Homebrew/homebrew-linux-dev/pull/130)
so that it will build a bottle for a formula even if it has a macOS
requirement. There were cases like `go` that build perfectly fine on
Linux. | docs/Homebrew-linuxbrew-core-Maintainer-Guide.md | @@ -219,7 +219,7 @@ running `git push your-fork master`
After merging changes, we must rebuild bottles for all the PRs that
had conflicts.
-To do this, tap `Linuxbrew/homebrew-developer` and run the following
+To do this, tap `Homebrew/homebrew-linux-dev` and run the following
command where the merge commit is `HEAD`:
```sh
@@ -235,7 +235,6 @@ against the formulae:
And it skips formulae if any of the following are true:
- it doesn't need a bottle
- it already has a bottle
-- the formula depends on macOS to build
- the formula's tap is Homebrew/homebrew-core (the upstream macOS repo)
- there is already an open PR for the formula's bottle
- the current branch is not master
@@ -246,7 +245,7 @@ run `brew find-formulae-to-bottle --verbose` separate to the `for`
loop above.
The `build-bottle-pr` script creates a branch called `bottle-<FORMULA>`, adds `# Build a bottle
-for Linuxbrew` to the top of the formula, pushes the branch to GitHub
+for Linux` to the top of the formula, pushes the branch to GitHub
at the specified remote (default: `origin`), and opens a pull request using `hub
pull-request`.
| false |
Other | Homebrew | brew | 7349178adcd32d0ebc301d7683a8353babfab37d.json | move comments outside the 'for cmd' loop | bin/brew | @@ -19,10 +19,12 @@ symlink_target_directory() {
quiet_cd "$directory" && quiet_cd "$target_dirname" && pwd -P
}
+# Unset functions that override Bash builtins
+# Enable all Bash builtins
for cmd in $(compgen -A builtin)
do
- unset -f $cmd # Unset functions that override Bash builtins
- enable $cmd # Enable all Bash builtins
+ unset -f $cmd
+ enable $cmd
done
unset cmd
| false |
Other | Homebrew | brew | 81db0e9551f213b6ddc94d7bbad1128cc8591a51.json | dev-cmd: enable frozen string literals
Now that we use Ruby 2.6 we can fix these last two files. | Library/Homebrew/dev-cmd/bottle.rb | @@ -1,6 +1,4 @@
-# Uses ERB so can't use Frozen String Literals until >=Ruby 2.4:
-# https://bugs.ruby-lang.org/issues/12031
-# frozen_string_literal: false
+# frozen_string_literal: true
require "formula"
require "utils/bottles"
@@ -11,7 +9,7 @@
require "utils/inreplace"
require "erb"
-BOTTLE_ERB = <<-EOS.freeze
+BOTTLE_ERB = <<-EOS
bottle do
<% if !root_url.start_with?(HOMEBREW_BOTTLE_DEFAULT_DOMAIN) %>
root_url "<%= root_url %>"
@@ -43,7 +41,7 @@ module Homebrew
def bottle_args
Homebrew::CLI::Parser.new do
- usage_banner <<~EOS.freeze
+ usage_banner <<~EOS
`bottle` [<options>] <formula>
Generate a bottle (binary package) from a formula that was installed with
@@ -382,7 +380,7 @@ def bottle_formula(f)
"#{key}: old: #{old_value}, new: #{value}"
end
- odie <<~EOS.freeze
+ odie <<~EOS
--keep-old was passed but there are changes in:
#{mismatches.join("\n")}
EOS
@@ -493,7 +491,7 @@ def merge
end
unless mismatches.empty?
- odie <<~EOS.freeze
+ odie <<~EOS
--keep-old was passed but there are changes in:
#{mismatches.join("\n")}
EOS | true |
Other | Homebrew | brew | 81db0e9551f213b6ddc94d7bbad1128cc8591a51.json | dev-cmd: enable frozen string literals
Now that we use Ruby 2.6 we can fix these last two files. | Library/Homebrew/dev-cmd/man.rb | @@ -1,6 +1,4 @@
-# Uses ERB so can't use Frozen String Literals until >=Ruby 2.4:
-# https://bugs.ruby-lang.org/issues/12031
-# frozen_string_literal: false
+# frozen_string_literal: true
require "formula"
require "erb"
@@ -18,7 +16,7 @@ module Homebrew
def man_args
Homebrew::CLI::Parser.new do
- usage_banner <<~EOS.freeze
+ usage_banner <<~EOS
`man` [<options>]
Generate Homebrew's manpages. | true |
Other | Homebrew | brew | a6b08ecaede8f0670c4364b8bcc43c67e977b6f2.json | rubocops: add go@1.12 to BINARY_FORMULA_URLS_WHITELIST | Library/Homebrew/rubocops/urls.rb | @@ -17,6 +17,7 @@ class Urls < FormulaCop
go@1.9
go@1.10
go@1.11
+ go@1.12
haskell-stack
ldc
mlton | false |
Other | Homebrew | brew | 5ffc7e9d668c8be4bc9bd40ab45f3e1c6a9bd2fe.json | Change spelling of [Ss]ummarize to British english | Library/Homebrew/cmd/--env.rb | @@ -13,7 +13,7 @@ def __env_args
usage_banner <<~EOS
`--env` [<options>]
- Summarize Homebrew's build environment as a plain list.
+ Summarise Homebrew's build environment as a plain list.
If the command's output is sent through a pipe and no shell is specified,
the list is formatted for export to `bash`(1) unless `--plain` is passed. | true |
Other | Homebrew | brew | 5ffc7e9d668c8be4bc9bd40ab45f3e1c6a9bd2fe.json | Change spelling of [Ss]ummarize to British english | Library/Homebrew/cmd/list.rb | @@ -14,7 +14,7 @@ def list_args
List all installed formulae.
- If <formula> is provided, summarize the paths within its current keg.
+ If <formula> is provided, summarise the paths within its current keg.
EOS
switch "--full-name",
description: "Print formulae with fully-qualified names. If `--full-name` is not "\ | true |
Other | Homebrew | brew | 5ffc7e9d668c8be4bc9bd40ab45f3e1c6a9bd2fe.json | Change spelling of [Ss]ummarize to British english | docs/Manpage.md | @@ -292,7 +292,7 @@ automatically when you install formulae but can be useful for DIY installations.
List all installed formulae.
-If *`formula`* is provided, summarize the paths within its current keg.
+If *`formula`* is provided, summarise the paths within its current keg.
* `--full-name`:
Print formulae with fully-qualified names. If `--full-name` is not passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output.
@@ -646,7 +646,7 @@ would be installed, without any sort of versioned directory as the last path.
### `--env` [*`options`*]
-Summarize Homebrew's build environment as a plain list.
+Summarise Homebrew's build environment as a plain list.
If the command's output is sent through a pipe and no shell is specified, the
list is formatted for export to `bash`(1) unless `--plain` is passed. | true |
Other | Homebrew | brew | 5ffc7e9d668c8be4bc9bd40ab45f3e1c6a9bd2fe.json | Change spelling of [Ss]ummarize to British english | manpages/brew.1 | @@ -381,7 +381,7 @@ Allow keg\-only formulae to be linked\.
List all installed formulae\.
.
.P
-If \fIformula\fR is provided, summarize the paths within its current keg\.
+If \fIformula\fR is provided, summarise the paths within its current keg\.
.
.TP
\fB\-\-full\-name\fR
@@ -813,7 +813,7 @@ Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR
If \fIformula\fR is provided, display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\.
.
.SS "\fB\-\-env\fR [\fIoptions\fR]"
-Summarize Homebrew\'s build environment as a plain list\.
+Summarise Homebrew\'s build environment as a plain list\.
.
.P
If the command\'s output is sent through a pipe and no shell is specified, the list is formatted for export to \fBbash\fR(1) unless \fB\-\-plain\fR is passed\. | true |
Other | Homebrew | brew | 1e57ca70d34ed2504aadbbb2b40bef88a5f781df.json | Replace American spelling with British spelling | docs/Bottles.md | @@ -10,7 +10,7 @@ Bottles will not be used if the user requests it (see above), if the formula req
## Creation
Bottles are created using the [Brew Test Bot](Brew-Test-Bot.md). This happens mostly when people submit pull requests to Homebrew and the `bottle do` block is updated by maintainers when they `brew pull --bottle` the contents of a pull request. For the Homebrew organisations' taps they are uploaded to and downloaded from [Bintray](https://bintray.com/homebrew).
-By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for (Core 2 for 64-bit OSs). This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimized for something else, you can pass the `--bottle-arch=` option to build for another architecture; for example, `brew install foo --build-bottle --bottle-arch=penryn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad!
+By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for (Core 2 for 64-bit OSs). This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimised for something else, you can pass the `--bottle-arch=` option to build for another architecture; for example, `brew install foo --build-bottle --bottle-arch=penryn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad!
## Format
Bottles are simple gzipped tarballs of compiled binaries. Any metadata is stored in a formula's bottle DSL and in the bottle filename (i.e. macOS version, revision). | true |
Other | Homebrew | brew | 1e57ca70d34ed2504aadbbb2b40bef88a5f781df.json | Replace American spelling with British spelling | docs/Formula-Cookbook.md | @@ -84,7 +84,7 @@ so you can override this with `brew create <URL> --set-name <name>`.
An SSL/TLS (https) [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method) is preferred, if one is available.
-Try to summarize from the [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method) what the formula does in the [`desc`](https://rubydoc.brew.sh/Formula#desc%3D-class_method)ription. Note that the [`desc`](https://rubydoc.brew.sh/Formula#desc%3D-class_method)ription is automatically prepended with the formula name.
+Try to summarise from the [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method) what the formula does in the [`desc`](https://rubydoc.brew.sh/Formula#desc%3D-class_method)ription. Note that the [`desc`](https://rubydoc.brew.sh/Formula#desc%3D-class_method)ription is automatically prepended with the formula name.
### Check the build system
@@ -332,7 +332,7 @@ correct. Add an explicit [`version`](https://rubydoc.brew.sh/Formula#version-cla
Everything is built on Git, so contribution is easy:
```sh
-brew update # required in more ways than you think (initializes the brew git repository if you don't already have it)
+brew update # required in more ways than you think (initialises the brew git repository if you don't already have it)
cd $(brew --repo homebrew/core)
# Create a new git branch for your formula so your pull request is easy to
# modify if any changes come up during review.
@@ -790,7 +790,7 @@ Some software requires a Fortran compiler. This can be declared by adding `depen
## MPI
-Formula requiring MPI should use [OpenMPI](https://www.open-mpi.org/) by adding `depends_on "open-mpi"` to the formula, rather than [MPICH](https://www.mpich.org/). These packages have conflicts and provide the same standardized interfaces. Choosing a default implementation and requiring it to be adopted allows software to link against multiple libraries that rely on MPI without creating un-anticipated incompatibilities due to differing MPI runtimes.
+Formula requiring MPI should use [OpenMPI](https://www.open-mpi.org/) by adding `depends_on "open-mpi"` to the formula, rather than [MPICH](https://www.mpich.org/). These packages have conflicts and provide the same standardised interfaces. Choosing a default implementation and requiring it to be adopted allows software to link against multiple libraries that rely on MPI without creating un-anticipated incompatibilities due to differing MPI runtimes.
## Linear algebra libraries
| true |
Other | Homebrew | brew | 1e57ca70d34ed2504aadbbb2b40bef88a5f781df.json | Replace American spelling with British spelling | docs/Homebrew-and-Python.md | @@ -11,7 +11,7 @@ Homebrew provides formulae to brew Python 3.x and a more up-to-date Python 2.7.x
## Python 3.x or Python 2.x
Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`).
-The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict:
+The executables are organised as follows so that Python 2 and Python 3 can both be installed without conflict:
* `python3` points to Homebrew's Python 3.x (if installed)
* `python2` points to Homebrew's Python 2.7.x (if installed) | true |
Other | Homebrew | brew | 1e57ca70d34ed2504aadbbb2b40bef88a5f781df.json | Replace American spelling with British spelling | docs/Homebrew-linuxbrew-core-Maintainer-Guide.md | @@ -203,7 +203,7 @@ This is due to a bug with Azure Pipelines and its handling of merge
commits. Master branch builds also fail for the same reason. This is
OK.
-Once the PR is approved by other Homebrew developers, you can finalize
+Once the PR is approved by other Homebrew developers, you can finalise
the merge with:
```bash | true |
Other | Homebrew | brew | 1e57ca70d34ed2504aadbbb2b40bef88a5f781df.json | Replace American spelling with British spelling | docs/Manpage.md | @@ -292,7 +292,7 @@ automatically when you install formulae but can be useful for DIY installations.
List all installed formulae.
-If *`formula`* is provided, summarize the paths within its current keg.
+If *`formula`* is provided, summarise the paths within its current keg.
* `--full-name`:
Print formulae with fully-qualified names. If `--full-name` is not passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output.
@@ -646,7 +646,7 @@ would be installed, without any sort of versioned directory as the last path.
### `--env` [*`options`*]
-Summarize Homebrew's build environment as a plain list.
+Summarise Homebrew's build environment as a plain list.
If the command's output is sent through a pipe and no shell is specified, the
list is formatted for export to `bash`(1) unless `--plain` is passed. | true |
Other | Homebrew | brew | eda0220e5f807482e4feb327e34375de308ea0fc.json | Fix two typos | docs/Homebrew-linuxbrew-core-Maintainer-Guide.md | @@ -74,7 +74,7 @@ brew merge-homebrew --core
```
Merging all the changes from upstream in one go is usually
-undesireable since our build servers will time out. Instead, attempt
+undesirable since our build servers will time out. Instead, attempt
to only merge 8-10 modified formulae.
`git log --oneline master..homebrew/master` will show a list of all | true |
Other | Homebrew | brew | eda0220e5f807482e4feb327e34375de308ea0fc.json | Fix two typos | docs/Prose-Style-Guidelines.md | @@ -16,7 +16,7 @@ Homebrew's audience includes users with a wide range of education and experience
We strive for "correct" but not "fancy" usage. Think newspaper article, not academic paper.
-This is a set of guidelines to be applied using human judgment, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal.
+This is a set of guidelines to be applied using human judgement, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal.
The intent of this document is to help authors make decisions about clarity, style, and consistency. It is not to help settle arguments about who knows English better. Don't use this document to be a jerk.
| true |
Other | Homebrew | brew | 77531166d695aa27fa9aafac732df9ff50246cfc.json | Use bundler from Ruby 2.6
Now Ruby comes with its own bundler let's favour using it when we can
over requiring a system one be installed.
This avoids needing to have anything in `~/.gem` again.
I am somewhat optimistic this may help with #6579 but it's useful
by itself. | Library/Homebrew/Gemfile.lock | @@ -132,4 +132,4 @@ DEPENDENCIES
simplecov
BUNDLED WITH
- 2.0.2
+ 1.17.2 | true |
Other | Homebrew | brew | 77531166d695aa27fa9aafac732df9ff50246cfc.json | Use bundler from Ruby 2.6
Now Ruby comes with its own bundler let's favour using it when we can
over requiring a system one be installed.
This avoids needing to have anything in `~/.gem` again.
I am somewhat optimistic this may help with #6579 but it's useful
by itself. | Library/Homebrew/utils/gems.rb | @@ -69,28 +69,32 @@ def install_gem!(name, version: nil, setup_gem_environment: true)
def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true)
install_gem!(name, version: version, setup_gem_environment: setup_gem_environment)
- return if ENV["PATH"].split(":").any? do |path|
- File.executable?("#{path}/#{executable}")
- end
+ return if find_in_path(executable)
odie_if_defined <<~EOS
the '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
#{ENV["PATH"]}
EOS
end
+ def find_in_path(executable)
+ ENV["PATH"].split(":").find do |path|
+ File.executable?("#{path}/#{executable}")
+ end
+ end
+
def install_bundler!
require "rubygems"
setup_gem_environment!(gem_home: Gem.user_dir, gem_bindir: gem_user_bindir)
- install_gem_setup_path!("bundler", version: ">=2", executable: "bundle", setup_gem_environment: false)
+ install_gem_setup_path!("bundler", version: ">=1.17", executable: "bundle", setup_gem_environment: false)
end
def install_bundler_gems!
install_bundler!
ENV["BUNDLE_GEMFILE"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/Gemfile"
@bundle_installed ||= begin
- bundle = "#{gem_user_bindir}/bundle"
+ bundle = "#{find_in_path(bundle)}/bundle"
bundle_check_output = `#{bundle} check 2>&1`
bundle_check_failed = !$CHILD_STATUS.success?
| true |
Other | Homebrew | brew | 77531166d695aa27fa9aafac732df9ff50246cfc.json | Use bundler from Ruby 2.6
Now Ruby comes with its own bundler let's favour using it when we can
over requiring a system one be installed.
This avoids needing to have anything in `~/.gem` again.
I am somewhat optimistic this may help with #6579 but it's useful
by itself. | docs/.ruby-version | @@ -1 +0,0 @@
-2.6.1 | true |
Other | Homebrew | brew | 77531166d695aa27fa9aafac732df9ff50246cfc.json | Use bundler from Ruby 2.6
Now Ruby comes with its own bundler let's favour using it when we can
over requiring a system one be installed.
This avoids needing to have anything in `~/.gem` again.
I am somewhat optimistic this may help with #6579 but it's useful
by itself. | docs/Gemfile.lock | @@ -260,4 +260,4 @@ DEPENDENCIES
rake
BUNDLED WITH
- 2.0.1
+ 1.17.2 | true |
Other | Homebrew | brew | d37831219df2c4976eddeba3076cfba6f3486d1d.json | Use temp file for calculating hash. | Library/Homebrew/utils/curl.rb | @@ -184,9 +184,12 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false,
end
def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent: :default)
+ file = Tempfile.new.tap(&:close)
+
max_time = hash_needed ? "600" : "25"
output, = curl_output(
- "--connect-timeout", "15", "--include", "--max-time", max_time, "--location", url,
+ "--dump-header", "-", "--output", file.path, "--include", "--location",
+ "--connect-timeout", "15", "--max-time", max_time, url,
user_agent: user_agent
)
@@ -197,7 +200,7 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
final_url = headers[/^Location:\s*(.*)$/i, 1]&.chomp
end
- output_hash = Digest::SHA256.digest(output) if hash_needed
+ output_hash = Digest::SHA256.file(file.path) if hash_needed
final_url ||= url
@@ -210,6 +213,8 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
file_hash: output_hash,
file: output,
}
+ensure
+ file.unlink
end
def http_status_ok?(status) | false |
Other | Homebrew | brew | df3bbd0299b964e5bc759130a10fce93422a08f8.json | Reduce need for interpolating `appdir` in casks. | Library/Homebrew/cask/artifact/moved.rb | @@ -54,10 +54,14 @@ def move(force: false, command: nil, **options)
command.run!("/bin/mv", args: [source, target], sudo: true)
end
+ FileUtils.ln_sf target, source
+
add_altname_metadata(target, source.basename, command: command)
end
def move_back(skip: false, force: false, command: nil, **options)
+ FileUtils.rm source if source.symlink? && source.dirname.join(source.readlink) == target
+
if Utils.path_occupied?(source)
message = "It seems there is already #{self.class.english_article} " \
"#{self.class.english_name} at '#{source}'" | true |
Other | Homebrew | brew | df3bbd0299b964e5bc759130a10fce93422a08f8.json | Reduce need for interpolating `appdir` in casks. | Library/Homebrew/cask/installer.rb | @@ -94,6 +94,8 @@ def install
fetch
uninstall_existing_cask if reinstall?
+ backup if force? && @cask.staged_path.exist? && @cask.metadata_versioned_path.exist?
+
oh1 "Installing Cask #{Formatter.identifier(@cask)}"
opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine?
stage
@@ -104,7 +106,12 @@ def install
::Utils::Analytics.report_event("cask_install", @cask.token) unless @cask.tap&.private?
+ purge_backed_up_versioned_files
+
puts summary
+ rescue
+ restore_backup
+ raise
end
def check_conflicts
@@ -411,6 +418,8 @@ def revert_upgrade
end
def finalize_upgrade
+ ohai "Purging files for version #{@cask.version} of Cask #{@cask}"
+
purge_backed_up_versioned_files
puts summary
@@ -471,8 +480,6 @@ def gain_permissions_remove(path)
end
def purge_backed_up_versioned_files
- ohai "Purging files for version #{@cask.version} of Cask #{@cask}"
-
# versioned staged distribution
gain_permissions_remove(backup_path) if backup_path&.exist?
| true |
Other | Homebrew | brew | df3bbd0299b964e5bc759130a10fce93422a08f8.json | Reduce need for interpolating `appdir` in casks. | Library/Homebrew/test/cask/artifact/alt_target_spec.rb | @@ -24,7 +24,7 @@
install_phase
expect(target_path).to be_a_directory
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
end
describe "when app is in a subdirectory" do
@@ -45,7 +45,7 @@
install_phase
expect(target_path).to be_a_directory
- expect(appsubdir.join("Caffeine.app")).not_to exist
+ expect(appsubdir.join("Caffeine.app")).to be_a_symlink
end
end
@@ -56,7 +56,7 @@
install_phase
expect(target_path).to be_a_directory
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to be_a_directory | true |
Other | Homebrew | brew | df3bbd0299b964e5bc759130a10fce93422a08f8.json | Reduce need for interpolating `appdir` in casks. | Library/Homebrew/test/cask/artifact/app_spec.rb | @@ -21,7 +21,7 @@
install_phase
expect(target_path).to be_a_directory
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
end
describe "when app is in a subdirectory" do
@@ -42,7 +42,7 @@
install_phase
expect(target_path).to be_a_directory
- expect(appsubdir.join("Caffeine.app")).not_to exist
+ expect(appsubdir.join("Caffeine.app")).to be_a_symlink
end
end
@@ -53,7 +53,7 @@
install_phase
expect(target_path).to be_a_directory
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist
@@ -100,7 +100,7 @@
.to output(stdout).to_stdout
.and output(stderr).to_stderr
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
expect(target_path).to be_a_directory
contents_path = target_path.join("Contents/Info.plist")
@@ -148,7 +148,7 @@
.to output(stdout).to_stdout
.and output(stderr).to_stderr
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
expect(target_path).to be_a_directory
contents_path = target_path.join("Contents/Info.plist")
@@ -191,7 +191,7 @@
.to output(stdout).to_stdout
.and output(stderr).to_stderr
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
expect(target_path).to be_a_directory
contents_path = target_path.join("Contents/Info.plist") | true |
Other | Homebrew | brew | df3bbd0299b964e5bc759130a10fce93422a08f8.json | Reduce need for interpolating `appdir` in casks. | Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb | @@ -30,7 +30,7 @@
install_phase.call
expect(target_path).to be_a_directory
- expect(source_path).not_to exist
+ expect(source_path).to be_a_symlink
end
it "avoids clobbering an existing artifact" do | true |
Other | Homebrew | brew | df3bbd0299b964e5bc759130a10fce93422a08f8.json | Reduce need for interpolating `appdir` in casks. | Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb | @@ -24,23 +24,26 @@
install_phase
expect(target_path_mini).to be_a_directory
- expect(source_path_mini).not_to exist
+ expect(source_path_mini).to be_a_symlink
expect(target_path_pro).to be_a_directory
- expect(source_path_pro).not_to exist
+ expect(source_path_pro).to be_a_symlink
end
describe "when apps are in a subdirectory" do
let(:cask) { Cask::CaskLoader.load(cask_path("with-two-apps-subdir")) }
+ let(:source_path_mini) { cask.staged_path.join("Caffeines", "Caffeine Mini.app") }
+ let(:source_path_pro) { cask.staged_path.join("Caffeines", "Caffeine Pro.app") }
+
it "installs both apps using the proper target directory" do
install_phase
expect(target_path_mini).to be_a_directory
- expect(source_path_mini).not_to exist
+ expect(source_path_mini).to be_a_symlink
expect(target_path_pro).to be_a_directory
- expect(source_path_pro).not_to exist
+ expect(source_path_pro).to be_a_symlink
end
end
@@ -50,7 +53,7 @@
install_phase
expect(target_path_mini).to be_a_directory
- expect(source_path_mini).not_to exist
+ expect(source_path_mini).to be_a_symlink
expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist | true |
Other | Homebrew | brew | ecf8324c828c12d3d3adbf8a28d1af6c34a6e3da.json | Fix a typo | docs/Homebrew-on-Linux.md | @@ -78,7 +78,7 @@ Homebrew does not currently support 32-bit x86 platforms. It would be possible f
## Alternative Installation
-Extract or `git clone` Homebrew wherever you want. Use `/home/linuxbrew/.linuxbrew` if possible (to enabled the use of binary packages).
+Extract or `git clone` Homebrew wherever you want. Use `/home/linuxbrew/.linuxbrew` if possible (to enable the use of binary packages).
```sh
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew | false |
Other | Homebrew | brew | 87f29857f0d5a8c862ed90b1740e192d5312c0db.json | Pass section to the constructor | Library/Homebrew/cask/artifact/manpage.rb | @@ -5,26 +5,26 @@
module Cask
module Artifact
class Manpage < Symlinked
+ attr_reader :section
+
def self.from_args(cask, source)
- section = source.split(".").last
+ section = source.to_s[/\.([1-8]|n|l)$/, 1]
- raise CaskInvalidError, "section should be a positive number" unless section.to_i.positive?
+ raise CaskInvalidError, "'#{source}' is not a valid man page name" unless section
- new(cask, source)
+ new(cask, source, section)
end
- def initialize(cask, source)
- super
+ def initialize(cask, source, section)
+ @section = section
+
+ super(cask, source)
end
def resolve_target(_target)
config.manpagedir.join("man#{section}", target_name)
end
- def section
- @source.extname.downcase[1..-1].to_s.to_i
- end
-
def target_name
"#{@source.basename(@source.extname)}.#{section}"
end | true |
Other | Homebrew | brew | 87f29857f0d5a8c862ed90b1740e192d5312c0db.json | Pass section to the constructor | Library/Homebrew/test/cask/artifact/manpage_spec.rb | @@ -8,7 +8,7 @@
let(:cask_token) { "invalid/invalid-manpage-no-section" }
it "fails to load a cask without section" do
- expect { cask }.to raise_error(Cask::CaskInvalidError, /section should be a positive number/)
+ expect { cask }.to raise_error(Cask::CaskInvalidError, /is not a valid man page name/)
end
end
| true |
Other | Homebrew | brew | 023f0b59a25bea0e6cd4cad47f3a5b390c4ce41d.json | vendor-install: Change double hyphen to single | Library/Homebrew/cmd/vendor-install.sh | @@ -17,16 +17,16 @@ if [[ -n "$HOMEBREW_MACOS" ]]
then
if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
then
- ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby--2.6.3.mavericks.bottle.tar.gz"
- ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby--2.6.3.mavericks.bottle.tar.gz"
+ ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.mavericks.bottle.tar.gz"
ruby_SHA="ab81211a2052ccaa6d050741c433b728d0641523d8742eef23a5b450811e5104"
fi
elif [[ -n "$HOMEBREW_LINUX" ]]
then
case "$HOMEBREW_PROCESSOR" in
x86_64)
- ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby--2.6.3.x86_64_linux.bottle.tar.gz"
- ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby--2.6.3.x86_64_linux.bottle.tar.gz"
+ ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz"
ruby_SHA="e8c9b6d3dc5f40844e07b4b694897b8b7cb5a7dab1013b3b8712a22868f98c98"
;;
aarch64) | false |
Other | Homebrew | brew | 5dddbf1e8c27e2cc258201ff3651a61945cf8e7c.json | Update unmaintained ffmpeg tap to current | docs/Interesting-Taps-and-Forks.md | @@ -6,7 +6,7 @@ Homebrew has the capability to add (and remove) multiple taps to your local inst
Your taps are Git repositories located at `$(brew --repository)/Library/Taps`.
## Unsupported interesting taps
-* [varenc/ffmpeg](https://github.com/varenc/homebrew-ffmpeg): A tap for FFmpeg with additional options, including nonfree additions.
+* [homebrew-ffmpeg/ffmpeg](https://github.com/homebrew-ffmpeg/homebrew-ffmpeg): A tap for FFmpeg with additional options, including nonfree additions.
* [denji/nginx](https://github.com/denji/homebrew-nginx): A tap for NGINX modules, intended for its `nginx-full` formula which includes more module options.
| false |
Other | Homebrew | brew | f0e848b3e095bb58cab8554ba547d3607ad0dc8f.json | fixtures: add testball bottle for ARM
Also fix the absolute link used by testball_bottle-0.1.intel_macintosh.bottle.tar.gz | Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.aarch64_linux.bottle.tar.gz | @@ -0,0 +1 @@
+testball_bottle-0.1.yosemite.bottle.tar.gz
\ No newline at end of file | true |
Other | Homebrew | brew | f0e848b3e095bb58cab8554ba547d3607ad0dc8f.json | fixtures: add testball bottle for ARM
Also fix the absolute link used by testball_bottle-0.1.intel_macintosh.bottle.tar.gz | Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.armv6_linux.bottle.tar.gz | @@ -0,0 +1 @@
+testball_bottle-0.1.yosemite.bottle.tar.gz
\ No newline at end of file | true |
Other | Homebrew | brew | f0e848b3e095bb58cab8554ba547d3607ad0dc8f.json | fixtures: add testball bottle for ARM
Also fix the absolute link used by testball_bottle-0.1.intel_macintosh.bottle.tar.gz | Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.armv7_linux.bottle.tar.gz | @@ -0,0 +1 @@
+testball_bottle-0.1.yosemite.bottle.tar.gz
\ No newline at end of file | true |
Other | Homebrew | brew | f0e848b3e095bb58cab8554ba547d3607ad0dc8f.json | fixtures: add testball bottle for ARM
Also fix the absolute link used by testball_bottle-0.1.intel_macintosh.bottle.tar.gz | Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.intel_macintosh.bottle.tar.gz | @@ -1 +1 @@
-/usr/local/Homebrew/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz
\ No newline at end of file
+testball_bottle-0.1.yosemite.bottle.tar.gz
\ No newline at end of file | true |
Other | Homebrew | brew | 6bc1785c88e49e43b5ac2cd809349d53745d4a83.json | doctor: list any uncommitted modified files | Library/Homebrew/diagnostic.rb | @@ -663,17 +663,28 @@ def check_missing_deps
def check_git_status
return unless Utils.git_available?
+ modified = []
HOMEBREW_REPOSITORY.cd do
- return if `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty?
+ modified.concat `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.split("\n")
+ return if modified.empty?
end
- <<~EOS
+ message = <<~EOS
You have uncommitted modifications to Homebrew.
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd #{HOMEBREW_LIBRARY} && git stash && git clean -d -f
EOS
+
+ if ENV["CI"]
+ message += inject_file_list modified, <<~EOS
+
+ Modified files:
+ EOS
+ end
+
+ message
end
def check_for_bad_python_symlink | false |
Other | Homebrew | brew | 40a0b8b10ab6ba1ef8e3b0acc2eeef7c8dd494b6.json | Fix missing `command` method. | Library/Homebrew/cask/cmd.rb | @@ -214,7 +214,7 @@ def initialize(command, *args)
@args = args
end
- def run(*_args)
+ def run(*)
purpose
usage
@@ -226,7 +226,7 @@ def run(*_args)
raise ArgumentError, "help does not take arguments." if @args.length
end
- raise ArgumentError, "Unknown Cask command: #{command}"
+ raise ArgumentError, "Unknown Cask command: #{@command}"
end
def purpose | false |
Other | Homebrew | brew | e3f8939cff48dd59f267792077282110a0616c66.json | zip: overwrite existing files
Fixes homebrew/homebrew-cask#69879 | Library/Homebrew/unpack_strategy/zip.rb | @@ -23,7 +23,7 @@ def contains_extended_attributes?(path)
def extract_to_dir(unpack_dir, basename:, verbose:)
quiet_flags = verbose ? [] : ["-qq"]
result = system_command! "unzip",
- args: [*quiet_flags, path, "-d", unpack_dir],
+ args: [*quiet_flags, "-o", path, "-d", unpack_dir],
verbose: verbose,
print_stderr: false
| false |
Other | Homebrew | brew | 8a93230c1546bb172a81e1aa27083b98e2e3b5d0.json | test/cask: remove disabled functionality tests. | Library/Homebrew/test/cask/depends_on_spec.rb | @@ -47,14 +47,6 @@
end
end
- context "given a string", :needs_compat do
- let(:cask) { Cask::CaskLoader.load(cask_path("compat/with-depends-on-macos-string")) }
-
- it "does not raise an error" do
- expect { install }.not_to raise_error
- end
- end
-
context "given a symbol" do
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-macos-symbol")) }
| true |
Other | Homebrew | brew | 8a93230c1546bb172a81e1aa27083b98e2e3b5d0.json | test/cask: remove disabled functionality tests. | Library/Homebrew/test/cask/dsl_spec.rb | @@ -335,14 +335,6 @@ def caveats
end
describe "depends_on macos" do
- context "string disabled", :needs_compat do
- let(:token) { "compat/with-depends-on-macos-string" }
-
- it "allows depends_on macos to be specified" do
- expect { cask }.to raise_error(Cask::CaskInvalidError)
- end
- end
-
context "invalid depends_on macos value" do
let(:token) { "invalid/invalid-depends-on-macos-bad-release" }
| true |
Other | Homebrew | brew | 1b4fdc17f4afa716ded74949c1e06ecce838e919.json | Raise deprecation exceptions in tests
Previously tests which hit `odeprecated` would print warnings but not
always raise exceptions or fail. Combine this with the ability to have
`odeprecated` to turn into `odisabled` on certain dates and you have
tests that may fail just on the clock changing (this is bad).
Instead, ensure that tests always raise deprecations as exceptions so
that new deprecations will have their tests handled immediately. | Library/Homebrew/test/cask/dsl_spec.rb | @@ -335,11 +335,11 @@ def caveats
end
describe "depends_on macos" do
- context "valid", :needs_compat do
+ context "string disabled", :needs_compat do
let(:token) { "compat/with-depends-on-macos-string" }
it "allows depends_on macos to be specified" do
- expect(cask.depends_on.macos).not_to be nil
+ expect { cask }.to raise_error(Cask::CaskInvalidError)
end
end
| true |
Other | Homebrew | brew | 1b4fdc17f4afa716ded74949c1e06ecce838e919.json | Raise deprecation exceptions in tests
Previously tests which hit `odeprecated` would print warnings but not
always raise exceptions or fail. Combine this with the ability to have
`odeprecated` to turn into `odisabled` on certain dates and you have
tests that may fail just on the clock changing (this is bad).
Instead, ensure that tests always raise deprecations as exceptions so
that new deprecations will have their tests handled immediately. | Library/Homebrew/test/spec_helper.rb | @@ -144,6 +144,7 @@ def find_files
end
begin
+ Homebrew.raise_deprecation_exceptions = true
Tap.clear_cache
FormulaInstaller.clear_attempted
| true |
Other | Homebrew | brew | f762033a57be271b778be6e39fe7d5b9d068ec64.json | Move condition to nested `if` statement. | Library/Homebrew/cmd/search.rb | @@ -100,10 +100,10 @@ def search
puts Formatter.columns(all_casks)
end
- if $stdout.tty? && !local_casks.include?(query)
+ if $stdout.tty?
count = all_formulae.count + all_casks.count
- if reason = MissingFormula.reason(query, silent: true)
+ if reason = MissingFormula.reason(query, silent: true) && !local_casks.include?(query)
if count.positive?
puts
puts "If you meant #{query.inspect} specifically:" | false |
Other | Homebrew | brew | cbf458ea9c6dfeca2bf9e2cc3027969958dc33db.json | Lint/ElseAlignment: ignore some bugged autocorrections. | Library/Homebrew/formula_installer.rb | @@ -369,8 +369,8 @@ def check_conflicts
$stderr.puts "Please report this to the #{formula.tap} tap!"
false
- else
- f.linked_keg.exist? && f.opt_prefix.exist?
+ else # rubocop:disable Lint/ElseAlignment
+ f.linked_keg.exist? && f.opt_prefix.exist?
end
raise FormulaConflictError.new(formula, conflicts) unless conflicts.empty? | true |
Other | Homebrew | brew | cbf458ea9c6dfeca2bf9e2cc3027969958dc33db.json | Lint/ElseAlignment: ignore some bugged autocorrections. | Library/Homebrew/utils/fork.rb | @@ -53,8 +53,8 @@ def self.safe_fork(&_block)
write.close
exit!
- else
- exit!(true)
+ else # rubocop:disable Lint/ElseAlignment
+ exit!(true)
end
ignore_interrupts(:quietly) do # the child will receive the interrupt and marshal it back | true |
Other | Homebrew | brew | c71b540ea6806afb80cdf906035d6b298ac1f769.json | vendor-install: Add ruby bottle for aarch64 | Library/Homebrew/cmd/vendor-install.sh | @@ -29,6 +29,11 @@ then
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby--2.6.3.x86_64_linux.bottle.tar.gz"
ruby_SHA="e8c9b6d3dc5f40844e07b4b694897b8b7cb5a7dab1013b3b8712a22868f98c98"
;;
+ aarch64)
+ ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby--2.6.3.aarch64_linux.bottle.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby--2.6.3.aarch64_linux.bottle.tar.gz"
+ ruby_SHA="7c6acef92c35903859ae4b7649dafb3c061cc6462e0223631ae8aee3c38b0842"
+ ;;
esac
fi
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.