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 | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/formula.rb | @@ -1088,7 +1088,7 @@ def skip_clean?(path)
end
# Sometimes we accidentally install files outside prefix. After we fix that,
- # users will get nasty link conflict error. So we create a whitelist here to
+ # users will get nasty link conflict error. So we create an allowlist here to
# allow overwriting certain files. e.g.
# link_overwrite "bin/foo", "lib/bar"
# link_overwrite "share/man/man1/baz-*"
@@ -1111,7 +1111,7 @@ def link_overwrite?(path)
begin
Formulary.factory(keg.name)
rescue FormulaUnavailableError
- # formula for this keg is deleted, so defer to whitelist
+ # formula for this keg is deleted, so defer to allowlist
rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
return false # this keg belongs to another formula
else | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/rubocops/components_order.rb | @@ -11,7 +11,7 @@ module FormulaAudit
# where each sub array contains components' details which are at same precedence level
class ComponentsOrder < FormulaCop
# `aspell`: options and resources should be grouped by language
- COMPONENT_WHITELIST = %w[
+ COMPONENT_ALLOWLIST = %w[
aspell
].freeze
@@ -235,7 +235,7 @@ def check_order(component_precedence_list, body_node)
# Method to format message for reporting component precedence violations
def component_problem(c1, c2)
- return if COMPONENT_WHITELIST.include?(@formula_name)
+ return if COMPONENT_ALLOWLIST.include?(@formula_name)
problem "`#{format_component(c1)}` (line #{line_number(c1)}) " \
"should be put before `#{format_component(c2)}` " \ | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/rubocops/conflicts.rb | @@ -11,14 +11,14 @@ class Conflicts < FormulaCop
MSG = "Versioned formulae should not use `conflicts_with`. " \
"Use `keg_only :versioned_formula` instead."
- WHITELIST = %w[
+ ALLOWLIST = %w[
bash-completion@2
].freeze
def audit_formula(_node, _class_node, _parent_class_node, body)
return unless versioned_formula?
- problem MSG if !WHITELIST.include?(@formula_name) &&
+ problem MSG if !ALLOWLIST.include?(@formula_name) &&
method_called_ever?(body, :conflicts_with)
end
end | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/rubocops/keg_only.rb | @@ -10,7 +10,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
keg_only_node = find_node_method_by_name(body_node, :keg_only)
return unless keg_only_node
- whitelist = %w[
+ allowlist = %w[
Apple
macOS
OS
@@ -27,7 +27,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
reason = reason.sub(name, "")
first_word = reason.split.first
- if reason =~ /\A[A-Z]/ && !reason.start_with?(*whitelist)
+ if reason =~ /\A[A-Z]/ && !reason.start_with?(*allowlist)
problem "'#{first_word}' from the keg_only reason should be '#{first_word.downcase}'."
end
| true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/rubocops/lines.rb | @@ -457,7 +457,7 @@ def modifier?(node)
module FormulaAuditStrict
class MakeCheck < FormulaCop
- MAKE_CHECK_WHITELIST = %w[
+ MAKE_CHECK_ALLOWLIST = %w[
beecrypt
ccrypt
git
@@ -483,7 +483,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
# Avoid build-time checks in homebrew/core
find_every_method_call_by_name(body_node, :system).each do |method|
next if @formula_name.start_with?("lib")
- next if MAKE_CHECK_WHITELIST.include?(@formula_name)
+ next if MAKE_CHECK_ALLOWLIST.include?(@formula_name)
params = parameters(method)
next unless node_equals?(params[0], "make") | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/rubocops/urls.rb | @@ -8,7 +8,7 @@ module FormulaAudit
# This cop audits URLs and mirrors in Formulae.
class Urls < FormulaCop
# These are parts of URLs that look like binaries but actually aren't.
- NOT_A_BINARY_URL_PREFIX_WHITELIST = %w[
+ NOT_A_BINARY_URL_PREFIX_ALLOWLIST = %w[
https://downloads.sourceforge.net/project/astyle/astyle/
https://downloads.sourceforge.net/project/bittwist/
https://downloads.sourceforge.net/project/launch4j/
@@ -22,7 +22,7 @@ class Urls < FormulaCop
].freeze
# These are formulae that, sadly, require an upstream binary to bootstrap.
- BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST = %w[
+ BINARY_BOOTSTRAP_FORMULA_URLS_ALLOWLIST = %w[
clozure-cl
crystal
fpc
@@ -275,8 +275,8 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
audit_urls(urls, /(darwin|macos|osx)/i) do |match, url|
next if @formula_name.include?(match.to_s.downcase)
next if url.match?(/.(patch|diff)(\?full_index=1)?$/)
- next if NOT_A_BINARY_URL_PREFIX_WHITELIST.any? { |prefix| url.start_with?(prefix) }
- next if BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST.include?(@formula_name)
+ next if NOT_A_BINARY_URL_PREFIX_ALLOWLIST.any? { |prefix| url.start_with?(prefix) }
+ next if BINARY_BOOTSTRAP_FORMULA_URLS_ALLOWLIST.include?(@formula_name)
problem "#{url} looks like a binary package, not a source archive; " \
"homebrew/core is source-only." | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/sandbox.rb | @@ -153,7 +153,7 @@ class SandboxProfile
(regex #"^/dev/fd/[0-9]+$")
(regex #"^/dev/tty[a-z0-9]*$")
)
- (deny file-write*) ; deny non-whitelist file write operations
+ (deny file-write*) ; deny non-allowlist file write operations
(allow process-exec
(literal "/bin/ps")
(with no-sandbox) | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/test/dev-cmd/audit_spec.rb | @@ -234,7 +234,7 @@ class Foo < Formula
describe "#audit_deps" do
describe "a dependency on a macOS-provided keg-only formula" do
- describe "which is whitelisted" do
+ describe "which is allowlisted" do
subject { fa }
let(:fa) do
@@ -266,7 +266,7 @@ class Foo < Formula
its(:problems) { are_expected.to be_empty }
end
- describe "which is not whitelisted", :needs_macos do
+ describe "which is not allowlisted", :needs_macos do
subject { fa }
let(:fa) do
@@ -518,11 +518,11 @@ class FooAT11 < Formula
end
end
- include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_WHITELIST
- include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_WHITELIST
- include_examples "formulae exist", described_class::USES_FROM_MACOS_WHITELIST
+ include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_ALLOWLIST
+ include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_ALLOWLIST
+ include_examples "formulae exist", described_class::USES_FROM_MACOS_ALLOWLIST
include_examples "formulae exist", described_class::THROTTLED_BLACKLIST.keys
- include_examples "formulae exist", described_class::UNSTABLE_WHITELIST.keys
- include_examples "formulae exist", described_class::GNOME_DEVEL_WHITELIST.keys
+ include_examples "formulae exist", described_class::UNSTABLE_ALLOWLIST.keys
+ include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys
end
end | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/test/rubocops/components_order_spec.rb | @@ -477,6 +477,6 @@ class Foo < Formula
RUBY
end
- include_examples "formulae exist", described_class::COMPONENT_WHITELIST
+ include_examples "formulae exist", described_class::COMPONENT_ALLOWLIST
end
end | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/test/rubocops/conflicts_spec.rb | @@ -27,5 +27,5 @@ class FooAT20 < Formula
end
end
- include_examples "formulae exist", described_class::WHITELIST
+ include_examples "formulae exist", described_class::ALLOWLIST
end | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/test/rubocops/keg_only_spec.rb | @@ -46,7 +46,7 @@ class Foo < Formula
RUBY
end
- specify "keg_only_handles_whitelist_correctly" do
+ specify "keg_only_handles_allowlist_correctly" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/test/rubocops/lines_spec.rb | @@ -865,5 +865,5 @@ class Foo < Formula
RUBY
end
- include_examples "formulae exist", described_class::MAKE_CHECK_WHITELIST
+ include_examples "formulae exist", described_class::MAKE_CHECK_ALLOWLIST
end | true |
Other | Homebrew | brew | 0041ea21f57c8abf4a543d8645ec25e1704542a6.json | Change occurrences of "whitelist" to "allowlist" | Library/Homebrew/test/rubocops/urls_spec.rb | @@ -239,7 +239,7 @@ class Foo < Formula
end
end
- include_examples "formulae exist", described_class::BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST
+ include_examples "formulae exist", described_class::BINARY_BOOTSTRAP_FORMULA_URLS_ALLOWLIST
end
describe RuboCop::Cop::FormulaAudit::PyPiUrls do | true |
Other | Homebrew | brew | 9751d3bb8c884f6994739160bfaa40aee831b3e6.json | Fix calls to 'test_ruby' in conditional statements
Co-authored-by: Shaun Jackman <sjackman@gmail.com> | Library/Homebrew/utils/ruby.sh | @@ -64,7 +64,7 @@ If there's no Homebrew Portable Ruby available for your processor:
IFS=$'\n' # Do word splitting on new lines only
for ruby_exec in $(which -a ruby) $(PATH=$HOMEBREW_PATH which -a ruby)
do
- if [[ $(test_ruby "$ruby_exec") == "true" ]]; then
+ if test_ruby "$ruby_exec"; then
HOMEBREW_RUBY_PATH=$ruby_exec
break
fi
@@ -76,9 +76,9 @@ If there's no Homebrew Portable Ruby available for your processor:
if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]]
then
usable_ruby_version="true"
- elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
+ elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] && test_ruby "$HOMEBREW_RUBY_PATH"
then
- usable_ruby_version=$(test_ruby "$HOMEBREW_RUBY_PATH")
+ usable_ruby_version=true
fi
if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" || "$usable_ruby_version" != "true" ]] | false |
Other | Homebrew | brew | 4f26d85a4611f0f50c96b73162d0d94859e19e7b.json | os/mac/keg_relocate: add missing `libexec` method | Library/Homebrew/keg_relocate.rb | @@ -117,6 +117,10 @@ def lib
path/"lib"
end
+ def libexec
+ path/"libexec"
+ end
+
def text_files
text_files = []
return text_files unless which("file") && which("xargs") | false |
Other | Homebrew | brew | edc6107ccbfa9942de63885b9998de4d60808533.json | rubocop_shared: fix HeredocIndentation rule. | Library/.rubocop_shared.yml | @@ -8,7 +8,7 @@ AllCops:
# Use `<<~` for heredocs.
Layout/HeredocIndentation:
- EnforcedStyle: squiggly
+ Enabled: true
# Not useful in casks and formulae.
Metrics/BlockLength: | false |
Other | Homebrew | brew | a7b51ebecd35e319a6fe7f8928303dd555449742.json | Cask: use regex in appcast adjusted_version_stanza | Library/Homebrew/cask/audit.rb | @@ -314,7 +314,7 @@ def check_appcast_contains_version
"--globoff", "--max-time", "5", appcast_stanza)
version_stanza = cask.version.to_s
adjusted_version_stanza = if cask.appcast.configuration.blank?
- version_stanza.split(",")[0].split("-")[0].split("_")[0]
+ version_stanza.match(/^[[:alnum:].]+/)[0]
else
cask.appcast.configuration
end | false |
Other | Homebrew | brew | 1edff7934e378393ff09e0b343161c291c6744dd.json | livecheck: modify regex in tests | Library/Homebrew/test/formula_spec.rb | @@ -668,14 +668,14 @@
livecheck do
skip "foo"
url "https://brew.sh/test/releases"
- regex(/test-(\d+(?:\.\d+)+)\.tbz/)
+ regex(/test-v?(\d+(?:\.\d+)+)\.t/i)
end
end
expect(f.livecheck.skip?).to be true
expect(f.livecheck.skip_msg).to eq("foo")
expect(f.livecheck.url).to eq("https://brew.sh/test/releases")
- expect(f.livecheck.regex).to eq(/test-(\d+(?:\.\d+)+)\.tbz/)
+ expect(f.livecheck.regex).to eq(/test-v?(\d+(?:\.\d+)+)\.t/i)
end
describe "#livecheckable?" do
@@ -691,7 +691,7 @@
f = formula do
url "https://brew.sh/test-1.0.tbz"
livecheck do
- regex(/test-(\d+(?:.\d+)+).tbz/)
+ regex(/test-v?(\d+(?:\.\d+)+)\.t/i)
end
end
@@ -705,7 +705,7 @@
url "https://brew.sh/test-1.0.tbz"
livecheck do
url :homepage
- regex(/test-(\d+(?:.\d+)+).tbz/)
+ regex(/test-v?(\d+(?:\.\d+)+)\.t/i)
end
end
| false |
Other | Homebrew | brew | 8b479ea77be053f3b3d5cf3dafcd15e7dd7d349e.json | manpage: update external commands.
- add more detailed manpage section for external commands (more
information moved from their READMEs)
- add `brew test-bot` to the manpage | Library/Homebrew/commands.rb | @@ -101,7 +101,7 @@ def internal_developer_commands_paths
end
def official_external_commands_paths
- %w[bundle services].map do |cmd|
+ %w[bundle services test-bot].map do |cmd|
tap = Tap.fetch("Homebrew/#{cmd}")
tap.install unless tap.installed?
external_ruby_v2_cmd_path(cmd) | true |
Other | Homebrew | brew | 8b479ea77be053f3b3d5cf3dafcd15e7dd7d349e.json | manpage: update external commands.
- add more detailed manpage section for external commands (more
information moved from their READMEs)
- add `brew test-bot` to the manpage | docs/Manpage.md | @@ -1082,23 +1082,52 @@ Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask, Mac App Store
and Whalebrew.
`brew bundle` [`install`]:
- Install or upgrade all dependencies in a `Brewfile`.
+ Install and upgrade (by default) all dependencies from the `Brewfile`.
+
+You can skip the installation of dependencies by adding space-separated values
+to one or more of the following environment variables:
+`HOMEBREW_BUNDLE_BREW_SKIP`, `HOMEBREW_BUNDLE_CASK_SKIP`,
+`HOMEBREW_BUNDLE_MAS_SKIP`, `HOMEBREW_BUNDLE_WHALEBREW_SKIP`,
+`HOMEBREW_BUNDLE_TAP_SKIP`
+
+`brew bundle` will output a `Brewfile.lock.json` in the same directory as the
+`Brewfile` if all dependencies are installed successfully. This contains
+dependency and system status information which can be useful in debugging `brew
+bundle` failures and replicating a "last known good build" state. You can
+opt-out of this behaviour by setting the `HOMEBREW_BUNDLE_NO_LOCK` environment
+variable or passing the `--no-lock` option. You may wish to check this file into
+the same version control system as your `Brewfile` (or ensure your version
+control system ignores it if you'd prefer to rely on debugging information from
+a local machine).
`brew bundle dump`:
Write all installed casks/formulae/images/taps into a `Brewfile`.
`brew bundle cleanup`:
- Uninstall all dependencies not listed in a `Brewfile`.
+ Uninstall all dependencies not listed from the `Brewfile`.
+
+This workflow is useful for maintainers or testers who regularly install lots of
+formulae.
`brew bundle check`:
- Check if all dependencies are installed in a `Brewfile`.
+ Check if all dependencies are installed from the `Brewfile` .
-`brew bundle exec` *`command`*:
- Run an external command in an isolated build environment.
+This provides a successful exit code if everything is up-to-date, making it
+useful for scripting.
`brew bundle list`:
- List all dependencies present in a `Brewfile`. By default, only Homebrew
-dependencies are listed.
+ List all dependencies present in a `Brewfile`.
+
+By default, only Homebrew dependencies are listed.
+
+`brew bundle exec` *`command`*:
+ Run an external command in an isolated build environment based on the
+`Brewfile` dependencies.
+
+This sanitized build environment ignores unrequested dependencies, which makes
+sure that things you didn't specify in your `Brewfile` won't get picked up by
+commands like `bundle install`, `npm install`, etc. It will also add compiler
+flags which will help find keg-only dependencies like `openssl`, `icu4c`, etc.
* `--file`:
Read the `Brewfile` from this location. Use `--file=-` to pipe to stdin/stdout.
@@ -1139,7 +1168,7 @@ If `sudo` is passed, operate on `/Library/LaunchDaemons` (started at boot).
Otherwise, operate on `~/Library/LaunchAgents` (started at login).
[`sudo`] `brew services` [`list`]:
- List all running services for the current user (or root).
+ List all managed services for the current user (or root).
[`sudo`] `brew services run` (*`formula`*|`--all`):
Run the service *`formula`* without registering to launch at login (or boot).
@@ -1162,6 +1191,64 @@ it to launch at login (or boot).
* `--all`:
Run *`subcommand`* on all services.
+### `test-bot` [*`options`*] [*`formula`*]:
+
+Tests the full lifecycle of a Homebrew change to a tap (Git repository). For
+example, for a GitHub Actions pull request that changes a formula `brew
+test-bot` will ensure the system is cleaned and setup to test the formula,
+install the formula, run various tests and checks on it, bottle (package) the
+binaries and test formulae that depend on it to ensure they aren't broken by
+these changes.
+
+Only supports GitHub Actions as a CI provider. This is because Homebrew uses
+GitHub Actions and it's freely available for public and private use with macOS
+and Linux workers.
+
+* `--dry-run`:
+ print what would be done rather than doing it.
+* `--cleanup`:
+ clean all state from the Homebrew directory. Use with care!
+* `--skip-setup`:
+ don't check if the local system is set up correctly.
+* `--keep-old`:
+ run `brew bottle --keep-old` to build new bottles for a single platform.
+* `--skip-relocation`:
+ run `brew bottle --skip-relocation` to build new bottles that don't require relocation.
+* `--local`:
+ ask Homebrew to write verbose logs under `./logs/` and set `$HOME` to `./home/`
+* `--tap`:
+ use the `git` repository of the given tap. Defaults to the core tap for syntax checking.
+* `--fail-fast`:
+ immediately exit on a failing step.
+* `-v`, `--verbose`:
+ print test step output in real time. Has the side effect of passing output as raw bytes instead of re-encoding in UTF-8.
+* `--test-default-formula`:
+ use a default testing formula when not building a tap and no other formulae are specified.
+* `--bintray-org`:
+ upload to the given Bintray organisation.
+* `--root-url`:
+ use the specified *`URL`* as the root of the bottle's URL instead of Homebrew's default.
+* `--git-name`:
+ set the Git author/committer names to the given name.
+* `--git-email`:
+ set the Git author/committer email to the given email.
+* `--ci-upload`:
+ use the Homebrew CI bottle upload options.
+* `--publish`:
+ publish the uploaded bottles.
+* `--skip-recursive-dependents`:
+ only test the direct dependents.
+* `--only-cleanup-before`:
+ Only run the pre-cleanup step. Needs `--cleanup`.
+* `--only-setup`:
+ Only run the local system setup check step.
+* `--only-tap-syntax`:
+ Only run the tap syntax check step.
+* `--only-formulae`:
+ Only run the formulae steps.
+* `--only-cleanup-after`:
+ Only run the post-cleanup step. Needs `--cleanup`.
+
## CUSTOM EXTERNAL COMMANDS
Homebrew, like `git`(1), supports external commands. These are executable | true |
Other | Homebrew | brew | 8b479ea77be053f3b3d5cf3dafcd15e7dd7d349e.json | manpage: update external commands.
- add more detailed manpage section for external commands (more
information moved from their READMEs)
- add `brew test-bot` to the manpage | manpages/brew.1 | @@ -1388,27 +1388,45 @@ Bundler for non\-Ruby dependencies from Homebrew, Homebrew Cask, Mac App Store a
.
.P
\fBbrew bundle\fR [\fBinstall\fR]
- Install or upgrade all dependencies in a \fBBrewfile\fR\.
+ Install and upgrade (by default) all dependencies from the \fBBrewfile\fR\.
+.
+.P
+You can skip the installation of dependencies by adding space\-separated values to one or more of the following environment variables: \fBHOMEBREW_BUNDLE_BREW_SKIP\fR, \fBHOMEBREW_BUNDLE_CASK_SKIP\fR, \fBHOMEBREW_BUNDLE_MAS_SKIP\fR, \fBHOMEBREW_BUNDLE_WHALEBREW_SKIP\fR, \fBHOMEBREW_BUNDLE_TAP_SKIP\fR
+.
+.P
+\fBbrew bundle\fR will output a \fBBrewfile\.lock\.json\fR in the same directory as the \fBBrewfile\fR if all dependencies are installed successfully\. This contains dependency and system status information which can be useful in debugging \fBbrew bundle\fR failures and replicating a "last known good build" state\. You can opt\-out of this behaviour by setting the \fBHOMEBREW_BUNDLE_NO_LOCK\fR environment variable or passing the \fB\-\-no\-lock\fR option\. You may wish to check this file into the same version control system as your \fBBrewfile\fR (or ensure your version control system ignores it if you\'d prefer to rely on debugging information from a local machine)\.
.
.P
\fBbrew bundle dump\fR
Write all installed casks/formulae/images/taps into a \fBBrewfile\fR\.
.
.P
\fBbrew bundle cleanup\fR
- Uninstall all dependencies not listed in a \fBBrewfile\fR\.
+ Uninstall all dependencies not listed from the \fBBrewfile\fR\.
+.
+.P
+This workflow is useful for maintainers or testers who regularly install lots of formulae\.
.
.P
\fBbrew bundle check\fR
- Check if all dependencies are installed in a \fBBrewfile\fR\.
+ Check if all dependencies are installed from the \fBBrewfile\fR \.
.
.P
-\fBbrew bundle exec\fR \fIcommand\fR
- Run an external command in an isolated build environment\.
+This provides a successful exit code if everything is up\-to\-date, making it useful for scripting\.
.
.P
\fBbrew bundle list\fR
- List all dependencies present in a \fBBrewfile\fR\. By default, only Homebrew dependencies are listed\.
+ List all dependencies present in a \fBBrewfile\fR\.
+.
+.P
+By default, only Homebrew dependencies are listed\.
+.
+.P
+\fBbrew bundle exec\fR \fIcommand\fR
+ Run an external command in an isolated build environment based on the \fBBrewfile\fR dependencies\.
+.
+.P
+This sanitized build environment ignores unrequested dependencies, which makes sure that things you didn\'t specify in your \fBBrewfile\fR won\'t get picked up by commands like \fBbundle install\fR, \fBnpm install\fR, etc\. It will also add compiler flags which will help find keg\-only dependencies like \fBopenssl\fR, \fBicu4c\fR, etc\.
.
.TP
\fB\-\-file\fR
@@ -1478,7 +1496,7 @@ If \fBsudo\fR is passed, operate on \fB/Library/LaunchDaemons\fR (started at boo
.
.P
[\fBsudo\fR] \fBbrew services\fR [\fBlist\fR]
- List all running services for the current user (or root)\.
+ List all managed services for the current user (or root)\.
.
.P
[\fBsudo\fR] \fBbrew services run\fR (\fIformula\fR|\fB\-\-all\fR)
@@ -1504,6 +1522,100 @@ If \fBsudo\fR is passed, operate on \fB/Library/LaunchDaemons\fR (started at boo
\fB\-\-all\fR
Run \fIsubcommand\fR on all services\.
.
+.SS "\fBtest\-bot\fR [\fIoptions\fR] [\fIformula\fR]:"
+Tests the full lifecycle of a Homebrew change to a tap (Git repository)\. For example, for a GitHub Actions pull request that changes a formula \fBbrew test\-bot\fR will ensure the system is cleaned and setup to test the formula, install the formula, run various tests and checks on it, bottle (package) the binaries and test formulae that depend on it to ensure they aren\'t broken by these changes\.
+.
+.P
+Only supports GitHub Actions as a CI provider\. This is because Homebrew uses GitHub Actions and it\'s freely available for public and private use with macOS and Linux workers\.
+.
+.TP
+\fB\-\-dry\-run\fR
+print what would be done rather than doing it\.
+.
+.TP
+\fB\-\-cleanup\fR
+clean all state from the Homebrew directory\. Use with care!
+.
+.TP
+\fB\-\-skip\-setup\fR
+don\'t check if the local system is set up correctly\.
+.
+.TP
+\fB\-\-keep\-old\fR
+run \fBbrew bottle \-\-keep\-old\fR to build new bottles for a single platform\.
+.
+.TP
+\fB\-\-skip\-relocation\fR
+run \fBbrew bottle \-\-skip\-relocation\fR to build new bottles that don\'t require relocation\.
+.
+.TP
+\fB\-\-local\fR
+ask Homebrew to write verbose logs under \fB\./logs/\fR and set \fB$HOME\fR to \fB\./home/\fR
+.
+.TP
+\fB\-\-tap\fR
+use the \fBgit\fR repository of the given tap\. Defaults to the core tap for syntax checking\.
+.
+.TP
+\fB\-\-fail\-fast\fR
+immediately exit on a failing step\.
+.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+print test step output in real time\. Has the side effect of passing output as raw bytes instead of re\-encoding in UTF\-8\.
+.
+.TP
+\fB\-\-test\-default\-formula\fR
+use a default testing formula when not building a tap and no other formulae are specified\.
+.
+.TP
+\fB\-\-bintray\-org\fR
+upload to the given Bintray organisation\.
+.
+.TP
+\fB\-\-root\-url\fR
+use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\.
+.
+.TP
+\fB\-\-git\-name\fR
+set the Git author/committer names to the given name\.
+.
+.TP
+\fB\-\-git\-email\fR
+set the Git author/committer email to the given email\.
+.
+.TP
+\fB\-\-ci\-upload\fR
+use the Homebrew CI bottle upload options\.
+.
+.TP
+\fB\-\-publish\fR
+publish the uploaded bottles\.
+.
+.TP
+\fB\-\-skip\-recursive\-dependents\fR
+only test the direct dependents\.
+.
+.TP
+\fB\-\-only\-cleanup\-before\fR
+Only run the pre\-cleanup step\. Needs \fB\-\-cleanup\fR\.
+.
+.TP
+\fB\-\-only\-setup\fR
+Only run the local system setup check step\.
+.
+.TP
+\fB\-\-only\-tap\-syntax\fR
+Only run the tap syntax check step\.
+.
+.TP
+\fB\-\-only\-formulae\fR
+Only run the formulae steps\.
+.
+.TP
+\fB\-\-only\-cleanup\-after\fR
+Only run the post\-cleanup step\. Needs \fB\-\-cleanup\fR\.
+.
.SH "CUSTOM EXTERNAL COMMANDS"
Homebrew, like \fBgit\fR(1), supports external commands\. These are executable scripts that reside somewhere in the \fBPATH\fR, named \fBbrew\-\fR\fIcmdname\fR or \fBbrew\-\fR\fIcmdname\fR\fB\.rb\fR, which can be invoked like \fBbrew\fR \fIcmdname\fR\. This allows you to create your own commands without modifying Homebrew\'s internals\.
. | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/cask/audit.rb | @@ -6,6 +6,7 @@
require "digest"
require "utils/curl"
require "utils/git"
+require "utils/notability"
module Cask
class Audit
@@ -14,22 +15,22 @@ class Audit
attr_reader :cask, :commit_range, :download
- attr_predicate :check_appcast?
+ attr_predicate :appcast?
- def initialize(cask, check_appcast: false, download: false, check_token_conflicts: false,
- commit_range: nil, command: SystemCommand)
+ def initialize(cask, appcast: false, download: false,
+ token_conflicts: false, online: false, strict: false,
+ new_cask: false, commit_range: nil, command: SystemCommand)
@cask = cask
- @check_appcast = check_appcast
+ @appcast = appcast
@download = download
+ @online = online
+ @strict = strict
+ @new_cask = new_cask
@commit_range = commit_range
- @check_token_conflicts = check_token_conflicts
+ @token_conflicts = token_conflicts
@command = command
end
- def check_token_conflicts?
- @check_token_conflicts
- end
-
def run!
check_blacklist
check_required_stanzas
@@ -48,6 +49,9 @@ def run!
check_latest_with_auto_updates
check_stanza_requires_uninstall
check_appcast_contains_version
+ check_github_repository
+ check_gitlab_repository
+ check_bitbucket_repository
self
rescue => e
odebug "#{e.message}\n#{e.backtrace.join("\n")}"
@@ -272,7 +276,7 @@ def check_generic_artifacts
end
def check_token_conflicts
- return unless check_token_conflicts?
+ return unless @token_conflicts
return unless core_formula_names.include?(cask.token)
add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
@@ -301,7 +305,7 @@ def check_download
end
def check_appcast_contains_version
- return unless check_appcast?
+ return unless appcast?
return if cask.appcast.to_s.empty?
return if cask.appcast.configuration == :no_check
@@ -322,6 +326,50 @@ def check_appcast_contains_version
add_error "appcast at URL '#{appcast_stanza}' offline or looping"
end
+ def check_github_repository
+ user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*})
+ return if user.nil?
+
+ odebug "Auditing GitHub repo"
+
+ error = SharedAudits.github(user, repo)
+ add_error error if error
+ end
+
+ def check_gitlab_repository
+ user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*})
+ return if user.nil?
+
+ odebug "Auditing GitLab repo"
+
+ error = SharedAudits.gitlab(user, repo)
+ add_error error if error
+ end
+
+ def check_bitbucket_repository
+ user, repo = get_repo_data(%r{https?://bitbucket\.org/([^/]+)/([^/]+)/?.*})
+ return if user.nil?
+
+ odebug "Auditing Bitbucket repo"
+
+ error = SharedAudits.bitbucket(user, repo)
+ add_error error if error
+ end
+
+ def get_repo_data(regex)
+ return unless @online
+ return unless @new_cask
+
+ _, user, repo = *regex.match(cask.url.to_s)
+ _, user, repo = *regex.match(cask.homepage) unless user
+ _, user, repo = *regex.match(cask.appcast.to_s) unless user
+ return if !user || !repo
+
+ repo.gsub!(/.git$/, "")
+
+ [user, repo]
+ end
+
def check_blacklist
return if cask.tap&.user != "Homebrew"
return unless reason = Blacklist.blacklisted_reason(cask.token) | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/cask/auditor.rb | @@ -8,34 +8,37 @@ class Auditor
extend Predicable
def self.audit(cask, audit_download: false, audit_appcast: false,
- check_token_conflicts: false, quarantine: true, commit_range: nil)
+ audit_online: false, audit_strict: false,
+ audit_token_conflicts: false, audit_new_cask: false,
+ quarantine: true, commit_range: nil)
new(cask, audit_download: audit_download,
audit_appcast: audit_appcast,
- check_token_conflicts: check_token_conflicts,
+ audit_online: audit_online,
+ audit_new_cask: audit_new_cask,
+ audit_strict: audit_strict,
+ audit_token_conflicts: audit_token_conflicts,
quarantine: quarantine, commit_range: commit_range).audit
end
attr_reader :cask, :commit_range
def initialize(cask, audit_download: false, audit_appcast: false,
- check_token_conflicts: false, quarantine: true, commit_range: nil)
+ audit_online: false, audit_strict: false,
+ audit_token_conflicts: false, audit_new_cask: false,
+ quarantine: true, commit_range: nil)
@cask = cask
@audit_download = audit_download
@audit_appcast = audit_appcast
+ @audit_online = audit_online
+ @audit_strict = audit_strict
+ @audit_new_cask = audit_new_cask
@quarantine = quarantine
@commit_range = commit_range
- @check_token_conflicts = check_token_conflicts
+ @audit_token_conflicts = audit_token_conflicts
end
- def audit_download?
- @audit_download
- end
-
- attr_predicate :audit_appcast?, :quarantine?
-
- def check_token_conflicts?
- @check_token_conflicts
- end
+ attr_predicate :audit_appcast?, :audit_download?, :audit_online?,
+ :audit_strict?, :audit_new_cask?, :audit_token_conflicts?, :quarantine?
def audit
if !Homebrew.args.value("language") && language_blocks
@@ -64,10 +67,13 @@ def audit_languages(languages)
def audit_cask_instance(cask)
download = audit_download? && Download.new(cask, quarantine: quarantine?)
- audit = Audit.new(cask, check_appcast: audit_appcast?,
- download: download,
- check_token_conflicts: check_token_conflicts?,
- commit_range: commit_range)
+ audit = Audit.new(cask, appcast: audit_appcast?,
+ online: audit_online?,
+ strict: audit_strict?,
+ new_cask: audit_new_cask?,
+ token_conflicts: audit_token_conflicts?,
+ download: download,
+ commit_range: commit_range)
audit.run!
puts audit.summary
audit.success? | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/cask/cmd/audit.rb | @@ -1,32 +1,66 @@
# frozen_string_literal: true
+require "cli/parser"
+
module Cask
class Cmd
class Audit < AbstractCommand
- option "--download", :download, false
- option "--appcast", :appcast, false
- option "--token-conflicts", :token_conflicts, false
+ option "--download", :download_arg, false
+ option "--appcast", :appcast_arg, false
+ option "--token-conflicts", :token_conflicts_arg, false
+ option "--strict", :strict_arg, false
+ option "--online", :online_arg, false
+ option "--new-cask", :new_cask_arg, false
+
+ def self.usage
+ <<~EOS
+ `cask audit` [<options>] [<cask>]
+
+ --strict - Run additional, stricter style checks.
+ --online - Run additional, slower style checks that require a network connection.
+ --new-cask - Run various additional style checks to determine if a new cask is eligible
+ for Homebrew. This should be used when creating new casks and implies
+ `--strict` and `--online`.
+ --download - Audit the downloaded file
+ --appcast - Audit the appcast
+ --token-conflicts - Audit for token conflicts
+
+ Check <cask> for Homebrew coding style violations. This should be run before
+ submitting a new cask. If no <casks> are provided, check all locally
+ available casks. Will exit with a non-zero status if any errors are
+ found, which can be useful for implementing pre-commit hooks.
+ EOS
+ end
def self.help
"verifies installability of Casks"
end
def run
+ Homebrew.auditing = true
+ strict = new_cask_arg? || strict_arg?
+ token_conflicts = strict || token_conflicts_arg?
+
+ online = new_cask_arg? || online_arg?
+ download = online || download_arg?
+ appcast = online || appcast_arg?
+
failed_casks = casks(alternative: -> { Cask.to_a })
- .reject { |cask| audit(cask) }
+ .reject do |cask|
+ odebug "Auditing Cask #{cask}"
+ Auditor.audit(cask, audit_download: download,
+ audit_appcast: appcast,
+ audit_online: online,
+ audit_strict: strict,
+ audit_new_cask: new_cask_arg?,
+ audit_token_conflicts: token_conflicts,
+ quarantine: quarantine?)
+ end
return if failed_casks.empty?
raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
end
-
- def audit(cask)
- odebug "Auditing Cask #{cask}"
- Auditor.audit(cask, audit_download: download?,
- audit_appcast: appcast?,
- check_token_conflicts: token_conflicts?,
- quarantine: quarantine?)
- end
end
end
end | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/dev-cmd/audit.rb | @@ -3,6 +3,7 @@
require "formula"
require "formula_versions"
require "utils/curl"
+require "utils/notability"
require "extend/ENV"
require "formula_cellar_checks"
require "cmd/search"
@@ -510,79 +511,30 @@ def audit_github_repository
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*})
return if user.nil?
- begin
- metadata = GitHub.repository(user, repo)
- rescue GitHub::HTTPNotFoundError
- return
- end
-
- return if metadata.nil?
-
- new_formula_problem "GitHub fork (not canonical repository)" if metadata["fork"]
- if (metadata["forks_count"] < 30) && (metadata["subscribers_count"] < 30) &&
- (metadata["stargazers_count"] < 75)
- new_formula_problem "GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)"
- end
+ warning = SharedAudits.github(user, repo)
+ return if warning.nil?
- return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
-
- new_formula_problem "GitHub repository too new (<30 days old)"
+ new_formula_problem warning
end
def audit_gitlab_repository
user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*})
return if user.nil?
- out, _, status= curl_output("--request", "GET", "https://gitlab.com/api/v4/projects/#{user}%2F#{repo}")
- return unless status.success?
-
- metadata = JSON.parse(out)
- return if metadata.nil?
-
- new_formula_problem "GitLab fork (not canonical repository)" if metadata["fork"]
- if (metadata["forks_count"] < 30) && (metadata["star_count"] < 75)
- new_formula_problem "GitLab repository not notable enough (<30 forks and <75 stars)"
- end
-
- return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
+ warning = SharedAudits.gitlab(user, repo)
+ return if warning.nil?
- new_formula_problem "GitLab repository too new (<30 days old)"
+ new_formula_problem warning
end
def audit_bitbucket_repository
user, repo = get_repo_data(%r{https?://bitbucket\.org/([^/]+)/([^/]+)/?.*})
return if user.nil?
- api_url = "https://api.bitbucket.org/2.0/repositories/#{user}/#{repo}"
- out, _, status= curl_output("--request", "GET", api_url)
- return unless status.success?
-
- metadata = JSON.parse(out)
- return if metadata.nil?
-
- new_formula_problem "Uses deprecated mercurial support in Bitbucket" if metadata["scm"] == "hg"
-
- new_formula_problem "Bitbucket fork (not canonical repository)" unless metadata["parent"].nil?
-
- if Date.parse(metadata["created_on"]) >= (Date.today - 30)
- new_formula_problem "Bitbucket repository too new (<30 days old)"
- end
-
- forks_out, _, forks_status= curl_output("--request", "GET", "#{api_url}/forks")
- return unless forks_status.success?
-
- watcher_out, _, watcher_status= curl_output("--request", "GET", "#{api_url}/watchers")
- return unless watcher_status.success?
-
- forks_metadata = JSON.parse(forks_out)
- return if forks_metadata.nil?
-
- watcher_metadata = JSON.parse(watcher_out)
- return if watcher_metadata.nil?
-
- return if (forks_metadata["size"] < 30) && (watcher_metadata["size"] < 75)
+ warning = SharedAudits.bitbucket(user, repo)
+ return if warning.nil?
- new_formula_problem "Bitbucket repository not notable enough (<30 forks and <75 watchers)"
+ new_formula_problem warning
end
def get_repo_data(regex) | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/test/cask/audit_spec.rb | @@ -39,12 +39,12 @@ def include_msg?(messages, msg)
let(:cask) { instance_double(Cask::Cask) }
let(:download) { false }
- let(:check_token_conflicts) { false }
+ let(:token_conflicts) { false }
let(:fake_system_command) { class_double(SystemCommand) }
let(:audit) {
- described_class.new(cask, download: download,
- check_token_conflicts: check_token_conflicts,
- command: fake_system_command)
+ described_class.new(cask, download: download,
+ token_conflicts: token_conflicts,
+ command: fake_system_command)
}
describe "#result" do
@@ -517,7 +517,7 @@ def include_msg?(messages, msg)
describe "token conflicts" do
let(:cask_token) { "with-binary" }
- let(:check_token_conflicts) { true }
+ let(:token_conflicts) { true }
context "when cask token conflicts with a core formula" do
let(:formula_names) { %w[with-binary other-formula] } | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/test/cask/cmd/audit_spec.rb | @@ -21,7 +21,13 @@
expect(Cask::CaskLoader).to receive(:load).with(cask_token).and_return(cask)
expect(Cask::Auditor).to receive(:audit)
- .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: false, quarantine: true)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
.and_return(true)
described_class.run(cask_token)
@@ -32,7 +38,13 @@
it "does not download the Cask per default" do
allow(Cask::CaskLoader).to receive(:load).and_return(cask)
expect(Cask::Auditor).to receive(:audit)
- .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: false, quarantine: true)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
.and_return(true)
described_class.run("casktoken")
@@ -41,7 +53,13 @@
it "download a Cask if --download flag is set" do
allow(Cask::CaskLoader).to receive(:load).and_return(cask)
expect(Cask::Auditor).to receive(:audit)
- .with(cask, audit_download: true, audit_appcast: false, check_token_conflicts: false, quarantine: true)
+ .with(cask, audit_download: true,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
.and_return(true)
described_class.run("casktoken", "--download")
@@ -52,7 +70,13 @@
it "does not check for token conflicts per default" do
allow(Cask::CaskLoader).to receive(:load).and_return(cask)
expect(Cask::Auditor).to receive(:audit)
- .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: false, quarantine: true)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
.and_return(true)
described_class.run("casktoken")
@@ -61,10 +85,112 @@
it "checks for token conflicts if --token-conflicts flag is set" do
allow(Cask::CaskLoader).to receive(:load).and_return(cask)
expect(Cask::Auditor).to receive(:audit)
- .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: true, quarantine: true)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: true,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
.and_return(true)
described_class.run("casktoken", "--token-conflicts")
end
end
+
+ describe "rules for checking strictly" do
+ it "does not check strictly per default" do
+ allow(Cask::CaskLoader).to receive(:load).and_return(cask)
+ expect(Cask::Auditor).to receive(:audit)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
+ .and_return(true)
+
+ described_class.run("casktoken")
+ end
+
+ it "checks strictly if --strict flag is set" do
+ allow(Cask::CaskLoader).to receive(:load).and_return(cask)
+ expect(Cask::Auditor).to receive(:audit)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: true,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: true,
+ quarantine: true)
+ .and_return(true)
+
+ described_class.run("casktoken", "--strict")
+ end
+ end
+
+ describe "rules for checking online" do
+ it "does not check online per default" do
+ allow(Cask::CaskLoader).to receive(:load).and_return(cask)
+ expect(Cask::Auditor).to receive(:audit)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
+ .and_return(true)
+
+ described_class.run("casktoken")
+ end
+
+ it "checks online if --online flag is set" do
+ allow(Cask::CaskLoader).to receive(:load).and_return(cask)
+ expect(Cask::Auditor).to receive(:audit)
+ .with(cask, audit_download: true,
+ audit_appcast: true,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: true,
+ audit_strict: false,
+ quarantine: true)
+ .and_return(true)
+
+ described_class.run("casktoken", "--online")
+ end
+ end
+
+ describe "rules for checking new casks" do
+ it "does not check new casks per default" do
+ allow(Cask::CaskLoader).to receive(:load).and_return(cask)
+ expect(Cask::Auditor).to receive(:audit)
+ .with(cask, audit_download: false,
+ audit_appcast: false,
+ audit_token_conflicts: false,
+ audit_new_cask: false,
+ audit_online: false,
+ audit_strict: false,
+ quarantine: true)
+ .and_return(true)
+
+ described_class.run("casktoken")
+ end
+
+ it "checks new casks if --new-cask flag is set" do
+ allow(Cask::CaskLoader).to receive(:load).and_return(cask)
+ expect(Cask::Auditor).to receive(:audit)
+ .with(cask, audit_download: true,
+ audit_appcast: true,
+ audit_token_conflicts: true,
+ audit_new_cask: true,
+ audit_online: true,
+ audit_strict: true,
+ quarantine: true)
+ .and_return(true)
+
+ described_class.run("casktoken", "--new-cask")
+ end
+ end
end | true |
Other | Homebrew | brew | 3567892802a19870a1a7ec514c895af3e53de8e2.json | Add notibility checks for casks | Library/Homebrew/utils/notability.rb | @@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+require "utils/curl"
+
+module SharedAudits
+ module_function
+
+ def github(user, repo)
+ begin
+ metadata = GitHub.repository(user, repo)
+ rescue GitHub::HTTPNotFoundError
+ return
+ end
+
+ return if metadata.nil?
+
+ return "GitHub fork (not canonical repository)" if metadata["fork"]
+ if (metadata["forks_count"] < 30) && (metadata["subscribers_count"] < 30) &&
+ (metadata["stargazers_count"] < 75)
+ return "GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)"
+ end
+
+ return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
+
+ "GitHub repository too new (<30 days old)"
+ end
+
+ def gitlab(user, repo)
+ out, _, status= curl_output("--request", "GET", "https://gitlab.com/api/v4/projects/#{user}%2F#{repo}")
+ return unless status.success?
+
+ metadata = JSON.parse(out)
+ return if metadata.nil?
+
+ return "GitLab fork (not canonical repository)" if metadata["fork"]
+ if (metadata["forks_count"] < 30) && (metadata["star_count"] < 75)
+ return "GitLab repository not notable enough (<30 forks and <75 stars)"
+ end
+
+ return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
+
+ "GitLab repository too new (<30 days old)"
+ end
+
+ def bitbucket(user, repo)
+ api_url = "https://api.bitbucket.org/2.0/repositories/#{user}/#{repo}"
+ out, _, status= curl_output("--request", "GET", api_url)
+ return unless status.success?
+
+ metadata = JSON.parse(out)
+ return if metadata.nil?
+
+ return "Uses deprecated mercurial support in Bitbucket" if metadata["scm"] == "hg"
+
+ return "Bitbucket fork (not canonical repository)" unless metadata["parent"].nil?
+
+ return "Bitbucket repository too new (<30 days old)" if Date.parse(metadata["created_on"]) >= (Date.today - 30)
+
+ forks_out, _, forks_status= curl_output("--request", "GET", "#{api_url}/forks")
+ return unless forks_status.success?
+
+ watcher_out, _, watcher_status= curl_output("--request", "GET", "#{api_url}/watchers")
+ return unless watcher_status.success?
+
+ forks_metadata = JSON.parse(forks_out)
+ return if forks_metadata.nil?
+
+ watcher_metadata = JSON.parse(watcher_out)
+ return if watcher_metadata.nil?
+
+ return if (forks_metadata["size"] < 30) && (watcher_metadata["size"] < 75)
+
+ "Bitbucket repository not notable enough (<30 forks and <75 watchers)"
+ end
+end | true |
Other | Homebrew | brew | 0b4febceafa02d559add2d955f12ccb465d21a46.json | fix undefined variable interpolation in tcsh | Library/Homebrew/cmd/shellenv.sh | @@ -20,8 +20,8 @@ homebrew-shellenv() {
echo "setenv HOMEBREW_CELLAR $HOMEBREW_CELLAR;"
echo "setenv HOMEBREW_REPOSITORY $HOMEBREW_REPOSITORY;"
echo "setenv PATH $HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH;"
- echo "setenv MANPATH $HOMEBREW_PREFIX/share/man:\$MANPATH;"
- echo "setenv INFOPATH $HOMEBREW_PREFIX/share/info:\$INFOPATH;"
+ echo "setenv MANPATH $HOMEBREW_PREFIX/share/man\`[ \${?MANPATH} == 1 ] && echo \":\${MANPATH}\"\`:;"
+ echo "setenv INFOPATH $HOMEBREW_PREFIX/share/info\`[ \${?INFOPATH} == 1 ] && echo \":\${INFOPATH}\"\`;"
;;
*)
echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\";" | false |
Other | Homebrew | brew | 0cced8e7bd2e0b5e52448dc0448a033bb03ec54b.json | audit: Fix Regexp for stripping `.git` from repo URLs
- [For a formula named
turbogit](https://github.com/Homebrew/homebrew-core/pull/55208), we
didn't see any of the notability checks fail CI.
- The repo name was getting truncated to `turb`, which didn't exist, so
the audit didn't return anything for this check.
- The Regexp to strip `.git` from the end of was not escaping the `.`,
so it would match anything ending in `git`, not a literal `.git`. | Library/Homebrew/dev-cmd/audit.rb | @@ -597,7 +597,7 @@ def get_repo_data(regex)
_, user, repo = *regex.match(formula.homepage) unless user
return if !user || !repo
- repo.gsub!(/.git$/, "")
+ repo.delete_suffix!(".git")
[user, repo]
end | false |
Other | Homebrew | brew | fd343c0578e4a8f6c7b5d33c3dfce85bf1c0305f.json | cmd/info: fix missing formula reference.
Fixes #7639 | Library/Homebrew/cmd/info.rb | @@ -105,7 +105,7 @@ def print_info
args.named.each_with_index do |f, i|
puts unless i.zero?
begin
- Formulary.factory(f)
+ formula = Formulary.factory(f)
if args.analytics?
Utils::Analytics.formula_output(formula)
else | false |
Other | Homebrew | brew | e10ade758d7937b9f713c7d4f1c7c95d2f2b6721.json | Revert "formulary: install tap if needed." | Library/Homebrew/formulary.rb | @@ -279,8 +279,6 @@ def get_formula(spec, alias_path: nil)
end
def load_file
- tap.install unless tap.installed?
-
super
rescue MethodDeprecatedError => e
e.issues_url = tap.issues_url || tap.to_s | true |
Other | Homebrew | brew | e10ade758d7937b9f713c7d4f1c7c95d2f2b6721.json | Revert "formulary: install tap if needed." | Library/Homebrew/test/formulary_spec.rb | @@ -227,8 +227,7 @@ class Wrong#{described_class.class_s(formula_name)} < Formula
end
end
- it "raises an error if the Formula is not available after tapping" do
- expect_any_instance_of(Tap).to receive(:install)
+ it "raises an error if the Formula is not available" do
expect {
described_class.to_rack("a/b/#{formula_name}")
}.to raise_error(TapFormulaUnavailableError) | true |
Other | Homebrew | brew | 61b48d8557042519889860a0f57a66fb233e1d23.json | formulary: install tap if needed.
This matches what `cask_loader` does and is low risk given we no longer
allow tap pinning.
Fixes #7626 | Library/Homebrew/formulary.rb | @@ -279,6 +279,8 @@ def get_formula(spec, alias_path: nil)
end
def load_file
+ tap.install unless tap.installed?
+
super
rescue MethodDeprecatedError => e
e.issues_url = tap.issues_url || tap.to_s | true |
Other | Homebrew | brew | 61b48d8557042519889860a0f57a66fb233e1d23.json | formulary: install tap if needed.
This matches what `cask_loader` does and is low risk given we no longer
allow tap pinning.
Fixes #7626 | Library/Homebrew/test/formulary_spec.rb | @@ -227,7 +227,8 @@ class Wrong#{described_class.class_s(formula_name)} < Formula
end
end
- it "raises an error if the Formula is not available" do
+ it "raises an error if the Formula is not available after tapping" do
+ expect_any_instance_of(Tap).to receive(:install)
expect {
described_class.to_rack("a/b/#{formula_name}")
}.to raise_error(TapFormulaUnavailableError) | true |
Other | Homebrew | brew | e6c720c22cd81058a573195d19ded34a2b0ebfb4.json | Update zsh completion | completions/zsh/_brew | @@ -377,17 +377,19 @@ _brew_edit() {
'*:: :__brew_formulae_or_ruby_files'
}
-# brew fetch [--force] [--retry] [-v] [--devel|--HEAD] [--deps] [--build-from-source|--force-bottle] formulae
+# brew fetch [--force] [--retry] [-v] [--devel|--HEAD] [--deps]
+# [--build-from-source|--build-bottle|--force-bottle] formulae
_brew_fetch() {
_arguments \
- '--force[remove previously cached version and re-fetch]' \
+ '(--force -f)'{--force,-f}'[remove previously cached version and re-fetch]' \
'--retry[retry if a download fails or re-download if the checksum of a previously cached version no longer matches]' \
- '-v[verbose VCS checkout]' \
+ '(--verbose -v)'{--verbose,-v}'[verbose VCS checkout]' \
'(--HEAD)--devel[fetch devel version instead of stable]' \
'(--devel)--HEAD[fetch HEAD version instead of stable]' \
'--deps[also download dependencies for any listed formulae]' \
- '(--force-bottle)--build-from-source[download the source rather than a bottle]' \
- '(--build-from-source)--force-bottle[download a bottle if it exists for the current version of OS X, even if it would not be used during installation]' \
+ '(--build-from-source -s --force-bottle --build-bottle)'{--build-from-source,-s}'[download the source rather than a bottle]' \
+ '(--build-from-source -s --force-bottle)--build-bottle[download the source (for eventual bottling) rather than a bottle]' \
+ '(--build-from-source -s --build-bottle)--force-bottle[download a bottle if it exists for the current version of OS X, even if it would not be used during installation]' \
'*:formula:__brew_formulae'
}
@@ -431,21 +433,27 @@ _brew_info() {
'(--all --installed)*: :__brew_formulae'
}
-# brew install [--debug] [--env=std|super] [--ignore-dependencies]
-# [--only-dependencies] [--cc=compiler] [--build-from-source]
-# [--devel|--HEAD] [--keep-tmp] formulae
+# brew install [--debug] [--env=std|super]
+# [--ignore-dependencies|--only-dependencies] [--include-test]
+# [--cc=compiler] [--build-from-source|--build-bottle|--force-fottle]
+# [--devel|--HEAD] [--fetch-HEAD] [--bottle-arch=architecture] [--keep-tmp] formulae
# brew install --interactive [--git] formula
_brew_install() {
local state
_arguments \
- normal-install \
'--debug[if brewing fails, open an interactive debugging session]' \
-'-env=-[use standard or super environment]:environment:(std super)' \
- '--ignore-dependencies[skip installing any dependencies of any kind]' \
- '--only-dependencies[install the dependencies but do not install the specified formula]' \
+ '(--only-dependencies)--ignore-dependencies[skip installing any dependencies of any kind]' \
+ '(--ignore-dependencies)--only-dependencies[install the dependencies but do not install the specified formula]' \
'--cc=-[attempt to compile using compiler]:compiler: ' \
- '(--build-from-source -s)'{--build-from-source,-s}'[compile the specified formula from source even if a bottle is provided]' \
+ '(--build-from-source -s --force-bottle --build-bottle)'{--build-from-source,-s}'[compile the specified formula from source even if a bottle is provided]' \
+ '(--build-from-source -s --force-bottle)--build-bottle[prepare the formula for eventual bottling during installation, skipping any post-install steps]' \
+ '(--build-from-source -s --build-bottle)--force-bottle[install from a bottle if it exists for the current version of OS X, even if it would not normally be used for installation]' \
+ '--include-test[install testing dependencies]' \
'(--devel --HEAD)'{--devel,--HEAD}'[install the development / HEAD version]' \
+ '--fetch-HEAD[fetch the upstream repository to detect if the HEAD installation of the formula is outdated]' \
+ '--bottle-arch=-[optimise bottles for the specified architecture]:architecture: ' \
'--keep-tmp[don''t delete temporary files created during installation]' \
'--display-times[display installation times at end of run]' \
'*: : __brew_formulae' \
@@ -570,7 +578,7 @@ _brew_pull() {
}
# brew pr-pull [--no-upload|--no-publish] [--dry-run] [--clean] [--branch-okay]
-# [--resolve] [--workflow] [--artifact] [--bintray-org] [--tap] pull_request
+# [--resolve] [--workflow] [--artifact] [--bintray-org] [--tap] pull_request
_brew_pr_pull() {
_arguments \
'(--no-upload)--no-publish[download the bottles, apply the bottle commit, and upload the bottles to Bintray, but don''t publish them]' \
@@ -592,10 +600,19 @@ _brew_readall() {
}
# brew reinstall formulae:
+# mostly copy from brew install
_brew_reinstall() {
_arguments \
- '--display-times[display installation times at end of run]' \
- '*::formula:__brew_installed_formulae'
+ - normal-install \
+ '--debug[if brewing fails, open an interactive debugging session]' \
+ '(--build-from-source -s --force-bottle)'{--build-from-source,-s}'[compile the specified formula from source even if a bottle is provided]' \
+ '(--build-from-source -s)--force-bottle[install from a bottle if it exists for the current version of OS X, even if it would not normally be used for installation]' \
+ '--keep-tmp[don''t delete temporary files created during installation]' \
+ '--display-times[display installation times at end of run]' \
+ '*::formula:__brew_installed_formulae' \
+ - interactive-install \
+ '--interactive[download and patch formula, then open a shell]' \
+ '::formula:__brew_installed_formulae'
}
# brew search, -S:
@@ -790,7 +807,8 @@ _brew_upgrade() {
'--ignore-dependencies[skip installing any dependencies of any kind]' \
'--only-dependencies[install the dependencies but do not install the specified formula]' \
'--cc=-[attempt to compile using compiler]:compiler: ' \
- '(--build-from-source -s)'{--build-from-source,-s}'[compile the specified formula from source even if a bottle is provided]' \
+ '(--build-from-source -s --force-bottle)'{--build-from-source,-s}'[compile the specified formula from source even if a bottle is provided]' \
+ '(--build-from-source -s)--force-bottle[install from a bottle if it exists for the current version of OS X, even if it would not normally be used for installation]' \
'(--devel --HEAD)'{--devel,--HEAD}'[install the development / HEAD version]' \
'--keep-tmp[don''t delete temporary files created during installation]' \
'--display-times[display installation times at end of run]' \ | false |
Other | Homebrew | brew | 575055e36a5ab4c03012c9e105760d1786291c36.json | env_config_spec: remove unneeded BAT_CONFIG tests. | Library/Homebrew/test/env_config_spec.rb | @@ -49,16 +49,6 @@
ENV["HOMEBREW_BAT"] = nil
expect(env_config.bat?).to be(false)
end
-
- it "returns value if set" do
- ENV["HOMEBREW_BAT_CONFIG_PATH"] = "~/.config/bat/config"
- expect(env_config.bat_config_path).to eql("~/.config/bat/config")
- end
-
- it "returns nil if unset" do
- ENV["HOMEBREW_BAT_CONFIG_PATH"] = nil
- expect(env_config.bat_config_path).to be_nil
- end
end
describe ".make_jobs" do | false |
Other | Homebrew | brew | 8dcb1636ce40425e29c0408a8a366889ef02e8c0.json | utils/ruby.sh: add explanatory comments | Library/Homebrew/utils/ruby.sh | @@ -50,15 +50,15 @@ If there's no Homebrew Portable Ruby available for your processor:
then
HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby"
else
- IFS=$'\n'
+ IFS=$'\n' # Do word splitting on new lines only
for ruby_exec in $(which -a ruby) $(PATH=$HOMEBREW_PATH which -a ruby)
do
if [[ $(test-ruby "$ruby_exec") == "true" ]]; then
HOMEBREW_RUBY_PATH=$ruby_exec
break
fi
done
- IFS=$' \t\n'
+ IFS=$' \t\n' # Restore IFS to its default value
[[ -z $HOMEBREW_RUBY_PATH ]] && onoe "Failed to find usable Ruby $required_ruby_version!"
fi
| false |
Other | Homebrew | brew | 159a5bb2d6d3a27848d9b7eeb781a222f30e3b0c.json | add compsys cache for brew casks | completions/zsh/_brew_cask | @@ -19,7 +19,13 @@ __brew_cask() {
__brew_all_casks() {
local -a list
local expl
- list=( $(brew search --casks) )
+ local comp_cachename=brew_casks
+
+ if _cache_invalid $comp_cachename || ! _retrieve_cache $comp_cachename; then
+ list=( $(brew search --casks) )
+ _store_cache $comp_cachename list
+ fi
+
_wanted list expl 'all casks' compadd -a list
}
| false |
Other | Homebrew | brew | 633501ab089f3c18fea0406f5324a9ebbec55be2.json | audit: remove incorrect TODO.
This check can't really be in RuboCop (as it relies on the URL strategy
logic). | Library/Homebrew/dev-cmd/audit.rb | @@ -1060,7 +1060,6 @@ def audit_download_strategy
url_strategy = DownloadStrategyDetector.detect(url)
if using == :git || url_strategy == GitDownloadStrategy
- # TODO: check could be in RuboCop
problem "Git should specify :revision when a :tag is specified." if specs[:tag] && !specs[:revision]
end
| false |
Other | Homebrew | brew | dcc486fa9effd7c8c03d7a8ba940170fd192e8db.json | utils/ruby.sh: find usable Ruby from PATH only | Library/Homebrew/utils/ruby.sh | @@ -13,7 +13,7 @@ setup-ruby-path() {
# When bumping check if HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH (in brew.sh)
# also needs to be changed.
local required_ruby_version="2.6"
- local old_ruby_path ruby_clean_path ruby_user_path
+ local ruby_exec
local advice="
If there's no Homebrew Portable Ruby available for your processor:
- install Ruby $required_ruby_version with your system package manager (or rbenv/ruby-build)
@@ -25,8 +25,6 @@ If there's no Homebrew Portable Ruby available for your processor:
vendor_ruby_current_version="$vendor_dir/portable-ruby/current"
vendor_ruby_path="$vendor_ruby_current_version/bin/ruby"
- [[ -n $HOMEBREW_RUBY_PATH ]] && old_ruby_path=$HOMEBREW_RUBY_PATH
-
unset HOMEBREW_RUBY_PATH
if [[ "$HOMEBREW_COMMAND" != "vendor-install" ]]
@@ -52,17 +50,16 @@ If there's no Homebrew Portable Ruby available for your processor:
then
HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby"
else
- ruby_clean_path=$(type -P ruby)
- ruby_user_path=$(PATH="$HOMEBREW_PATH" type -P ruby)
- if [[ $(test-ruby "$old_ruby_path") == "true" ]]; then
- HOMEBREW_RUBY_PATH=$old_ruby_path
- elif [[ $(test-ruby "$ruby_clean_path") == "true" ]]; then
- HOMEBREW_RUBY_PATH=$ruby_clean_path
- elif [[ $(test-ruby "$ruby_user_path") == "true" ]]; then
- HOMEBREW_RUBY_PATH=$ruby_user_path
- else
- onoe "Failed to find usable Ruby $required_ruby_version!"
- fi
+ IFS=$'\n'
+ for ruby_exec in $(which -a ruby) $(PATH=$HOMEBREW_PATH which -a ruby)
+ do
+ if [[ $(test-ruby "$ruby_exec") == "true" ]]; then
+ HOMEBREW_RUBY_PATH=$ruby_exec
+ break
+ fi
+ done
+ IFS=$' \t\n'
+ [[ -z $HOMEBREW_RUBY_PATH ]] && onoe "Failed to find usable Ruby $required_ruby_version!"
fi
if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]] | false |
Other | Homebrew | brew | fbabeb446839ea1bd327d39612486293647af85b.json | add a comment | .github/workflows/tests.yml | @@ -71,6 +71,8 @@ jobs:
# Link old gettext (otherwise `brew doctor` is sad)
brew link gettext
+
+ # remove deleted formula
brew uninstall --force python@2
fi
brew doctor | false |
Other | Homebrew | brew | 667d87ce67ceae9fffd03316e62523c6647c7121.json | workflows/tests: set global environment.
We never want to auto-update and we want to globally set that we're in
GitHub Actions. | .github/workflows/tests.yml | @@ -6,6 +6,9 @@ on:
release:
types:
- published
+env:
+ HOMEBREW_GITHUB_ACTIONS: 1
+ HOMEBREW_NO_AUTO_UPDATE: 1
jobs:
tests:
if: github.repository == 'Homebrew/brew'
@@ -66,9 +69,6 @@ jobs:
# Cleanup some Linux `brew doctor` failures
sudo rm -rf /usr/local/include/node/
else
- # Allow Xcode to be outdated
- export HOMEBREW_GITHUB_ACTIONS=1
-
# Link old gettext (otherwise `brew doctor` is sad)
brew link gettext
fi
@@ -93,7 +93,6 @@ jobs:
- name: Install taps
run: |
# Install taps needed for 'brew tests' and 'brew man'
- export HOMEBREW_NO_AUTO_UPDATE=1
cd "$(brew --repo)"
brew tap homebrew/bundle
brew update-reset Library/Taps/homebrew/homebrew-bundle
@@ -137,7 +136,6 @@ jobs:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# set variables for coverage reporting
- HOMEBREW_GITHUB_ACTIONS: 1
HOMEBREW_CI_NAME: github-actions
HOMEBREW_COVERALLS_REPO_TOKEN: 3F6U6ZqctoNJwKyREremsqMgpU3qYgxFk
| false |
Other | Homebrew | brew | 957f318f2cfb9e83f440572b12fd8b45a39e0776.json | Specify the stance on mocks in test blocks | docs/Formula-Cookbook.md | @@ -277,7 +277,7 @@ Some advice for specific cases:
* If the formula is a library, compile and run some simple code that links against it. It could be taken from upstream's documentation / source examples.
A good example is [`tinyxml2`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/tinyxml2.rb), which writes a small C++ source file into the test directory, compiles and links it against the tinyxml2 library and finally checks that the resulting program runs successfully.
* If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.
-* If the software cannot function without credentials or requires a virtual machine, docker instance, etc. to run, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected.
+* If the software cannot function without credentials or requires a virtual machine, docker instance, etc. to run, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected. This is prefered over mocking a dependency.
* Homebrew comes with a number of [standard test fixtures](https://github.com/Homebrew/brew/tree/master/Library/Homebrew/test/support/fixtures), including numerous sample images, sounds, and documents in various formats. You can get the file path to a test fixture with `test_fixtures("test.svg")`.
* If your test requires a test file that isn't a standard test fixture, you can install it from a source repository during the `test` phase with a resource block, like this:
| false |
Other | Homebrew | brew | 7ac337181a3abbecc99c36d3702e7a0662117584.json | use helper methods | Library/Homebrew/diagnostic.rb | @@ -833,20 +833,19 @@ def check_homebrew_prefix
end
def check_deleted_formula
- formulae = Dir.children(HOMEBREW_CELLAR)
- formulae.delete(".keepme")
+ kegs = Keg.all
deleted_formulae = []
- formulae.each do |f|
- Formula[f]
+ kegs.each do |keg|
+ keg.to_formula
rescue
- deleted_formulae << f
+ deleted_formulae << keg.name
end
return if deleted_formulae.blank?
message = <<~EOS
- Some installed formulae are deleted.
+ Some installed formulae were deleted!
You should find replacements for the following formulae:
- #{deleted_formulae.*"\n "}
+ #{deleted_formulae.join("\n ")}
EOS
message
end | false |
Other | Homebrew | brew | c70bb474e3d8ae447042e2d24ed1d67e6071dc48.json | os/mac: move legacy functions to compat | Library/Homebrew/compat.rb | @@ -4,3 +4,4 @@
require "compat/language/python"
require "compat/requirements/macos_requirement"
require "compat/formula"
+require "compat/os/mac" if OS.mac? | true |
Other | Homebrew | brew | c70bb474e3d8ae447042e2d24ed1d67e6071dc48.json | os/mac: move legacy functions to compat | Library/Homebrew/compat/os/mac.rb | @@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module OS
+ module Mac
+ class << self
+ module Compat
+ def preferred_arch
+ # odeprecated "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)"
+ if Hardware::CPU.is_64_bit?
+ Hardware::CPU.arch_64_bit
+ else
+ Hardware::CPU.arch_32_bit
+ end
+ end
+
+ def tcc_db
+ # odeprecated "MacOS.tcc_db"
+ @tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
+ end
+
+ def pre_mavericks_accessibility_dotfile
+ # odeprecated "MacOS.pre_mavericks_accessibility_dotfile"
+ @pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
+ end
+ end
+
+ prepend Compat
+ end
+ end
+end | true |
Other | Homebrew | brew | c70bb474e3d8ae447042e2d24ed1d67e6071dc48.json | os/mac: move legacy functions to compat | Library/Homebrew/os/mac.rb | @@ -166,14 +166,6 @@ def macports_or_fink
paths.uniq
end
- def preferred_arch
- if Hardware::CPU.is_64_bit?
- Hardware::CPU.arch_64_bit
- else
- Hardware::CPU.arch_32_bit
- end
- end
-
def app_with_bundle_id(*ids)
path = mdfind(*ids)
.reject { |p| p.include?("/Backups.backupdb/") }
@@ -196,13 +188,5 @@ def pkgutil_info(id)
def mdfind_query(*ids)
ids.map! { |id| "kMDItemCFBundleIdentifier == #{id}" }.join(" || ")
end
-
- def tcc_db
- @tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
- end
-
- def pre_mavericks_accessibility_dotfile
- @pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
- end
end
end | true |
Other | Homebrew | brew | 44ef1abd1f9b02453ba802b8b0f286e48c981838.json | utils/ruby.sh: suppress standard error in test-ruby | Library/Homebrew/utils/ruby.sh | @@ -1,7 +1,7 @@
test-ruby () {
"$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e \
"puts Gem::Version.new(RUBY_VERSION.to_s.dup).to_s.split('.').first(2) == \
- Gem::Version.new('$required_ruby_version').to_s.split('.').first(2)"
+ Gem::Version.new('$required_ruby_version').to_s.split('.').first(2)" 2>/dev/null
}
setup-ruby-path() { | false |
Other | Homebrew | brew | 2ffb87cb0312c28db8c04afa89736b1fed6a805c.json | resource: fix patching when patch already fetched
This inappropriately modified the shared `patches` variable, meaning an
already fetched patch would be removed and therefore not be applied when
the resource was staged. | Library/Homebrew/resource.rb | @@ -86,9 +86,12 @@ def prepare_patches
end
def fetch_patches(skip_downloaded: false)
- patches.select!(&:external?)
- patches.reject!(&:downloaded?) if skip_downloaded
- patches.each(&:fetch)
+ patches.each do |p|
+ next unless p.external?
+ next if p.downloaded? && skip_downloaded
+
+ p.fetch
+ end
end
def apply_patches | false |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | Library/Homebrew/cmd/shellenv.sh | @@ -3,7 +3,7 @@
#: Print export statements. When run in a shell, this installation of Homebrew will be added to your `PATH`, `MANPATH`, and `INFOPATH`.
#:
#: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
-#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.bash_profile` or `~/.zprofile`) with: `eval $(brew shellenv)`
+#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)`
homebrew-shellenv() {
case "$SHELL" in | true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | Library/Homebrew/manpages/brew-cask.1.md | @@ -243,7 +243,8 @@ Environment variables specific to Homebrew Cask:
* `HOMEBREW_CASK_OPTS`:
This variable may contain any arguments normally used as options on
the command-line. This is particularly useful to make options persistent.
- For example, you might add to your .bash_profile or .zshenv something like:
+ For example, you might add to your ~/.profile, ~/.bash_profile, or ~/.zshenv
+ something like:
export HOMEBREW_CASK_OPTS='--appdir=~/Applications --fontdir=/Library/Fonts'
| true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | Library/Homebrew/test/utils/shell_spec.rb | @@ -4,19 +4,19 @@
describe Utils::Shell do
describe "::profile" do
- it "returns ~/.bash_profile by default" do
+ it "returns ~/.profile by default" do
ENV["SHELL"] = "/bin/another_shell"
- expect(subject.profile).to eq("~/.bash_profile")
+ expect(subject.profile).to eq("~/.profile")
end
- it "returns ~/.bash_profile for sh" do
+ it "returns ~/.profile for sh" do
ENV["SHELL"] = "/bin/sh"
- expect(subject.profile).to eq("~/.bash_profile")
+ expect(subject.profile).to eq("~/.profile")
end
- it "returns ~/.bash_profile for Bash" do
+ it "returns ~/.profile for Bash" do
ENV["SHELL"] = "/bin/bash"
- expect(subject.profile).to eq("~/.bash_profile")
+ expect(subject.profile).to eq("~/.profile")
end
it "returns /tmp/.zshrc for Zsh if ZDOTDIR is /tmp" do | true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | Library/Homebrew/utils/shell.rb | @@ -39,9 +39,15 @@ def export_value(key, value, shell = preferred)
# return the shell profile file based on user's preferred shell
def profile
- return "#{ENV["ZDOTDIR"]}/.zshrc" if preferred == :zsh && ENV["ZDOTDIR"].present?
+ case preferred
+ when :bash
+ bash_profile = "#{ENV["HOME"]}/.bash_profile"
+ return bash_profile if File.exist? bash_profile
+ when :zsh
+ return "#{ENV["ZDOTDIR"]}/.zshrc" if ENV["ZDOTDIR"].present?
+ end
- SHELL_PROFILE_MAP.fetch(preferred, "~/.bash_profile")
+ SHELL_PROFILE_MAP.fetch(preferred, "~/.profile")
end
def set_variable_in_profile(variable, value)
@@ -67,12 +73,12 @@ def prepend_path_in_profile(path)
end
SHELL_PROFILE_MAP = {
- bash: "~/.bash_profile",
+ bash: "~/.profile",
csh: "~/.cshrc",
fish: "~/.config/fish/config.fish",
ksh: "~/.kshrc",
mksh: "~/.kshrc",
- sh: "~/.bash_profile",
+ sh: "~/.profile",
tcsh: "~/.tcshrc",
zsh: "~/.zshrc",
}.freeze | true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | docs/Gems,-Eggs-and-Perl-Modules.md | @@ -114,7 +114,7 @@ sudo cpan local::lib
Note that this will install some other dependencies like `Module::Install`.
Then put the appropriate incantation in your shell’s startup, e.g. for
-`.bash_profile` you insert the below, for others see the
+`.profile` you insert the below, for others see the
[`local::lib`](https://metacpan.org/pod/local::lib) docs.
```sh | true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | docs/Manpage.md | @@ -435,7 +435,7 @@ ones). No online search is performed.
Print export statements. When run in a shell, this installation of Homebrew will be added to your `PATH`, `MANPATH`, and `INFOPATH`.
The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
-Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.bash_profile` or `~/.zprofile`) with: `eval $(brew shellenv)`
+Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)`
### `switch` *`formula`* *`version`*
| true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | docs/Shell-Completion.md | @@ -8,7 +8,7 @@ You must configure your shell to enable its completion support. This is because
## Configuring Completions in `bash`
-To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` file:
+To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.profile` file:
```sh
if type brew &>/dev/null; then | true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | manpages/brew-cask.1 | @@ -274,7 +274,7 @@ Environment variables specific to Homebrew Cask:
.
.TP
\fBHOMEBREW_CASK_OPTS\fR
-This variable may contain any arguments normally used as options on the command\-line\. This is particularly useful to make options persistent\. For example, you might add to your \.bash_profile or \.zshenv something like:
+This variable may contain any arguments normally used as options on the command\-line\. This is particularly useful to make options persistent\. For example, you might add to your ~/\.profile, ~/\.bash_profile, or ~/\.zshenv something like:
.
.IP "" 4
. | true |
Other | Homebrew | brew | 133ee7966dbebd965f8d306bdaa78706399e67f3.json | shell: Use .profile unless .bash_profile exists | manpages/brew.1 | @@ -576,7 +576,7 @@ Search for \fItext\fR in the given package manager\'s list\.
Print export statements\. When run in a shell, this installation of Homebrew will be added to your \fBPATH\fR, \fBMANPATH\fR, and \fBINFOPATH\fR\.
.
.P
-The variables \fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to avoid querying them multiple times\. Consider adding evaluation of this command\'s output to your dotfiles (e\.g\. \fB~/\.bash_profile\fR or \fB~/\.zprofile\fR) with: \fBeval $(brew shellenv)\fR
+The variables \fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to avoid querying them multiple times\. Consider adding evaluation of this command\'s output to your dotfiles (e\.g\. \fB~/\.profile\fR, \fB~/\.bash_profile\fR, or \fB~/\.zprofile\fR) with: \fBeval $(brew shellenv)\fR
.
.SS "\fBswitch\fR \fIformula\fR \fIversion\fR"
Symlink all of the specified \fIversion\fR of \fIformula\fR\'s installation into Homebrew\'s prefix\. | true |
Other | Homebrew | brew | 1cba5821fd8d26c1e9ba55e368644c529838c404.json | cmd/update.sh: define conditions for unsetting HOMEBREW_RUBY_PATH | Library/Homebrew/cmd/update.sh | @@ -599,6 +599,13 @@ EOS
-d "$HOMEBREW_LIBRARY/LinkedKegs" ||
(-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]]
then
+ if [[ -n $HOMEBREW_FORCE_VENDOR_RUBY &&
+ -x $HOMEBREW_LIBRARY/Homebrew/vendor/portable-ruby/current/bin/ruby ]]
+ then
+ export HOMEBREW_RUBY_PATH="$HOMEBREW_LIBRARY/Homebrew/vendor/portable-ruby/current/bin/ruby"
+ elif [[ -z $HOMEBREW_DEVELOPER ]]; then
+ unset HOMEBREW_RUBY_PATH
+ fi
brew update-report "$@"
return $?
elif [[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] | false |
Other | Homebrew | brew | a333014c55c1edc2555cd2dfbd8dc07463cc9b76.json | formula_installer: ignore dependencies when fetching.
Whenever you are fetching a dependency you only care about fetching that
specific dependency and not all the dependencies of that dependency.
Unlike installing, dependencies can be fetched in any order and have no
"chains" between them. | Library/Homebrew/formula_installer.rb | @@ -572,6 +572,10 @@ def fetch_dependency(dep)
fi.verbose = verbose?
fi.quiet = quiet?
fi.debug = debug?
+ # When fetching we don't need to recurse the dependency tree as it's already
+ # been done for us in `compute_dependencies` and there's no requirement to
+ # fetch in a particular order.
+ fi.ignore_deps = true
fi.fetch
end
| false |
Other | Homebrew | brew | 58cecf38cf66117dddb09af0020d3426f1e90da2.json | resource: restore fetch in stage
Fixes #7546. | Library/Homebrew/formula.rb | @@ -1160,7 +1160,6 @@ def patch
# @private
def brew
@prefix_returns_versioned_prefix = true
- active_spec.fetch
stage do |staging|
staging.retain! if Homebrew.args.keep_tmp?
prepare_patches | true |
Other | Homebrew | brew | 58cecf38cf66117dddb09af0020d3426f1e90da2.json | resource: restore fetch in stage
Fixes #7546. | Library/Homebrew/resource.rb | @@ -70,6 +70,7 @@ def clear_cache
def stage(target = nil, &block)
raise ArgumentError, "target directory or block is required" unless target || block
+ fetch
prepare_patches
unpack(target, &block) | true |
Other | Homebrew | brew | 5be4682ecb4a476f69329c66af92a655338e7e28.json | brew.sh: add an empty line for code readability
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/brew.sh | @@ -116,6 +116,7 @@ then
else
HOMEBREW_GIT="git"
fi
+
if [[ -n "$HOMEBREW_MACOS" ]]
then
HOMEBREW_PROCESSOR="$(uname -p)" | false |
Other | Homebrew | brew | 6ff307c45620003f2a1eece707787d9bddc12527.json | brew.sh: remove unnecessary empty line
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/brew.sh | @@ -116,8 +116,6 @@ then
else
HOMEBREW_GIT="git"
fi
-
-
if [[ -n "$HOMEBREW_MACOS" ]]
then
HOMEBREW_PROCESSOR="$(uname -p)" | false |
Other | Homebrew | brew | 08a9f0e1c093a8de3acb31c5bc12664cfeecd102.json | Use FormulaInstaller#fetch before #prelude. | Library/Homebrew/cask/installer.rb | @@ -368,8 +368,8 @@ def cask_and_formula_dependencies
fi.installed_on_request = false
fi.show_header = true
fi.verbose = verbose?
- fi.prelude
fi.fetch
+ fi.prelude
fi.install
fi.finish
end | true |
Other | Homebrew | brew | 08a9f0e1c093a8de3acb31c5bc12664cfeecd102.json | Use FormulaInstaller#fetch before #prelude. | Library/Homebrew/cmd/install.rb | @@ -325,8 +325,8 @@ def install_formula(f)
fi.build_bottle = args.build_bottle?
fi.interactive = args.interactive?
fi.git = args.git?
- fi.prelude
fi.fetch
+ fi.prelude
fi.install
fi.finish
rescue FormulaInstallationAlreadyAttemptedError | true |
Other | Homebrew | brew | 08a9f0e1c093a8de3acb31c5bc12664cfeecd102.json | Use FormulaInstaller#fetch before #prelude. | Library/Homebrew/cmd/upgrade.rb | @@ -183,7 +183,6 @@ def upgrade_formula(f)
fi.installed_as_dependency = tab.installed_as_dependency
fi.installed_on_request ||= tab.installed_on_request
end
- fi.prelude
upgrade_version = if f.optlinked?
"#{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
@@ -193,6 +192,7 @@ def upgrade_formula(f)
oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{upgrade_version} #{fi.options.to_a.join(" ")}"
fi.fetch
+ fi.prelude
# first we unlink the currently active keg for this formula otherwise it is
# possible for the existing build to interfere with the build we are about to | true |
Other | Homebrew | brew | 08a9f0e1c093a8de3acb31c5bc12664cfeecd102.json | Use FormulaInstaller#fetch before #prelude. | Library/Homebrew/reinstall.rb | @@ -35,8 +35,8 @@ def reinstall_formula(f, build_from_source: false)
fi.installed_as_dependency = tab.installed_as_dependency
fi.installed_on_request = tab.installed_on_request
end
- fi.prelude
fi.fetch
+ fi.prelude
oh1 "Reinstalling #{Formatter.identifier(f.full_name)} #{options.to_a.join " "}"
| true |
Other | Homebrew | brew | 08a9f0e1c093a8de3acb31c5bc12664cfeecd102.json | Use FormulaInstaller#fetch before #prelude. | Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb | @@ -176,8 +176,8 @@ def install_test_formula(name, content = nil, build_bottle: false)
setup_test_formula(name, content)
fi = FormulaInstaller.new(Formula[name])
fi.build_bottle = build_bottle
- fi.prelude
fi.fetch
+ fi.prelude
fi.install
fi.finish
end | true |
Other | Homebrew | brew | 48918bb5e33440d97c7ce12186b97fb0026e4bbf.json | formula_installer: add fetch_dependency method.
This uses `FormulaInstaller#fetch` to recursively fetch dependencies
through the dependency tree and allows `install_dependency` to not
do any fetching. | Library/Homebrew/formula_installer.rb | @@ -561,6 +561,18 @@ def install_dependencies(deps)
@show_header = true unless deps.empty?
end
+ def fetch_dependency(dep)
+ df = dep.to_formula
+ fi = FormulaInstaller.new(df)
+
+ fi.build_from_source = Homebrew.args.build_formula_from_source?(df)
+ fi.force_bottle = false
+ fi.verbose = verbose?
+ fi.quiet = quiet?
+ fi.debug = debug?
+ fi.fetch
+ end
+
def install_dependency(dep, inherited_options)
df = dep.to_formula
tab = Tab.for_formula(df)
@@ -600,7 +612,6 @@ def install_dependency(dep, inherited_options)
fi.installed_as_dependency = true
fi.installed_on_request = df.any_version_installed? && tab.installed_on_request
fi.prelude
- fi.fetch
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"
fi.install
fi.finish
@@ -952,9 +963,7 @@ def fetch_dependencies
return if deps.empty? || ignore_deps?
- deps.each do |dep, _|
- dep.to_formula.resources.each(&:fetch)
- end
+ deps.each { |dep, _options| fetch_dependency(dep) }
end
def fetch | false |
Other | Homebrew | brew | 9ecc04fbe4c65806ef704309e48563a951226755.json | workflows: fix docker tag | .github/workflows/tests.yml | @@ -196,5 +196,5 @@ jobs:
docker tag brew "docker.pkg.github.com/homebrew/brew/brew:$v"
docker push "docker.pkg.github.com/homebrew/brew/brew:$v"
docker login docker.com -u brewtestbot -p ${{secrets.DOCKER_TOKEN}}
- docker tag "brew homebrew/brew:$v"
+ docker tag brew "homebrew/brew:$v"
docker push "homebrew/brew:$v" | false |
Other | Homebrew | brew | e4823ea6fe4fa7a89c2dd6da59e091e29ba5a6f0.json | cmd/uninstall: fix Array comparison
In #7526 a comparison for `paths` was introduced, but if `paths` is ever
`nil`, this triggers an error.
Coercing the variable to an Array should alleviate this problem, as
`nil.to_a` produces an empty and comparable Array.
Fixes #7540
Signed-off-by: Mike Fiedler <miketheman@gmail.com> | Library/Homebrew/cmd/uninstall.rb | @@ -92,7 +92,7 @@ def uninstall
end
unversioned_name = f.name.gsub(/@.+$/, "")
- maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*") - paths
+ maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*") - paths.to_a
if maybe_paths.present?
puts
opoo <<~EOS | false |
Other | Homebrew | brew | af278b15de03ea410b5d057518747446bbf8b8c4.json | cli/parser: add formulae method.
This removes the coupling on args.formulae before it has been parsed. | Library/Homebrew/cli/parser.rb | @@ -3,6 +3,7 @@
require "cli/args"
require "optparse"
require "set"
+require "formula"
COMMAND_DESC_WIDTH = 80
OPTION_DESC_WIDTH = 43
@@ -188,7 +189,7 @@ def generate_help_text
end
def formula_options
- @args.formulae.each do |f|
+ formulae.each do |f|
next if f.options.empty?
f.options.each do |o|
@@ -343,6 +344,28 @@ def process_option(*args)
option, = @parser.make_switch(args)
@processed_options << [option.short.first, option.long.first, option.arg, option.desc.first]
end
+
+ def formulae
+ named_args = @argv.reject { |arg| arg.start_with?("-") }
+ spec = if @argv.include?("--HEAD")
+ :head
+ elsif @argv.include?("--devel")
+ :devel
+ else
+ :stable
+ end
+
+ # Only lowercase names, not paths, bottle filenames or URLs
+ named_args.map do |arg|
+ next if arg.match?(HOMEBREW_CASK_TAP_CASK_REGEX)
+
+ if arg.include?("/") || arg.end_with?(".tar.gz") || File.exist?(arg)
+ Formulary.factory(arg, spec)
+ else
+ Formulary.find_with_priority(arg.downcase, spec)
+ end
+ end.compact.uniq(&:name)
+ end
end
class OptionConstraintError < RuntimeError | false |
Other | Homebrew | brew | 4b68c7a08c56f819b11d308878e437a9aaba3194.json | tests.yml: Deploy the Docker image to Docker Hub | .github/workflows/tests.yml | @@ -174,30 +174,27 @@ jobs:
- name: Build Docker image
if: matrix.os == 'ubuntu-latest'
- run: |
- docker pull homebrew/brew
- docker-compose -f Dockerfile.yml build sut
+ run: docker build -t brew .
- name: Run brew test-bot
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
- docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut
- docker tag homebrew_sut brew
+ docker run --rm brew brew test-bot
else
brew test-bot
fi
- - name: Deploy the latest Docker image to GitHub
- if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master'
- run: |
- docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
- docker tag brew docker.pkg.github.com/homebrew/brew/brew
- docker push docker.pkg.github.com/homebrew/brew/brew
-
- - name: Deploy the tagged Docker image to GitHub
- if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
+ - name: Deploy the Docker image to GitHub and Docker Hub
+ if: matrix.os == 'ubuntu-latest' && (github.ref == 'refs/heads/master' || github.event_name == 'release')
run: |
+ case $GITHUB_REF in
+ refs/heads/master) v=latest ;;
+ refs/tags/*) v=${GITHUB_REF:10} ;;
+ *) echo Error: unexpected GITHUB_REF: $GITHUB_REF; exit 1 ;;
+ esac
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
- v=${GITHUB_REF:10}
docker tag brew "docker.pkg.github.com/homebrew/brew/brew:$v"
docker push "docker.pkg.github.com/homebrew/brew/brew:$v"
+ docker login docker.com -u brewtestbot -p ${{secrets.DOCKER_TOKEN}}
+ docker tag "brew homebrew/brew:$v"
+ docker push "homebrew/brew:$v" | true |
Other | Homebrew | brew | 4b68c7a08c56f819b11d308878e437a9aaba3194.json | tests.yml: Deploy the Docker image to Docker Hub | Dockerfile.yml | @@ -1,17 +0,0 @@
-version: '3.7'
-
-services:
- sut:
- build:
- context: .
- cache_from:
- - homebrew/brew
- args:
- - FORCE_REBUILD=1
- command:
- - sh
- - -xc
- - |
- /home/linuxbrew/.linuxbrew/bin/brew test-bot
- status=$$?
- exit $$status | true |
Other | Homebrew | brew | 8e318d81bcbf88d1829cdfba8c390f553c8787a1.json | formula: add pkgetc method.
This should provide a more "type-safe" way of referring to the `etc`
directories of other formulae e.g.
https://github.com/Homebrew/homebrew-core/pull/54257 so that the output
will change if the formula name changes. | Library/Homebrew/formula.rb | @@ -790,6 +790,14 @@ def etc
(HOMEBREW_PREFIX/"etc").extend(InstallRenamed)
end
+ # A subdirectory of `etc` with the formula name suffixed.
+ # e.g. `$HOMEBREW_PREFIX/etc/openssl@1.1`
+ # Anything using `pkgetc.install` will not overwrite other files on
+ # e.g. upgrades but will write a new file named `*.default`.
+ def pkgetc
+ (HOMEBREW_PREFIX/"etc"/name).extend(InstallRenamed)
+ end
+
# The directory where the formula's variable files should be installed.
# This directory is not inside the `HOMEBREW_CELLAR` so it persists
# across upgrades.
@@ -1080,7 +1088,7 @@ def link_overwrite?(path)
# keg's formula is deleted.
begin
keg = Keg.for(path)
- rescue NotAKegError, Errno::ENOENT # rubocop:disable Lint/SuppressedException
+ rescue NotAKegError, Errno::ENOENT
# file doesn't belong to any keg.
else
tab_tap = Tab.for_keg(keg).tap
@@ -1089,7 +1097,7 @@ def link_overwrite?(path)
begin
Formulary.factory(keg.name)
- rescue FormulaUnavailableError # rubocop:disable Lint/SuppressedException
+ rescue FormulaUnavailableError
# formula for this keg is deleted, so defer to whitelist
rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
return false # this keg belongs to another formula | false |
Other | Homebrew | brew | 3a9e12efac47882309de4698c58a57e630d84cb0.json | docker.yml: Fix a typo | .github/workflows/docker.yml | @@ -30,7 +30,6 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: |
brew_version=${GITHUB_REF:10}
- echo "::set-env brew_version=$brew_version"
echo "::set-env name=brew_version::$brew_version"
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
docker tag brew "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$brew_version" | false |
Other | Homebrew | brew | 305ecfd66e850297026e58f1e09eb93ba0b759b5.json | docker.yml: Deploy tagged image to Docker Hub | .github/workflows/docker.yml | @@ -18,14 +18,26 @@ jobs:
uses: actions/checkout@master
with:
fetch-depth: 0
+ - name: Configure Git
+ run: |
+ git config --unset "http.https://github.com/.extraheader"
+ git fetch origin master
- name: Build Docker image
run: docker build -t brew --build-arg=version=${{matrix.version}} .
- name: Run brew test-bot
run: docker run --rm brew brew test-bot
- name: Deploy the tagged Docker image to GitHub
if: startsWith(github.ref, 'refs/tags/')
run: |
+ brew_version=${GITHUB_REF:10}
+ echo "::set-env brew_version=$brew_version"
+ echo "::set-env name=brew_version::$brew_version"
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
- v=${GITHUB_REF:10}
- docker tag brew "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$v"
- docker push "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$v"
+ docker tag brew "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$brew_version"
+ docker push "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$brew_version"
+ - name: Deploy the tagged Docker image to Docker Hub
+ if: startsWith(github.ref, 'refs/tags/')
+ run: |
+ docker login docker.com -u brewtestbot -p ${{secrets.DOCKER_TOKEN}}
+ docker tag brew "homebrew/ubuntu${{matrix.version}}:$brew_version"
+ docker push "homebrew/ubuntu${{matrix.version}}:$brew_version" | false |
Other | Homebrew | brew | 16141e7effe453cfe94ae274dadaf4b3ecf6767a.json | os/mac/software_spec: fix argument error in valid use case | Library/Homebrew/extend/os/mac/software_spec.rb | @@ -11,7 +11,7 @@ def uses_from_macos(deps, bounds = {})
deps = Hash[*bounds.shift]
end
- bounds.transform_values! { |v| MacOS::Version.from_symbol(v) }
+ bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) }
if MacOS.version >= bounds[:since]
@uses_from_macos_elements << deps
else | true |
Other | Homebrew | brew | 16141e7effe453cfe94ae274dadaf4b3ecf6767a.json | os/mac/software_spec: fix argument error in valid use case | Library/Homebrew/test/os/mac/formula_spec.rb | @@ -3,6 +3,43 @@
require "formula"
describe Formula do
+ describe "#uses_from_macos" do
+ before do
+ allow(OS).to receive(:mac?).and_return(true)
+ allow(OS::Mac).to receive(:version).and_return(OS::Mac::Version.from_symbol(:sierra))
+ end
+
+ it "adds a macOS dependency to all specs if the OS version meets requirements" do
+ f = formula "foo" do
+ url "foo-1.0"
+
+ uses_from_macos("foo", since: :el_capitan)
+ end
+
+ expect(f.class.stable.deps).to be_empty
+ expect(f.class.devel.deps).to be_empty
+ expect(f.class.head.deps).to be_empty
+ expect(f.class.stable.uses_from_macos_elements.first).to eq("foo")
+ expect(f.class.devel.uses_from_macos_elements.first).to eq("foo")
+ expect(f.class.head.uses_from_macos_elements.first).to eq("foo")
+ end
+
+ it "doesn't add a macOS dependency to any spec if the OS version doesn't meet requirements" do
+ f = formula "foo" do
+ url "foo-1.0"
+
+ uses_from_macos("foo", since: :high_sierra)
+ end
+
+ expect(f.class.stable.deps.first.name).to eq("foo")
+ expect(f.class.devel.deps.first.name).to eq("foo")
+ expect(f.class.head.deps.first.name).to eq("foo")
+ expect(f.class.stable.uses_from_macos_elements).to be_empty
+ expect(f.class.devel.uses_from_macos_elements).to be_empty
+ expect(f.class.head.uses_from_macos_elements).to be_empty
+ end
+ end
+
describe "#on_macos" do
it "defines an url on macos only" do
f = formula do | true |
Other | Homebrew | brew | fe45f680008e6f8c43c3193cd6f9b9defd45be7c.json | brew.sh: check versions of proper cURL and Git
User may specify which cURL and Git to use via
HOMEBREW_CURL_PATH and HOMEBREW_GIT_PATH.
So, let's use these to determine whether we need to use
their vendored alternatives. | Library/Homebrew/brew.sh | @@ -93,6 +93,31 @@ case "$HOMEBREW_SYSTEM" in
Linux) HOMEBREW_LINUX="1" ;;
esac
+if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
+ -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] &&
+ "$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null
+then
+ HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl"
+elif [[ -n "$HOMEBREW_DEVELOPER" && -x "$HOMEBREW_CURL_PATH" ]]
+then
+ HOMEBREW_CURL="$HOMEBREW_CURL_PATH"
+else
+ HOMEBREW_CURL="curl"
+fi
+
+if [[ -n "$HOMEBREW_FORCE_BREWED_GIT" &&
+ -x "$HOMEBREW_PREFIX/opt/git/bin/git" ]] &&
+ "$HOMEBREW_PREFIX/opt/git/bin/git" --version >/dev/null
+then
+ HOMEBREW_GIT="$HOMEBREW_PREFIX/opt/git/bin/git"
+elif [[ -n "$HOMEBREW_DEVELOPER" && -x "$HOMEBREW_GIT_PATH" ]]
+then
+ HOMEBREW_GIT="$HOMEBREW_GIT_PATH"
+else
+ HOMEBREW_GIT="git"
+fi
+
+
if [[ -n "$HOMEBREW_MACOS" ]]
then
HOMEBREW_PROCESSOR="$(uname -p)"
@@ -159,9 +184,9 @@ else
# Ensure the system Curl is a version that supports modern HTTPS certificates.
HOMEBREW_MINIMUM_CURL_VERSION="7.41.0"
- system_curl_version_output="$($(command -v curl) --version 2>/dev/null)"
- system_curl_name_and_version="${system_curl_version_output%% (*}"
- if [[ $(numeric "${system_curl_name_and_version##* }") -lt $(numeric "$HOMEBREW_MINIMUM_CURL_VERSION") ]]
+ curl_version_output="$($HOMEBREW_CURL --version 2>/dev/null)"
+ curl_name_and_version="${curl_version_output%% (*}"
+ if [[ $(numeric "${curl_name_and_version##* }") -lt $(numeric "$HOMEBREW_MINIMUM_CURL_VERSION") ]]
then
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_CURL="1"
@@ -170,10 +195,10 @@ else
# Ensure the system Git is at or newer than the minimum required version.
# Git 2.7.4 is the version of git on Ubuntu 16.04 LTS (Xenial Xerus).
HOMEBREW_MINIMUM_GIT_VERSION="2.7.0"
- system_git_version_output="$($(command -v git) --version 2>/dev/null)"
+ git_version_output="$($HOMEBREW_GIT --version 2>/dev/null)"
# $extra is intentionally discarded.
# shellcheck disable=SC2034
- IFS=. read -r major minor micro build extra <<< "${system_git_version_output##* }"
+ IFS=. read -r major minor micro build extra <<< "${git_version_output##* }"
if [[ $(numeric "$major.$minor.$micro.$build") -lt $(numeric "$HOMEBREW_MINIMUM_GIT_VERSION") ]]
then
HOMEBREW_FORCE_BREWED_GIT="1"
@@ -198,30 +223,6 @@ HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
-if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
- -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] &&
- "$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null
-then
- HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl"
-elif [[ -n "$HOMEBREW_DEVELOPER" && -x "$HOMEBREW_CURL_PATH" ]]
-then
- HOMEBREW_CURL="$HOMEBREW_CURL_PATH"
-else
- HOMEBREW_CURL="curl"
-fi
-
-if [[ -n "$HOMEBREW_FORCE_BREWED_GIT" &&
- -x "$HOMEBREW_PREFIX/opt/git/bin/git" ]] &&
- "$HOMEBREW_PREFIX/opt/git/bin/git" --version >/dev/null
-then
- HOMEBREW_GIT="$HOMEBREW_PREFIX/opt/git/bin/git"
-elif [[ -n "$HOMEBREW_DEVELOPER" && -x "$HOMEBREW_GIT_PATH" ]]
-then
- HOMEBREW_GIT="$HOMEBREW_GIT_PATH"
-else
- HOMEBREW_GIT="git"
-fi
-
HOMEBREW_USER_AGENT="$HOMEBREW_PRODUCT/$HOMEBREW_USER_AGENT_VERSION ($HOMEBREW_SYSTEM; $HOMEBREW_PROCESSOR $HOMEBREW_OS_USER_AGENT_VERSION)"
curl_version_output="$("$HOMEBREW_CURL" --version 2>/dev/null)"
curl_name_and_version="${curl_version_output%% (*}" | false |
Other | Homebrew | brew | 5052f49f40bf6235fe458a21cf50ded08aca3958.json | Build Docker images for Ubuntu 18.04 and 20.04 | .dockerignore | @@ -0,0 +1,2 @@
+Library/Homebrew/vendor/portable-ruby
+Library/Taps | true |
Other | Homebrew | brew | 5052f49f40bf6235fe458a21cf50ded08aca3958.json | Build Docker images for Ubuntu 18.04 and 20.04 | .github/workflows/docker.yml | @@ -0,0 +1,31 @@
+name: Docker
+on:
+ pull_request:
+ paths:
+ - .github/workflows/docker.yml
+ - Dockerfile
+ release:
+ types:
+ - published
+jobs:
+ ubuntu:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ version: ["18.04", "20.04"]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ with:
+ fetch-depth: 0
+ - name: Build Docker image
+ run: docker build -t brew --build-arg=version=${{matrix.version}} .
+ - name: Run brew test-bot
+ run: docker run --rm brew brew test-bot
+ - name: Deploy the tagged Docker image to GitHub
+ if: startsWith(github.ref, 'refs/tags/')
+ run: |
+ docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
+ v=${GITHUB_REF:10}
+ docker tag brew "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$v"
+ docker push "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$v" | true |
Other | Homebrew | brew | 5052f49f40bf6235fe458a21cf50ded08aca3958.json | Build Docker images for Ubuntu 18.04 and 20.04 | .github/workflows/tests.yml | @@ -187,14 +187,14 @@ jobs:
brew test-bot
fi
- - name: Deploy the latest Docker image
+ - name: Deploy the latest Docker image to GitHub
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master'
run: |
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
docker tag brew docker.pkg.github.com/homebrew/brew/brew
docker push docker.pkg.github.com/homebrew/brew/brew
- - name: Deploy the tagged Docker image
+ - name: Deploy the tagged Docker image to GitHub
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
run: |
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}} | true |
Other | Homebrew | brew | 5052f49f40bf6235fe458a21cf50ded08aca3958.json | Build Docker images for Ubuntu 18.04 and 20.04 | .gitignore | @@ -151,6 +151,7 @@
/docs/vendor
# Unignore our root-level metadata files.
+!/.dockerignore
!/.editorconfig
!/.gitignore
!/.yardopts | true |
Other | Homebrew | brew | 5052f49f40bf6235fe458a21cf50ded08aca3958.json | Build Docker images for Ubuntu 18.04 and 20.04 | Dockerfile | @@ -1,11 +1,9 @@
-FROM ubuntu:xenial
-LABEL maintainer="Shaun Jackman <sjackman@gmail.com>"
+ARG version=16.04
+FROM ubuntu:$version
+ARG DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008
RUN apt-get update \
- && apt-get install -y --no-install-recommends software-properties-common \
- && add-apt-repository -y ppa:git-core/ppa \
- && apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
@@ -14,6 +12,7 @@ RUN apt-get update \
fonts-dejavu-core \
g++ \
git \
+ less \
libz-dev \
locales \
make \
@@ -23,29 +22,23 @@ RUN apt-get update \
sudo \
uuid-runtime \
tzdata \
- && rm -rf /var/lib/apt/lists/*
-
-RUN localedef -i en_US -f UTF-8 en_US.UTF-8 \
+ && rm -rf /var/lib/apt/lists/* \
+ && localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& useradd -m -s /bin/bash linuxbrew \
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
+
COPY . /home/linuxbrew/.linuxbrew/Homebrew
-ARG FORCE_REBUILD
+ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
+WORKDIR /home/linuxbrew
# hadolint ignore=DL3003
RUN cd /home/linuxbrew/.linuxbrew \
&& mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar \
&& ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/ \
- && cd /home/linuxbrew/.linuxbrew/Homebrew \
- && git remote set-url origin https://github.com/Homebrew/brew
-
-WORKDIR /home/linuxbrew
-ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \
- SHELL=/bin/bash
-
-# Install portable-ruby, tap homebrew/core, install audit gems, and cleanup
-RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \
- && chown -R linuxbrew: /home/linuxbrew/.linuxbrew \
- && chmod -R g+w,o-w /home/linuxbrew/.linuxbrew \
- && rm -rf ~/.cache \
+ && git -C /home/linuxbrew/.linuxbrew/Homebrew remote set-url origin https://github.com/Homebrew/brew \
+ && HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \
&& brew install-bundler-gems \
- && brew cleanup
+ && brew cleanup \
+ && rm -rf ~/.cache \
+ && chown -R linuxbrew: /home/linuxbrew/.linuxbrew \
+ && chmod -R g+w,o-w /home/linuxbrew/.linuxbrew | true |
Other | Homebrew | brew | 3717815adec94d952115cb8461c544170458fec0.json | ENV/std: fix error when using older/no clang
Fixes #7482. | Library/Homebrew/extend/ENV/std.rb | @@ -112,7 +112,7 @@ def determine_cxx
def clang
super
replace_in_cflags(/-Xarch_#{Hardware::CPU.arch_32_bit} (-march=\S*)/, '\1')
- map = Hardware::CPU.optimization_flags
+ map = Hardware::CPU.optimization_flags.dup
if DevelopmentTools.clang_build_version < 700
# Clang mistakenly enables AES-NI on plain Nehalem
map[:nehalem] = "-march=nehalem -Xclang -target-feature -Xclang -aes" | false |
Other | Homebrew | brew | 3de9fc91a7995e372e275f32a19ee3b30b1fb565.json | update dynamic linkers | Library/Homebrew/extend/os/linux/install.rb | @@ -6,6 +6,7 @@ module Install
DYNAMIC_LINKERS = [
"/lib64/ld-linux-x86-64.so.2",
+ "/lib64/ld64.so.2",
"/lib/ld-linux.so.3",
"/lib/ld-linux.so.2",
"/lib/ld-linux-aarch64.so.1", | false |
Other | Homebrew | brew | 51d8ce8e8f92665029d23597a88cdc7d3cfedc31.json | workflows/tests: simplify PATH setup.
Doesn't need to be a separate step. | .github/workflows/tests.yml | @@ -14,14 +14,6 @@ jobs:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- - name: Set up Homebrew PATH
- run: |
- if [ "$RUNNER_OS" = "Linux" ]; then
- echo "::add-path::/home/linuxbrew/.linuxbrew/bin"
- else
- echo "::add-path::/usr/local/bin"
- fi
-
- name: Set up Homebrew
run: |
if which brew &>/dev/null; then
@@ -37,6 +29,9 @@ jobs:
sudo mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar
sudo ln -sf ../Homebrew/bin/brew "$HOMEBREW_PREFIX/bin/"
cd -
+
+ export PATH="$HOMEBREW_PREFIX/bin:$PATH"
+ echo "::add-path::$HOMEBREW_PREFIX/bin"
fi
cd "$HOMEBREW_REPOSITORY" | false |
Other | Homebrew | brew | 3df97b20d52ef76043fcc33cd5040886dc6da2b3.json | Add PowerPC64 CPU
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/extend/os/linux/hardware/cpu.rb | @@ -3,17 +3,12 @@
module Hardware
class CPU
class << self
- OPTIMIZATION_FLAGS_LINUX = {
- native: "-march=#{Homebrew::EnvConfig.arch}",
- nehalem: "-march=nehalem",
- core2: "-march=core2",
- core: "-march=prescott",
- armv6: "-march=armv6",
- armv8: "-march=armv8-a",
- }.freeze
-
def optimization_flags
- OPTIMIZATION_FLAGS_LINUX
+ @optimization_flags ||= begin
+ flags = generic_optimization_flags.dup
+ flags[:native] = arch_flag(Homebrew::EnvConfig.arch)
+ flags
+ end
end
def cpuinfo | true |
Other | Homebrew | brew | 3df97b20d52ef76043fcc33cd5040886dc6da2b3.json | Add PowerPC64 CPU
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/extend/os/linux/install.rb | @@ -14,6 +14,19 @@ module Install
"/system/bin/linker",
].freeze
+ def check_cpu
+ return if (Hardware::CPU.intel? && Hardware::CPU.is_64_bit?) || Hardware::CPU.arm?
+
+ message = "Sorry, Homebrew does not support your computer's CPU architecture!"
+ if Hardware::CPU.ppc64le?
+ message += <<~EOS
+ For OpenPOWER Linux (PPC64LE) support, see:
+ #{Formatter.url("https://github.com/homebrew-ppc64le/brew")}
+ EOS
+ end
+ abort message
+ end
+
def symlink_ld_so
brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
return if brew_ld_so.readable? | true |
Other | Homebrew | brew | 3df97b20d52ef76043fcc33cd5040886dc6da2b3.json | Add PowerPC64 CPU
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/hardware.rb | @@ -7,28 +7,29 @@ class CPU
INTEL_32BIT_ARCHS = [:i386].freeze
INTEL_64BIT_ARCHS = [:x86_64].freeze
PPC_32BIT_ARCHS = [:ppc, :ppc32, :ppc7400, :ppc7450, :ppc970].freeze
- PPC_64BIT_ARCHS = [:ppc64].freeze
+ PPC_64BIT_ARCHS = [:ppc64, :ppc64le, :ppc970].freeze
class << self
- OPTIMIZATION_FLAGS = {
- native: "-march=native",
- nehalem: "-march=nehalem",
- core2: "-march=core2",
- core: "-march=prescott",
- armv6: "-march=armv6",
- armv8: "-march=armv8-a",
- }.freeze
-
def optimization_flags
- OPTIMIZATION_FLAGS
- end
+ @optimization_flags ||= {
+ native: arch_flag("native"),
+ nehalem: "-march=nehalem",
+ core2: "-march=core2",
+ core: "-march=prescott",
+ armv6: "-march=armv6",
+ armv8: "-march=armv8-a",
+ ppc64: "-mcpu=powerpc64",
+ ppc64le: "-mcpu=powerpc64le",
+ }.freeze
+ end
+ alias generic_optimization_flags optimization_flags
def arch_32_bit
if arm?
:arm
elsif intel?
:i386
- elsif ppc?
+ elsif ppc32?
:ppc32
else
:dunno
@@ -40,7 +41,9 @@ def arch_64_bit
:arm64
elsif intel?
:x86_64
- elsif ppc?
+ elsif ppc64le?
+ :ppc64le
+ elsif ppc64?
:ppc64
else
:dunno
@@ -66,7 +69,7 @@ def type
case RUBY_PLATFORM
when /x86_64/, /i\d86/ then :intel
when /arm/, /aarch64/ then :arm
- when /ppc\d+/ then :ppc
+ when /ppc|powerpc/ then :ppc
else :dunno
end
end
@@ -85,7 +88,7 @@ def cores
def bits
@bits ||= case RUBY_PLATFORM
- when /x86_64/, /ppc64/, /aarch64|arm64/ then 64
+ when /x86_64/, /ppc64|powerpc64/, /aarch64|arm64/ then 64
when /i\d86/, /ppc/, /arm/ then 32
end
end
@@ -110,17 +113,43 @@ def ppc?
type == :ppc
end
+ def ppc32?
+ ppc? && is_32_bit?
+ end
+
+ def ppc64le?
+ ppc? && is_64_bit? && little_endian?
+ end
+
+ def ppc64?
+ ppc? && is_64_bit? && big_endian?
+ end
+
def arm?
type == :arm
end
+ def little_endian?
+ !big_endian?
+ end
+
+ def big_endian?
+ [1].pack("I") == [1].pack("N")
+ end
+
def features
[]
end
def feature?(name)
features.include?(name)
end
+
+ def arch_flag(arch)
+ return "-mcpu=#{arch}" if ppc?
+
+ "-march=#{arch}"
+ end
end
end
| true |
Other | Homebrew | brew | 3df97b20d52ef76043fcc33cd5040886dc6da2b3.json | Add PowerPC64 CPU
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/install.rb | @@ -10,14 +10,16 @@ module Install
module_function
def check_cpu
- case Hardware::CPU.type
- when :ppc
- abort <<~EOS
- Sorry, Homebrew does not support your computer's CPU architecture.
- For PPC support, see:
+ return if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
+
+ message = "Sorry, Homebrew does not support your computer's CPU architecture!"
+ if Hardware::CPU.ppc?
+ message += <<~EOS
+ For PowerPC Mac (PPC32/PPC64BE) support, see:
#{Formatter.url("https://github.com/mistydemeo/tigerbrew")}
EOS
end
+ abort message
end
def attempt_directory_creation | true |
Other | Homebrew | brew | 682914bf40733303105680b165c8a324b1ba90bd.json | Improve readability of guard clause
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/cask/cask.rb | @@ -123,7 +123,7 @@ def outdated_versions(greedy = false)
end
def outdated_info(greedy, verbose, json)
- return token unless verbose || json
+ return token if !verbose && !json
installed_versions = outdated_versions(greedy).join(", ")
| false |
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/extend/os/mac/software_spec.rb | @@ -3,8 +3,19 @@
class SoftwareSpec
undef uses_from_macos
- def uses_from_macos(deps)
+ def uses_from_macos(deps, bounds = {})
@uses_from_macos_elements ||= []
- @uses_from_macos_elements << deps
+
+ if deps.is_a?(Hash)
+ bounds = deps.dup
+ deps = Hash[*bounds.shift]
+ end
+
+ bounds.transform_values! { |v| MacOS::Version.from_symbol(v) }
+ if MacOS.version >= bounds[:since]
+ @uses_from_macos_elements << deps
+ else
+ depends_on deps
+ end
end
end | true |
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/formula.rb | @@ -2431,8 +2431,8 @@ def depends_on(dep)
# Indicates use of dependencies provided by macOS.
# On macOS this is a no-op (as we use the system libraries there).
# On Linux this will act as `depends_on`.
- def uses_from_macos(dep)
- specs.each { |spec| spec.uses_from_macos(dep) }
+ def uses_from_macos(dep, bounds = {})
+ specs.each { |spec| spec.uses_from_macos(dep, bounds) }
end
# Block executed only executed on macOS. No-op on Linux. | true |
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/rubocops/dependency_order.rb | @@ -126,7 +126,7 @@ def verify_order_in_source(ordered)
# Node pattern method to extract `name` in `depends_on :name` or `uses_from_macos :name`
def_node_search :dependency_name_node, <<~EOS
- {(send nil? {:depends_on :uses_from_macos} {(hash (pair $_ _)) $({str sym} _) $(const nil? _)})
+ {(send nil? {:depends_on :uses_from_macos} {(hash (pair $_ _) ...) $({str sym} _) $(const nil? _)} ...)
(if _ (send nil? :depends_on {(hash (pair $_ _)) $({str sym} _) $(const nil? _)}) nil?)}
EOS
| true |
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/software_spec.rb | @@ -171,7 +171,8 @@ def depends_on(spec)
add_dep_option(dep) if dep
end
- def uses_from_macos(spec)
+ def uses_from_macos(spec, _bounds = {})
+ spec = Hash[*spec.first] if spec.is_a?(Hash)
depends_on(spec)
end
| true |
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/test/os/linux/formula_spec.rb | @@ -19,6 +19,18 @@
expect(f.class.devel.deps.first.name).to eq("foo")
expect(f.class.head.deps.first.name).to eq("foo")
end
+
+ it "ignores OS version specifications" do
+ f = formula "foo" do
+ url "foo-1.0"
+
+ uses_from_macos "foo", since: :mojave
+ end
+
+ expect(f.class.stable.deps.first.name).to eq("foo")
+ expect(f.class.devel.deps.first.name).to eq("foo")
+ expect(f.class.head.deps.first.name).to eq("foo")
+ end
end
describe "#on_linux" do | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.