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 | 15916338888e48e70edc4ade7f0aff94e3607e76.json | gpg_requirement: add standalone requirement
GPG 1.x has stopped receiving new features, some of which we may well want to
take advantage of sooner or later in Homebrew. Upstream has also been attempting
to work out for a while how well used it still is which suggests it may "go away"
at some point in the future.
Debian is also in the process of migrating GnuPG 1.x to a `gpg1` executable
whilst GnuPG 2.1.x assumes the `gpg` executable. There's a detailed video
discussion of this from DebConf 2015 at:
http://meetings-archive.debian.net/pub/debian-meetings/2015/debconf15/GnuPG_in_Debian_report.webm
It's unsafe to assume every `gpg` executable is going to forever equal 1.x and
every `gpg2` executable is going to forever equal 2.x. MacGPG2 has been symlinking
2.x as a vanilla `gpg` for a while, for example, and we will be soon as well.
You'll still be able to plonk the `libexec/bin` path of `gpg` in your PATH to
access a vanilla `gpg` 1.x executable if you want to, but we're not going to
actively keep adding gpg1 support to formulae going forwards. There's really no
reason why 99.9% of projects should not or cannot use `gpg2` these days.
This uses detection methods to determine regardless of what the executable
is called we're always hitting a 2.0 GnuPG or nothing. | Library/Homebrew/requirements/gpg_requirement.rb | @@ -0,0 +1,27 @@
+require "requirement"
+
+class GPGRequirement < Requirement
+ fatal true
+ default_formula "gnupg2"
+
+ satisfy(:build_env => false) { gpg2 || gpg }
+
+ # MacGPG2/GPGTools installs GnuPG 2.0.x as a vanilla `gpg` symlink
+ # pointing to `gpg2`, as do we. Ensure we're actually using a 2.0 `gpg`.
+ # Temporarily, only support 2.0.x rather than the 2.1.x "modern" series.
+ def gpg
+ which_all("gpg").detect do |gpg|
+ gpg_short_version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0]
+ next unless gpg_short_version
+ Version.create(gpg_short_version.to_s) == Version.create("2.0")
+ end
+ end
+
+ def gpg2
+ which_all("gpg2").detect do |gpg2|
+ gpg2_short_version = Utils.popen_read(gpg2, "--version")[/\d\.\d/, 0]
+ next unless gpg2_short_version
+ Version.create(gpg2_short_version.to_s) == Version.create("2.0")
+ end
+ end
+end | true |
Other | Homebrew | brew | 2b847959f098414fb12600535b5f0ab584a11e40.json | oh1: Add a truncate option | Library/Homebrew/utils.rb | @@ -88,8 +88,10 @@ def ohai(title, *sput)
puts sput
end
-def oh1(title)
- title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
+def oh1(title, options = {})
+ if $stdout.tty? && !ARGV.verbose? && options.fetch(:truncate, :auto) == :auto
+ title = Tty.truncate(title)
+ end
puts "#{Tty.green}==>#{Tty.white} #{title}#{Tty.reset}"
end
| false |
Other | Homebrew | brew | 2776f08fa095b95dafbc9af5f80188f3f063e001.json | gpg: simplify available check
which_all already runs some checks to see if the file is a file & is executable.
Our usage here inside `self.available?` is mostly a smoke test.
Closes #676.
Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com> | Library/Homebrew/gpg.rb | @@ -20,7 +20,7 @@ def self.gpg2
GPG_EXECUTABLE = gpg2 || gpg
def self.available?
- File.exist?(GPG_EXECUTABLE.to_s) && File.executable?(GPG_EXECUTABLE.to_s)
+ File.executable?(GPG_EXECUTABLE.to_s)
end
def self.create_test_key(path) | false |
Other | Homebrew | brew | 3005582f15237393d6dd9df5e8b6429112b2e12a.json | gpg: combine detection logic | Library/Homebrew/gpg.rb | @@ -1,32 +1,26 @@
require "utils"
class Gpg
- # Should ideally be using `GPGRequirement.new.gpg2`, etc to get path here but
- # calling that directly leads to:
- # requirement.rb:139:in `which_all': uninitialized constant Requirement::ORIGINAL_PATHS (NameError)
- # when i.e. including the gpg syntax in wget. Not problematic if not used by formula code.
- # For now, the path determination blob of code has been semi-modified for here.
- # Look into this more.
- def self.gpg
- which("gpg") do |gpg|
+ def self.find_gpg(executable)
+ which_all(executable).detect do |gpg|
gpg_short_version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0]
next unless gpg_short_version
Version.create(gpg_short_version.to_s) == Version.create("2.0")
end
end
+ def self.gpg
+ find_gpg("gpg")
+ end
+
def self.gpg2
- which("gpg2") do |gpg2|
- gpg2_short_version = Utils.popen_read(gpg2, "--version")[/\d\.\d/, 0]
- next unless gpg2_short_version
- Version.create(gpg2_short_version.to_s) == Version.create("2.0")
- end
+ find_gpg("gpg2")
end
GPG_EXECUTABLE = gpg2 || gpg
def self.available?
- File.exist?(GPG_EXECUTABLE.to_s) && File.executable?(GPG_EXECUTABLE)
+ File.exist?(GPG_EXECUTABLE.to_s) && File.executable?(GPG_EXECUTABLE.to_s)
end
def self.create_test_key(path) | false |
Other | Homebrew | brew | 2c81083f3c9679b9c70c2d0a3e1d8f496707588a.json | test_gpg: add initial tests | Library/Homebrew/test/test_gpg.rb | @@ -0,0 +1,22 @@
+require "testing_env"
+require "gpg"
+
+class GpgTest < Homebrew::TestCase
+ def setup
+ skip "GPG Unavailable" unless Gpg.available?
+ @dir = Pathname.new(mktmpdir)
+ end
+
+ def teardown
+ @dir.rmtree
+ end
+
+ def test_create_test_key
+ Dir.chdir(@dir) do
+ with_environment("HOME" => @dir) do
+ shutup { Gpg.create_test_key(@dir) }
+ assert_predicate @dir/".gnupg/secring.gpg", :exist?
+ end
+ end
+ end
+end | false |
Other | Homebrew | brew | 91b67bd41d3a6fa04d5dd438b667d9bcb7e414e9.json | tests: add assertion to test_simple_valid_formula | Library/Homebrew/test/test_cmd_audit.rb | @@ -36,6 +36,7 @@ def test_simple_valid_formula
assert ft =~ /\burl\b/, "The formula should match 'url'"
assert_nil ft.line_number(/desc/), "The formula should not match 'desc'"
assert_equal 2, ft.line_number(/\burl\b/)
+ assert ft.include?("Valid"), "The formula should include \"Valid\""
end
def test_trailing_newline | false |
Other | Homebrew | brew | c56625f8b76f5e33ac5e086af4c9d3d79c593218.json | utils: check raise deprecation exceptions value. | Library/Homebrew/utils.rb | @@ -149,7 +149,8 @@ def odeprecated(method, replacement = nil, options = {})
#{caller_message}#{tap_message}
EOS
- if ARGV.homebrew_developer? || options[:die]
+ if ARGV.homebrew_developer? || options[:die] ||
+ Homebrew.raise_deprecation_exceptions?
raise FormulaMethodDeprecatedError, message
else
opoo "#{message}\n" | false |
Other | Homebrew | brew | 985c672bac4dc20d369b451c484eb6553762dbcf.json | update.sh: check upstream SHA prefetch not local.
Otherwise this can prevent taps from being updated as expected. | Library/Homebrew/cmd/update.sh | @@ -383,18 +383,22 @@ EOS
[[ -d "$DIR/.git" ]] || continue
cd "$DIR" || continue
+ if [[ -n "$HOMEBREW_VERBOSE" ]]
+ then
+ echo "Checking if we need to fetch $DIR..."
+ fi
+
TAP_VAR="$(repo_var "$DIR")"
- declare PREFETCH_REVISION"$TAP_VAR"="$(read_current_revision)"
+ UPSTREAM_BRANCH="$(upstream_branch)"
+ declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH"
+ declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")"
[[ -n "$SKIP_FETCH_BREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue
[[ -n "$SKIP_FETCH_CORE_REPOSITORY" && "$DIR" = "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && continue
# The upstream repository's default branch may not be master;
# check refs/remotes/origin/HEAD to see what the default
# origin branch name is, and use that. If not set, fall back to "master".
- UPSTREAM_BRANCH="$(upstream_branch)"
- declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH"
-
# the refspec ensures that the default upstream branch gets updated
(
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
@@ -485,9 +489,8 @@ EOS
export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$CURRENT_REVISION"
else
merge_or_rebase "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH"
+ [[ -n "$HOMEBREW_VERBOSE" ]] && echo
fi
-
- [[ -n "$HOMEBREW_VERBOSE" ]] && echo
done
safe_cd "$HOMEBREW_REPOSITORY" | false |
Other | Homebrew | brew | b7dc6ce7ee0fe580b382bec9859fa1b6129e7930.json | Update zsh-completion for --fetch-HEAD | share/zsh/site-functions/_brew | @@ -139,6 +139,7 @@ case "$words[1]" in
upgrade)
_arguments \
'(--cleanup)--cleanup[remove previously installed formula version(s)]' \
+ '(--fetch-HEAD)--fetch-HEAD[detect outdated installation by fetching the repo]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then | false |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/cmd/--env.rb | @@ -3,6 +3,7 @@
require "extend/ENV"
require "build_environment"
+require "utils/shell"
module Homebrew
def __env
@@ -11,12 +12,25 @@ def __env
ENV.setup_build_environment
ENV.universal_binary if ARGV.build_universal?
- if $stdout.tty?
+ shell_value = ARGV.value("shell")
+ has_plain = ARGV.include?("--plain")
+
+ if has_plain
+ shell = nil
+ elsif shell_value.nil?
+ # legacy behavior
+ shell = :bash unless $stdout.tty?
+ elsif shell_value == "auto"
+ shell = Utils::Shell.parent_shell || Utils::Shell.preferred_shell
+ elsif shell_value
+ shell = Utils::Shell.path_to_shell(shell_value)
+ end
+
+ env_keys = build_env_keys(ENV)
+ if shell.nil?
dump_build_env ENV
else
- build_env_keys(ENV).each do |key|
- puts "export #{key}=\"#{ENV[key]}\""
- end
+ env_keys.each { |key| puts Utils::Shell.export_value(shell, key, ENV[key]) }
end
end
end | true |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/diagnostic.rb | @@ -3,6 +3,7 @@
require "formula"
require "version"
require "development_tools"
+require "utils/shell"
module Homebrew
module Diagnostic
@@ -475,7 +476,7 @@ def check_user_path_1
Consider setting your PATH so that #{HOMEBREW_PREFIX}/bin
occurs before /usr/bin. Here is a one-liner:
- echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{shell_profile}
+ echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{Utils::Shell.shell_profile}
EOS
end
end
@@ -495,7 +496,7 @@ def check_user_path_2
<<-EOS.undent
Homebrew's bin was not found in your PATH.
Consider setting the PATH for example like so
- echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{shell_profile}
+ echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{Utils::Shell.shell_profile}
EOS
end
@@ -510,7 +511,7 @@ def check_user_path_3
Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in #{HOMEBREW_PREFIX}/sbin.
Consider setting the PATH for example like so
- echo 'export PATH="#{HOMEBREW_PREFIX}/sbin:$PATH"' >> #{shell_profile}
+ echo 'export PATH="#{HOMEBREW_PREFIX}/sbin:$PATH"' >> #{Utils::Shell.shell_profile}
EOS
end
| true |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/extend/os/mac/diagnostic.rb | @@ -202,7 +202,7 @@ def check_for_unsupported_curl_vars
SSL_CERT_DIR support was removed from Apple's curl.
If fetching formulae fails you should:
unset SSL_CERT_DIR
- and remove it from #{shell_profile} if present.
+ and remove it from #{Utils::Shell.shell_profile} if present.
EOS
end
| true |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/test/test_integration_cmds.rb | @@ -227,6 +227,26 @@ def test_env
cmd("--env"))
end
+ def test_env_bash
+ assert_match %r{export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"},
+ cmd("--env", "--shell=bash")
+ end
+
+ def test_env_fish
+ assert_match %r{set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"},
+ cmd("--env", "--shell=fish")
+ end
+
+ def test_env_csh
+ assert_match %r{setenv CMAKE_PREFIX_PATH},
+ cmd("--env", "--shell=tcsh")
+ end
+
+ def test_env_plain
+ assert_match %r{CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}},
+ cmd("--env", "--plain")
+ end
+
def test_prefix_formula
assert_match "#{HOMEBREW_CELLAR}/testball",
cmd("--prefix", testball) | true |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/test/test_shell.rb | @@ -0,0 +1,38 @@
+require "testing_env"
+require "utils/shell"
+
+class ShellSmokeTest < Homebrew::TestCase
+ def test_path_to_shell()
+ # raw command name
+ assert_equal :bash, Utils::Shell.path_to_shell("bash")
+ # full path
+ assert_equal :bash, Utils::Shell.path_to_shell("/bin/bash")
+ # versions
+ assert_equal :zsh, Utils::Shell.path_to_shell("zsh-5.2")
+ # strip newline too
+ assert_equal :zsh, Utils::Shell.path_to_shell("zsh-5.2\n")
+ end
+
+ def test_path_to_shell_failure()
+ assert_equal nil, Utils::Shell.path_to_shell("")
+ assert_equal nil, Utils::Shell.path_to_shell("@@@@@@")
+ assert_equal nil, Utils::Shell.path_to_shell("invalid_shell-4.2")
+ end
+
+ def test_sh_quote()
+ assert_equal "''", Utils::Shell.sh_quote("")
+ assert_equal "\\\\", Utils::Shell.sh_quote("\\")
+ assert_equal "'\n'", Utils::Shell.sh_quote("\n")
+ assert_equal "\\$", Utils::Shell.sh_quote("$")
+ assert_equal "word", Utils::Shell.sh_quote("word")
+ end
+
+ def test_csh_quote()
+ assert_equal "''", Utils::Shell.csh_quote("")
+ assert_equal "\\\\", Utils::Shell.csh_quote("\\")
+ # note this test is different
+ assert_equal "'\\\n'", Utils::Shell.csh_quote("\n")
+ assert_equal "\\$", Utils::Shell.csh_quote("$")
+ assert_equal "word", Utils::Shell.csh_quote("word")
+ end
+end | true |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/test/test_utils.rb | @@ -1,6 +1,7 @@
require "testing_env"
require "utils"
require "tempfile"
+require "utils/shell"
class TtyTests < Homebrew::TestCase
def test_strip_ansi
@@ -157,15 +158,15 @@ def test_gzip
def test_shell_profile
ENV["SHELL"] = "/bin/sh"
- assert_equal "~/.bash_profile", shell_profile
+ assert_equal "~/.bash_profile", Utils::Shell.shell_profile
ENV["SHELL"] = "/bin/bash"
- assert_equal "~/.bash_profile", shell_profile
+ assert_equal "~/.bash_profile", Utils::Shell.shell_profile
ENV["SHELL"] = "/bin/another_shell"
- assert_equal "~/.bash_profile", shell_profile
+ assert_equal "~/.bash_profile", Utils::Shell.shell_profile
ENV["SHELL"] = "/bin/zsh"
- assert_equal "~/.zshrc", shell_profile
+ assert_equal "~/.zshrc", Utils::Shell.shell_profile
ENV["SHELL"] = "/bin/ksh"
- assert_equal "~/.kshrc", shell_profile
+ assert_equal "~/.kshrc", Utils::Shell.shell_profile
end
def test_popen_read | true |
Other | Homebrew | brew | 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.json | resolve conflict in diagnostic.rb | Library/Homebrew/utils/shell.rb | @@ -0,0 +1,73 @@
+module Utils
+ SHELL_PROFILE_MAP = {
+ :bash => "~/.bash_profile",
+ :csh => "~/.cshrc",
+ :fish => "~/.config/fish/config.fish",
+ :ksh => "~/.kshrc",
+ :sh => "~/.bash_profile",
+ :tcsh => "~/.tcshrc",
+ :zsh => "~/.zshrc",
+ }.freeze
+
+ module Shell
+ # take a path and heuristically convert it
+ # to a shell, return nil if there's no match
+ def self.path_to_shell(path)
+ # we only care about the basename
+ shell_name = File.basename(path)
+ # handle possible version suffix like `zsh-5.2`
+ shell_name.sub!(/-.*\z/m, "")
+ shell_name.to_sym if %w[bash csh fish ksh sh tcsh zsh].include?(shell_name)
+ end
+
+ def self.preferred_shell
+ path_to_shell(ENV.fetch("SHELL", ""))
+ end
+
+ def self.parent_shell
+ path_to_shell(`ps -p #{Process.ppid} -o ucomm=`.strip)
+ end
+
+ def self.csh_quote(str)
+ # ruby's implementation of shell_escape
+ str = str.to_s
+ return "''" if str.empty?
+ str = str.dup
+ # anything that isn't a known safe character is padded
+ str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\" + "\\1")
+ str.gsub!(/\n/, "'\\\n'")
+ str
+ end
+
+ def self.sh_quote(str)
+ # ruby's implementation of shell_escape
+ str = str.to_s
+ return "''" if str.empty?
+ str = str.dup
+ # anything that isn't a known safe character is padded
+ str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\" + "\\1")
+ str.gsub!(/\n/, "'\n'")
+ str
+ end
+
+ # quote values. quoting keys is overkill
+ def self.export_value(shell, key, value)
+ case shell
+ when :bash, :ksh, :sh, :zsh
+ "export #{key}=\"#{sh_quote(value)}\""
+ when :fish
+ # fish quoting is mostly Bourne compatible except that
+ # a single quote can be included in a single-quoted string via \'
+ # and a literal \ can be included via \\
+ "set -gx #{key} \"#{sh_quote(value)}\""
+ when :csh, :tcsh
+ "setenv #{key} #{csh_quote(value)}"
+ end
+ end
+
+ # return the shell profile file based on users' preferred shell
+ def self.shell_profile
+ SHELL_PROFILE_MAP.fetch(preferred_shell, "~/.bash_profile")
+ end
+ end
+end | true |
Other | Homebrew | brew | 4eaa40ae1f432f3fd49fef628928579cb7eba600.json | Enable vendored Ruby 2.0. | Library/Homebrew/cmd/vendor-install.sh | @@ -8,6 +8,7 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor"
+# Built from https://github.com/Homebrew/homebrew-portable.
if [[ -n "$HOMEBREW_OSX" ]]
then
if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
@@ -185,7 +186,10 @@ homebrew-vendor-install() {
if [[ -z "$VENDOR_URL" || -z "$VENDOR_SHA" ]]
then
- odie "Cannot find a vendored version of $VENDOR_NAME."
+ odie <<-EOS
+Cannot find a vendored version of $VENDOR_NAME for your $HOMEBREW_PROCESSOR
+processor on $HOMEBREW_PRODUCT!
+EOS
fi
VENDOR_VERSION="$(<"$VENDOR_DIR/portable-$VENDOR_NAME-version")" | true |
Other | Homebrew | brew | 4eaa40ae1f432f3fd49fef628928579cb7eba600.json | Enable vendored Ruby 2.0. | Library/Homebrew/manpages/brew.1.md.erb | @@ -151,6 +151,10 @@ can take several different forms:
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.
+ * `HOMEBREW_FORCE_VENDOR_RUBY`:
+ If set, Homebrew will always use its vendored, relocatable Ruby 2.0 version
+ even if the system version of Ruby is >=2.0.
+
* `HOMEBREW_GITHUB_API_TOKEN`:
A personal access token for the GitHub API, which you can create at
<https://github.com/settings/tokens>. If set, GitHub will allow you a | true |
Other | Homebrew | brew | 4eaa40ae1f432f3fd49fef628928579cb7eba600.json | Enable vendored Ruby 2.0. | Library/Homebrew/utils/ruby.sh | @@ -1,33 +1,4 @@
-original-setup-ruby-path() {
- if [[ -z "$HOMEBREW_DEVELOPER" ]]
- then
- unset HOMEBREW_RUBY_PATH
- fi
-
- if [[ -z "$HOMEBREW_RUBY_PATH" ]]
- then
- if [[ -n "$HOMEBREW_OSX" ]]
- then
- HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby"
- else
- HOMEBREW_RUBY_PATH="$(which ruby)"
- if [[ -z "$HOMEBREW_RUBY_PATH" ]]
- then
- odie "No Ruby found, cannot proceed."
- fi
- fi
- fi
-
- export HOMEBREW_RUBY_PATH
-}
-
setup-ruby-path() {
- if [[ -z "$HOMEBREW_USE_VENDOR_RUBY" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
- then
- original-setup-ruby-path
- return
- fi
-
local vendor_dir
local vendor_ruby_current_version
local vendor_ruby_path | true |
Other | Homebrew | brew | 4eaa40ae1f432f3fd49fef628928579cb7eba600.json | Enable vendored Ruby 2.0. | share/doc/homebrew/Common-Issues.md | @@ -38,7 +38,7 @@ invalid multibyte escape: /^\037\235/
In the past, Homebrew assumed that `/usr/bin/ruby` was Ruby 1.8. On OS X 10.9, it is now Ruby 2.0. There are various incompatibilities between the two versions, so if you upgrade to OS X 10.9 while using a sufficiently old version of Homebrew, you will encounter errors.
-The incompatibilities have been addressed in more recent versions of Homebrew, and it does not make assumptions about `/usr/bin/ruby`, instead it uses the executable inside OS X's Ruby 1.8 framework.
+The incompatibilities have been addressed in more recent versions of Homebrew, and it does not make assumptions about `/usr/bin/ruby`, instead it uses the executable inside OS X's Ruby framework or a vendored Ruby.
To recover from this situation, do the following:
| true |
Other | Homebrew | brew | 4eaa40ae1f432f3fd49fef628928579cb7eba600.json | Enable vendored Ruby 2.0. | share/doc/homebrew/brew.1.html | @@ -554,6 +554,8 @@ <h2 id="ENVIRONMENT">ENVIRONMENT</h2>
<p><em>Note:</em> <code>brew edit</code> will open all of Homebrew as discontinuous files and
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.</p></dd>
+<dt><code>HOMEBREW_FORCE_VENDOR_RUBY</code></dt><dd><p>If set, Homebrew will always use its vendored, relocatable Ruby 2.0 version
+even if the system version of Ruby is >=2.0.</p></dd>
<dt><code>HOMEBREW_GITHUB_API_TOKEN</code></dt><dd><p>A personal access token for the GitHub API, which you can create at
<a href="https://github.com/settings/tokens" data-bare-link="true">https://github.com/settings/tokens</a>. If set, GitHub will allow you a
greater number of API requests. See | true |
Other | Homebrew | brew | 4eaa40ae1f432f3fd49fef628928579cb7eba600.json | Enable vendored Ruby 2.0. | share/man/man1/brew.1 | @@ -764,6 +764,10 @@ If set, Homebrew will use this editor when editing a single formula, or several
\fINote:\fR \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\.
.
.TP
+\fBHOMEBREW_FORCE_VENDOR_RUBY\fR
+If set, Homebrew will always use its vendored, relocatable Ruby 2\.0 version even if the system version of Ruby is >=2\.0\.
+.
+.TP
\fBHOMEBREW_GITHUB_API_TOKEN\fR
A personal access token for the GitHub API, which you can create at \fIhttps://github\.com/settings/tokens\fR\. If set, GitHub will allow you a greater number of API requests\. See \fIhttps://developer\.github\.com/v3/#rate\-limiting\fR for more information\. Homebrew uses the GitHub API for features such as \fBbrew search\fR\.
. | true |
Other | Homebrew | brew | 06fe347de97975dc01e726f87bf07a56a6fb713e.json | os/mac/ruby_keg: improve error reporting
A failure to change a dylib ID or install name would previously cause a
rather cryptic error message, that didn't include the name of the file
that caused the failure, unless `--debug` was specified. Make sure to
output this information in all cases before re-raising the exception. | Library/Homebrew/os/mac/ruby_keg.rb | @@ -5,12 +5,26 @@ def change_dylib_id(id, file)
@require_install_name_tool = true
puts "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug?
MachO::Tools.change_dylib_id(file, id)
+ rescue MachO::MachOError
+ onoe <<-EOS.undent
+ Failed changing dylib ID of #{file}
+ from #{file.dylib_id}
+ to #{id}
+ EOS
+ raise
end
def change_install_name(old, new, file)
@require_install_name_tool = true
puts "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug?
MachO::Tools.change_install_name(file, old, new)
+ rescue MachO::MachOError
+ onoe <<-EOS.undent
+ Failed changing install name in #{file}
+ from #{old}
+ to #{new}
+ EOS
+ raise
end
def require_install_name_tool? | false |
Other | Homebrew | brew | fdf55e77e10f938d1c5d8a72e015e04451be938a.json | Improve formula not found handling (#96) | Library/Homebrew/cmd/install.rb | @@ -156,6 +156,8 @@ def install
rescue FormulaUnavailableError => e
if (blacklist = blacklisted?(e.name))
ofail "#{e.message}\n#{blacklist}"
+ elsif e.name == "updog"
+ ofail "What's updog?"
else
ofail e.message
query = query_regexp(e.name) | false |
Other | Homebrew | brew | d0251c1abc3d63513c8b07647607e3a5654caedb.json | formulary: fix to_rack for fully-scoped references
Fixes the case where I have `mysql56` installed but do
`brew uninstall foo/bar/mysql56` which isn't a valid formula.
Fixes https://github.com/Homebrew/legacy-homebrew/issues/39883. | Library/Homebrew/formulary.rb | @@ -256,12 +256,15 @@ def self.from_contents(name, path, contents, spec = :stable)
end
def self.to_rack(ref)
- # First, check whether the rack with the given name exists.
+ # If using a fully-scoped reference, check if the formula can be resolved.
+ factory(ref) if ref.include? "/"
+
+ # Check whether the rack with the given name exists.
if (rack = HOMEBREW_CELLAR/File.basename(ref, ".rb")).directory?
return rack.resolved_path
end
- # Second, use canonical name to locate rack.
+ # Use canonical name to locate rack.
(HOMEBREW_CELLAR/canonical_name(ref)).resolved_path
end
| true |
Other | Homebrew | brew | d0251c1abc3d63513c8b07647607e3a5654caedb.json | formulary: fix to_rack for fully-scoped references
Fixes the case where I have `mysql56` installed but do
`brew uninstall foo/bar/mysql56` which isn't a valid formula.
Fixes https://github.com/Homebrew/legacy-homebrew/issues/39883. | Library/Homebrew/test/test_formulary.rb | @@ -111,6 +111,15 @@ def test_factory_from_rack_and_from_keg
def test_load_from_contents
assert_kind_of Formula, Formulary.from_contents(@name, @path, @path.read)
end
+
+ def test_to_rack
+ assert_equal HOMEBREW_CELLAR/@name, Formulary.to_rack(@name)
+ (HOMEBREW_CELLAR/@name).mkpath
+ assert_equal HOMEBREW_CELLAR/@name, Formulary.to_rack(@name)
+ assert_raises(TapFormulaUnavailableError) { Formulary.to_rack("a/b/#{@name}") }
+ ensure
+ FileUtils.rm_rf HOMEBREW_CELLAR/@name
+ end
end
class FormularyTapFactoryTest < Homebrew::TestCase | true |
Other | Homebrew | brew | fdcdcf73500626994dee6bd4d3bafba3bc8974bc.json | diagnostic: remove MacGPG2 check
This hasn't been an issue for upstream stable releases for 3 years, since March
2013, and hasn't been an issue for pre-release versions for 4 years.
That release, and indeed the latest modern GPGTools releases, support 10.6 and
above so there's no reason to suspect people are actually encountering the old
versions in the wild with enough regularity to merit this being a permanent part
of our codebase any more.
In the last two years Homebrew has seen one Issue where MacGPG2 was the problem,
and that wasn't reproducible at the time (and still isn't), and the `doctor` check
likely wasn't even raised there. There has only been one Issue where the MacGPG2
`doctor` check was raised in that two year period.
I think it's fair to treat this as an user configuration outlier now rather than
an issue we need to be constantly on guard for.
Ref: Homebrew/legacy-homebrew@dfb171b
Ref: Homebrew/legacy-homebrew#12238
Ref: Homebrew/legacy-homebrew@046498b | Library/Homebrew/diagnostic.rb | @@ -114,25 +114,6 @@ def check_path_for_trailing_slashes
EOS
end
- # Installing MacGPG2 interferes with Homebrew in a big way
- # https://github.com/GPGTools/MacGPG2
- def check_for_macgpg2
- return if File.exist? "/usr/local/MacGPG2/share/gnupg/VERSION"
-
- suspects = %w[
- /Applications/start-gpg-agent.app
- /Library/Receipts/libiconv1.pkg
- /usr/local/MacGPG2
- ]
- return unless suspects.any? { |f| File.exist? f }
-
- <<-EOS.undent
- You may have installed MacGPG2 via the package installer.
- Several other checks in this script will turn up problems, such as stray
- dylibs in /usr/local and permissions issues with share and man in /usr/local/.
- EOS
- end
-
# Anaconda installs multiple system & brew dupes, including OpenSSL, Python,
# sqlite, libpng, Qt, etc. Regularly breaks compile on Vim, MacVim and others.
# Is flagged as part of the *-config script checks below, but people seem | false |
Other | Homebrew | brew | 2e360112e4b84fa5fafe17c400043970578a2db7.json | analytics.*: use curl --data for readability. | Library/Homebrew/utils/analytics.rb | @@ -16,13 +16,13 @@ def report(type, metadata = {})
args = %W[
--max-time 3
--user-agent #{HOMEBREW_USER_AGENT_CURL}
- -d v=1
- -d tid=#{ENV["HOMEBREW_ANALYTICS_ID"]}
- -d cid=#{ENV["HOMEBREW_ANALYTICS_USER_UUID"]}
- -d aip=1
- -d an=#{HOMEBREW_PRODUCT}
- -d av=#{HOMEBREW_VERSION}
- -d t=#{type}
+ --data v=1
+ --data aip=1
+ --data t=#{type}
+ --data tid=#{ENV["HOMEBREW_ANALYTICS_ID"]}
+ --data cid=#{ENV["HOMEBREW_ANALYTICS_USER_UUID"]}
+ --data an=#{HOMEBREW_PRODUCT}
+ --data av=#{HOMEBREW_VERSION}
]
metadata.each { |k, v| args << "-d" << "#{k}=#{v}" if k && v }
| true |
Other | Homebrew | brew | 2e360112e4b84fa5fafe17c400043970578a2db7.json | analytics.*: use curl --data for readability. | Library/Homebrew/utils/analytics.sh | @@ -93,14 +93,14 @@ report-analytics-screenview-command() {
local args=(
--max-time 3
--user-agent "$HOMEBREW_USER_AGENT_CURL"
- -d v=1
- -d tid="$HOMEBREW_ANALYTICS_ID"
- -d cid="$HOMEBREW_ANALYTICS_USER_UUID"
- -d aip=1
- -d an="$HOMEBREW_PRODUCT"
- -d av="$HOMEBREW_VERSION"
- -d t=screenview
- -d cd="$HOMEBREW_COMMAND"
+ --data v=1
+ --data aip=1
+ --data t=screenview
+ --data tid="$HOMEBREW_ANALYTICS_ID"
+ --data cid="$HOMEBREW_ANALYTICS_USER_UUID"
+ --data an="$HOMEBREW_PRODUCT"
+ --data av="$HOMEBREW_VERSION"
+ --data cd="$HOMEBREW_COMMAND"
)
# Send analytics. Don't send or store any personally identifiable information. | true |
Other | Homebrew | brew | 202e5f5332a5051e37799f5a87457bca301e85b3.json | formula_installer: prevent MaximumMacOSRequirement leakage
Read the discussion in https://github.com/Homebrew/homebrew-core/pull/3703. If you
have a better idea, please file a competing PR. I'm sick to death of discussion.
Closes #662.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/formula_installer.rb | @@ -308,6 +308,7 @@ def check_requirements(req_map)
req_map.each_pair do |dependent, reqs|
reqs.each do |req|
+ next if dependent.installed? && req.name == "maximummacos"
puts "#{dependent}: #{req.message}"
fatals << req if req.fatal?
end | false |
Other | Homebrew | brew | c016aedaab3a5b10207eb05d6b53199e6fcdb761.json | tests: check all our Bash code for syntax errors
Additionally include our bootstrap code in `brew.sh`, Bash utilities in
`utils.sh` and `utils/*.sh`, `superenv` shims, and the Bash completion.
Closes #654.
Signed-off-by: Martin Afanasjew <martin@afanasjew.de> | Library/Homebrew/test/test_bash.rb | @@ -1,20 +1,34 @@
require "testing_env"
class BashTests < Homebrew::TestCase
- def assert_valid_bash_syntax(files)
- output = Utils.popen_read("/bin/bash -n #{files} 2>&1")
+ def assert_valid_bash_syntax(file)
+ output = Utils.popen_read("/bin/bash -n #{file} 2>&1")
assert $?.success?, output
end
def test_bin_brew
- assert_valid_bash_syntax "#{HOMEBREW_LIBRARY_PATH.parent.parent}/bin/brew"
+ assert_valid_bash_syntax HOMEBREW_LIBRARY_PATH.parent.parent/"bin/brew"
end
- def test_bash_cmds
- %w[cmd dev-cmd].each do |dir|
- Dir["#{HOMEBREW_LIBRARY_PATH}/#{dir}/*.sh"].each do |cmd|
- assert_valid_bash_syntax cmd
- end
+ def test_bash_code
+ Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/**/*.sh").each do |pn|
+ pn_relative = pn.relative_path_from(HOMEBREW_LIBRARY_PATH)
+ next if pn_relative.to_s.start_with?("shims/", "test/", "vendor/")
+ assert_valid_bash_syntax pn
+ end
+ end
+
+ def test_bash_completion
+ script = HOMEBREW_LIBRARY_PATH.parent.parent/"etc/bash_completion.d/brew"
+ assert_valid_bash_syntax script
+ end
+
+ def test_bash_shims
+ # These have no file extension, but can be identified by their shebang.
+ (HOMEBREW_LIBRARY_PATH/"shims").find do |pn|
+ next if pn.directory? || pn.symlink?
+ next unless pn.executable? && pn.read(12) == "#!/bin/bash\n"
+ assert_valid_bash_syntax pn
end
end
end | false |
Other | Homebrew | brew | b75516425b2cfe746a70dd13e5538dec48688b58.json | utils/analytics.sh: fix style inconsistencies | Library/Homebrew/utils/analytics.sh | @@ -37,7 +37,7 @@ setup-analytics() {
then
if [[ -n "$HOMEBREW_LINUX" ]]
then
- HOMEBREW_ANALYTICS_USER_UUID="$(tr a-f A-F < /proc/sys/kernel/random/uuid)"
+ HOMEBREW_ANALYTICS_USER_UUID="$(tr a-f A-F </proc/sys/kernel/random/uuid)"
elif [[ -n "$HOMEBREW_OSX" ]]
then
HOMEBREW_ANALYTICS_USER_UUID="$(/usr/bin/uuidgen)"
@@ -91,16 +91,16 @@ report-analytics-screenview-command() {
esac
local args=(
- --max-time 3 \
- --user-agent "$HOMEBREW_USER_AGENT_CURL" \
- -d v=1 \
- -d tid="$HOMEBREW_ANALYTICS_ID" \
- -d cid="$HOMEBREW_ANALYTICS_USER_UUID" \
- -d aip=1 \
- -d an="$HOMEBREW_PRODUCT" \
- -d av="$HOMEBREW_VERSION" \
- -d t=screenview \
- -d cd="$HOMEBREW_COMMAND" \
+ --max-time 3
+ --user-agent "$HOMEBREW_USER_AGENT_CURL"
+ -d v=1
+ -d tid="$HOMEBREW_ANALYTICS_ID"
+ -d cid="$HOMEBREW_ANALYTICS_USER_UUID"
+ -d aip=1
+ -d an="$HOMEBREW_PRODUCT"
+ -d av="$HOMEBREW_VERSION"
+ -d t=screenview
+ -d cd="$HOMEBREW_COMMAND"
)
# Send analytics. Don't send or store any personally identifiable information. | false |
Other | Homebrew | brew | 2a943d0ad22b27e76b8ada687902f1f9cf22d3fb.json | shims/sed: fix style inconsistencies | Library/Homebrew/shims/super/sed | @@ -1,7 +1,9 @@
#!/bin/bash
-if [[ $HOMEBREW_CCCFG == *s* ]]; then
+
+if [[ "$HOMEBREW_CCCFG" = *s* ]]
+then
# Fix issue with sed barfing on unicode characters on Mountain Lion
unset LC_ALL
- export LC_CTYPE='C'
+ export LC_CTYPE="C"
fi
exec /usr/bin/sed "$@" | false |
Other | Homebrew | brew | 85c0b594ad89e876eae6a94141a228be0f5982b4.json | shims/pod2man: fix style inconsistencies | Library/Homebrew/shims/super/pod2man | @@ -1,3 +1,8 @@
#!/bin/bash
-POD2MAN=$(/usr/bin/which pod2man5.18 || /usr/bin/which pod2man5.16 || /usr/bin/which pod2man5.12 || /usr/bin/which $HOMEBREW_PREFIX/opt/pod2man/bin/pod2man || echo /usr/bin/pod2man)
-exec $POD2MAN "$@"
+
+POD2MAN="$(/usr/bin/which pod2man5.18 ||
+ /usr/bin/which pod2man5.16 ||
+ /usr/bin/which pod2man5.12 ||
+ /usr/bin/which "$HOMEBREW_PREFIX/opt/pod2man/bin/pod2man" ||
+ echo /usr/bin/pod2man)"
+exec "$POD2MAN" "$@" | false |
Other | Homebrew | brew | 8e180a85b8dc7d5cf0f202e120f3452be61f3727.json | shims/mig: fix style inconsistencies | Library/Homebrew/shims/super/mig | @@ -1,3 +1,4 @@
#!/bin/bash
+
pwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-exec xcrun mig -cc $pwd/cc "$@"
+exec xcrun mig -cc "$pwd/cc" "$@" | false |
Other | Homebrew | brew | 10af1866af3a2a5966ef0bededfc42608b406b39.json | shims/make: fix style inconsistencies | Library/Homebrew/shims/super/make | @@ -1,3 +1,4 @@
#!/bin/bash
+
export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG"
exec xcrun make "$@" | false |
Other | Homebrew | brew | 672dc1bae2d297d7b11a8871e837c46e687c5852.json | shims/bsdmake: fix style inconsistencies | Library/Homebrew/shims/super/bsdmake | @@ -1,3 +1,4 @@
#!/bin/bash
+
export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG"
exec xcrun bsdmake "$@" | false |
Other | Homebrew | brew | faf4bc819ce8c59b21fc4f0538cdca25551ef31f.json | shims/apr-1-config: fix style inconsistencies | Library/Homebrew/shims/super/apr-1-config | @@ -1,14 +1,16 @@
#!/bin/bash
-if [[ "$HOMEBREW_CCCFG" == *a* ]]; then
+if [[ "$HOMEBREW_CCCFG" = *a* ]]
+then
case "$1" in
- --cc) echo "cc";;
- --cpp) echo "cpp";;
- --includedir) echo "$HOMEBREW_SDKROOT/usr/include/apr-1";;
- --includes) echo "-isystem$HOMEBREW_SDKROOT/usr/include/apr-1";;
- --apr-libtool) echo "glibtool";;
- *)
- exec xcrun apr-1-config "$@";;
+ --cc) echo "cc" ;;
+ --cpp) echo "cpp" ;;
+ --includedir) echo "$HOMEBREW_SDKROOT/usr/include/apr-1" ;;
+ --includes) echo "-isystem$HOMEBREW_SDKROOT/usr/include/apr-1" ;;
+ --apr-libtool) echo "glibtool" ;;
+ *)
+ exec xcrun apr-1-config "$@"
+ ;;
esac
else
exec /usr/bin/apr-1-config "$@" | false |
Other | Homebrew | brew | 4a7fc07430ff43b4daa3a6ba07461f680895572a.json | shims/ant: fix style inconsistencies | Library/Homebrew/shims/super/ant | @@ -1,5 +1,7 @@
#!/bin/bash
+
export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG"
+
ant=/usr/bin/ant
-[ -x "$ant" ] || ant="$(${HOMEBREW_BREW_FILE} --prefix ant)/bin/ant"
+[[ -x "$ant" ]] || ant="$("$HOMEBREW_BREW_FILE" --prefix ant)/bin/ant"
exec "$ant" "$@" | false |
Other | Homebrew | brew | 3d862ef5e29e8f57649b596eeb70a57ce10bbcd2.json | cmd/vendor-install.sh: fix style inconsistencies | Library/Homebrew/cmd/vendor-install.sh | @@ -30,10 +30,10 @@ fetch() {
local temporary_path
curl_args=(
- --fail \
- --remote-time \
- --location \
- --user-agent "$HOMEBREW_USER_AGENT_CURL" \
+ --fail
+ --remote-time
+ --location
+ --user-agent "$HOMEBREW_USER_AGENT_CURL"
)
if [[ -n "$HOMEBREW_QUIET" ]]
@@ -44,7 +44,7 @@ fetch() {
curl_args+=(--progress-bar)
fi
- temporary_path="${CACHED_LOCATION}.incomplete"
+ temporary_path="$CACHED_LOCATION.incomplete"
mkdir -p "$HOMEBREW_CACHE"
[[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL"
@@ -67,7 +67,7 @@ fetch() {
if [[ ! -f "$temporary_path" ]]
then
- odie "Download failed: ${VENDOR_URL}"
+ odie "Download failed: $VENDOR_URL"
fi
trap '' SIGINT
@@ -159,10 +159,10 @@ homebrew-vendor-install() {
do
case "$option" in
-\?|-h|--help|--usage) brew help vendor-install; exit $? ;;
- --verbose) HOMEBREW_VERBOSE=1 ;;
- --quiet) HOMEBREW_QUIET=1 ;;
- --debug) HOMEBREW_DEBUG=1 ;;
- --*) ;;
+ --verbose) HOMEBREW_VERBOSE=1 ;;
+ --quiet) HOMEBREW_QUIET=1 ;;
+ --debug) HOMEBREW_DEBUG=1 ;;
+ --*) ;;
-*)
[[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1
[[ "$option" = *q* ]] && HOMEBREW_QUIET=1
@@ -188,7 +188,7 @@ homebrew-vendor-install() {
odie "Cannot find a vendored version of $VENDOR_NAME."
fi
- VENDOR_VERSION="$(<"$VENDOR_DIR/portable-${VENDOR_NAME}-version")"
+ VENDOR_VERSION="$(<"$VENDOR_DIR/portable-$VENDOR_NAME-version")"
CACHED_LOCATION="$HOMEBREW_CACHE/$(basename "$VENDOR_URL")"
lock "vendor-install-$VENDOR_NAME" | true |
Other | Homebrew | brew | 3d862ef5e29e8f57649b596eeb70a57ce10bbcd2.json | cmd/vendor-install.sh: fix style inconsistencies | Library/Homebrew/shims/scm/git | @@ -42,7 +42,7 @@ executable() {
}
lowercase() {
- echo "$1" | tr '[:upper:]' '[:lower:]'
+ echo "$1" | tr "[:upper:]" "[:lower:]"
}
safe_exec() { | true |
Other | Homebrew | brew | 1e9328c6e16eafcb6565d8191265f0256ab2a932.json | cmd/update.sh: fix style inconsistencies | Library/Homebrew/cmd/update.sh | @@ -284,19 +284,19 @@ homebrew-update() {
for option in "$@"
do
case "$option" in
- -\?|-h|--help|--usage) brew help update; exit $? ;;
- --verbose) HOMEBREW_VERBOSE=1 ;;
- --debug) HOMEBREW_DEBUG=1;;
- --merge) HOMEBREW_MERGE=1 ;;
+ -\?|-h|--help|--usage) brew help update; exit $? ;;
+ --verbose) HOMEBREW_VERBOSE=1 ;;
+ --debug) HOMEBREW_DEBUG=1 ;;
+ --merge) HOMEBREW_MERGE=1 ;;
--simulate-from-current-branch) HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH=1 ;;
- --preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
- --*) ;;
+ --preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
+ --*) ;;
-*)
- [[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1;
- [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1;
+ [[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1
+ [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
;;
*)
- odie <<-EOS
+ odie <<EOS
This command updates brew itself, and does not take formula names.
Use 'brew upgrade <formula>'.
EOS
@@ -312,7 +312,7 @@ EOS
# check permissions
if [[ "$HOMEBREW_PREFIX" = "/usr/local" && ! -w /usr/local ]]
then
- odie <<-EOS
+ odie <<EOS
/usr/local is not writable. You should change the ownership
and permissions of /usr/local back to your user account:
sudo chown -R \$(whoami) /usr/local
@@ -321,7 +321,7 @@ EOS
if [[ ! -w "$HOMEBREW_REPOSITORY" ]]
then
- odie <<-EOS
+ odie <<EOS
$HOMEBREW_REPOSITORY is not writable. You should change the
ownership and permissions of $HOMEBREW_REPOSITORY back to your
user account:
@@ -387,7 +387,7 @@ EOS
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
then
# Skip taps without formulae.
- FORMULAE="$(find "$DIR" -maxdepth 1 \( -name '*.rb' -or -name 'Formula' -or -name 'HomebrewFormula' \) -print -quit)"
+ FORMULAE="$(find "$DIR" -maxdepth 1 \( -name "*.rb" -or -name Formula -or -name HomebrewFormula \) -print -quit)"
[[ -z "$FORMULAE" ]] && exit
fi
@@ -399,7 +399,7 @@ EOS
UPSTREAM_BRANCH_LOCAL_SHA="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH")"
# Only try to `git fetch` when the upstream branch is at a different SHA
# (so the API does not return 304: unmodified).
- UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent '--max-time' 3 \
+ UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent --max-time 3 \
--output /dev/null --write-out "%{http_code}" \
--user-agent "$HOMEBREW_USER_AGENT_CURL" \
--header "Accept: application/vnd.github.v3.sha" \
@@ -425,7 +425,7 @@ EOS
if ! git fetch --force "${QUIET_ARGS[@]}" origin \
"refs/heads/$UPSTREAM_BRANCH:refs/remotes/origin/$UPSTREAM_BRANCH"
then
- echo "Fetching $DIR failed!" >> "$update_failed_file"
+ echo "Fetching $DIR failed!" >>"$update_failed_file"
fi
fi
) &
@@ -436,7 +436,7 @@ EOS
if [[ -f "$update_failed_file" ]]
then
- onoe < "$update_failed_file"
+ onoe <"$update_failed_file"
rm -f "$update_failed_file"
export HOMEBREW_UPDATE_FAILED="1"
fi | false |
Other | Homebrew | brew | 79c49b36389c2284f29fe8137a1c2acf87aac628.json | brew.sh: fix style inconsistencies | Library/Homebrew/brew.sh | @@ -33,7 +33,7 @@ git() {
}
# Force UTF-8 to avoid encoding issues for users with broken locale settings.
-if [[ "$(locale charmap 2> /dev/null)" != "UTF-8" ]]
+if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]
then
export LC_ALL="en_US.UTF-8"
fi
@@ -48,8 +48,8 @@ else
fi
case "$*" in
- --prefix) echo "$HOMEBREW_PREFIX"; exit 0 ;;
- --cellar) echo "$HOMEBREW_CELLAR"; exit 0 ;;
+ --prefix) echo "$HOMEBREW_PREFIX"; exit 0 ;;
+ --cellar) echo "$HOMEBREW_CELLAR"; exit 0 ;;
--repository|--repo) echo "$HOMEBREW_REPOSITORY"; exit 0 ;;
esac
@@ -66,8 +66,8 @@ unset GEM_PATH
HOMEBREW_SYSTEM="$(uname -s)"
case "$HOMEBREW_SYSTEM" in
- Darwin) HOMEBREW_OSX="1";;
- Linux) HOMEBREW_LINUX="1";;
+ Darwin) HOMEBREW_OSX="1" ;;
+ Linux) HOMEBREW_LINUX="1" ;;
esac
HOMEBREW_CURL="/usr/bin/curl"
@@ -171,20 +171,20 @@ HOMEBREW_ARG_COUNT="$#"
HOMEBREW_COMMAND="$1"
shift
case "$HOMEBREW_COMMAND" in
- ls) HOMEBREW_COMMAND="list";;
- homepage) HOMEBREW_COMMAND="home";;
- -S) HOMEBREW_COMMAND="search";;
- up) HOMEBREW_COMMAND="update";;
- ln) HOMEBREW_COMMAND="link";;
- instal) HOMEBREW_COMMAND="install";; # gem does the same
- rm) HOMEBREW_COMMAND="uninstall";;
- remove) HOMEBREW_COMMAND="uninstall";;
- configure) HOMEBREW_COMMAND="diy";;
- abv) HOMEBREW_COMMAND="info";;
- dr) HOMEBREW_COMMAND="doctor";;
- --repo) HOMEBREW_COMMAND="--repository";;
- environment) HOMEBREW_COMMAND="--env";;
- --config) HOMEBREW_COMMAND="config";;
+ ls) HOMEBREW_COMMAND="list" ;;
+ homepage) HOMEBREW_COMMAND="home" ;;
+ -S) HOMEBREW_COMMAND="search" ;;
+ up) HOMEBREW_COMMAND="update" ;;
+ ln) HOMEBREW_COMMAND="link" ;;
+ instal) HOMEBREW_COMMAND="install" ;; # gem does the same
+ rm) HOMEBREW_COMMAND="uninstall" ;;
+ remove) HOMEBREW_COMMAND="uninstall" ;;
+ configure) HOMEBREW_COMMAND="diy" ;;
+ abv) HOMEBREW_COMMAND="info" ;;
+ dr) HOMEBREW_COMMAND="doctor" ;;
+ --repo) HOMEBREW_COMMAND="--repository" ;;
+ environment) HOMEBREW_COMMAND="--env" ;;
+ --config) HOMEBREW_COMMAND="config" ;;
esac
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
@@ -197,8 +197,8 @@ fi
check-run-command-as-root() {
case "$HOMEBREW_COMMAND" in
- analytics|create|install|link|migrate|pin|postinstall|reinstall|switch|tap|tap-pin|\
- update|upgrade|vendor-install)
+ analytics|create|install|link|migrate|pin|postinstall|reinstall|switch|tap|\
+ tap-pin|update|upgrade|vendor-install)
;;
*)
return
@@ -210,7 +210,7 @@ check-run-command-as-root() {
local brew_file_ls_info=($(ls -nd "$HOMEBREW_BREW_FILE"))
if [[ "${brew_file_ls_info[2]}" != 0 ]]
then
- odie <<EOS
+ odie <<EOS
Cowardly refusing to 'sudo brew $HOMEBREW_COMMAND'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at | false |
Other | Homebrew | brew | 850db4ebf473738ffba8424065d62954d3c95dd1.json | search: fix repositories with formulae and casks.
e.g. Caskroom/homebrew-cask.
Thanks to UniqMartin for the fix.
Fixes #655. | Library/Homebrew/cmd/search.rb | @@ -143,7 +143,8 @@ def search_tap(user, repo, rx)
end
end
- paths = tree["Formula"] || tree["HomebrewFormula"] || tree["Casks"] || tree["."] || []
+ paths = tree["Formula"] || tree["HomebrewFormula"] || tree["."] || []
+ paths += tree["Casks"] || []
cache[key] = paths.map { |path| File.basename(path, ".rb") }
end
| false |
Other | Homebrew | brew | 11a1c495f7aec573e0e5e2f286036f8e6f0aa1ad.json | audit: enforce conflicts_with placement | Library/Homebrew/cmd/audit.rb | @@ -219,6 +219,7 @@ def audit_file
[/^ keg_only/, "keg_only"],
[/^ option/, "option"],
[/^ depends_on/, "depends_on"],
+ [/^ conflicts_with/, "conflicts_with"],
[/^ (go_)?resource/, "resource"],
[/^ def install/, "install method"],
[/^ def caveats/, "caveats method"], | false |
Other | Homebrew | brew | 04cb161ddb29ab26314684edc214650cdb192046.json | test_formula: add outdated_versions tests | Library/Homebrew/test/test_formula.rb | @@ -134,6 +134,47 @@ def test_installed_prefix_stable_installed
f.rack.rmtree
end
+ def test_installed_prefix_outdated_stable_head_installed
+ f = formula do
+ url "foo"
+ version "1.9"
+ head "foo"
+ end
+
+ head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD"
+ head_prefix.mkpath
+ tab = Tab.empty
+ tab.tabfile = head_prefix.join("INSTALL_RECEIPT.json")
+ tab.source["versions"] = { "stable" => "1.0" }
+ tab.write
+
+ assert_equal HOMEBREW_CELLAR/"#{f.name}/#{f.version}", f.installed_prefix
+ ensure
+ f.rack.rmtree
+ end
+
+ def test_installed_prefix_outdated_devel_head_installed
+ f = formula do
+ url "foo"
+ version "1.9"
+ devel do
+ url "foo"
+ version "2.1"
+ end
+ end
+
+ head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD"
+ head_prefix.mkpath
+ tab = Tab.empty
+ tab.tabfile = head_prefix.join("INSTALL_RECEIPT.json")
+ tab.source["versions"] = { "stable" => "1.9", "devel" => "2.0" }
+ tab.write
+
+ assert_equal HOMEBREW_CELLAR/"#{f.name}/#{f.version}", f.installed_prefix
+ ensure
+ f.rack.rmtree
+ end
+
def test_installed_prefix_head
f = formula("test", Pathname.new(__FILE__).expand_path, :head) do
head "foo"
@@ -526,60 +567,67 @@ def setup
end
def teardown
- @f.rack.rmtree
+ @f.rack.rmtree if @f.rack.exist?
end
- def setup_tab_for_prefix(prefix, tap_string = nil)
+ def setup_tab_for_prefix(prefix, options = {})
prefix.mkpath
tab = Tab.empty
tab.tabfile = prefix.join("INSTALL_RECEIPT.json")
- tab.source["tap"] = tap_string if tap_string
- tab.write
+ tab.source["tap"] = options[:tap] if options[:tap]
+ tab.source["versions"] = options[:versions] if options[:versions]
+ tab.source_modified_time = options[:source_modified_time].to_i
+ tab.write unless options[:no_write]
tab
end
+ def reset_outdated_versions
+ f.instance_variable_set(:@outdated_versions, nil)
+ end
+
def test_greater_different_tap_installed
- setup_tab_for_prefix(greater_prefix, "user/repo")
+ setup_tab_for_prefix(greater_prefix, :tap => "user/repo")
assert_predicate f.outdated_versions, :empty?
end
def test_greater_same_tap_installed
f.instance_variable_set(:@tap, CoreTap.instance)
- setup_tab_for_prefix(greater_prefix, "homebrew/core")
+ setup_tab_for_prefix(greater_prefix, :tap => "homebrew/core")
assert_predicate f.outdated_versions, :empty?
end
def test_outdated_different_tap_installed
- setup_tab_for_prefix(outdated_prefix, "user/repo")
+ setup_tab_for_prefix(outdated_prefix, :tap => "user/repo")
refute_predicate f.outdated_versions, :empty?
end
def test_outdated_same_tap_installed
f.instance_variable_set(:@tap, CoreTap.instance)
- setup_tab_for_prefix(outdated_prefix, "homebrew/core")
+ setup_tab_for_prefix(outdated_prefix, :tap => "homebrew/core")
refute_predicate f.outdated_versions, :empty?
end
def test_same_head_installed
f.instance_variable_set(:@tap, CoreTap.instance)
- setup_tab_for_prefix(head_prefix, "homebrew/core")
+ setup_tab_for_prefix(head_prefix, :tap => "homebrew/core")
assert_predicate f.outdated_versions, :empty?
end
def test_different_head_installed
f.instance_variable_set(:@tap, CoreTap.instance)
- setup_tab_for_prefix(head_prefix, "user/repo")
+ setup_tab_for_prefix(head_prefix, :tap => "user/repo")
assert_predicate f.outdated_versions, :empty?
end
def test_mixed_taps_greater_version_installed
f.instance_variable_set(:@tap, CoreTap.instance)
- setup_tab_for_prefix(outdated_prefix, "homebrew/core")
- setup_tab_for_prefix(greater_prefix, "user/repo")
+ setup_tab_for_prefix(outdated_prefix, :tap => "homebrew/core")
+ setup_tab_for_prefix(greater_prefix, :tap => "user/repo")
assert_predicate f.outdated_versions, :empty?
- setup_tab_for_prefix(greater_prefix, "homebrew/core")
+ setup_tab_for_prefix(greater_prefix, :tap => "homebrew/core")
+ reset_outdated_versions
assert_predicate f.outdated_versions, :empty?
end
@@ -590,23 +638,97 @@ def test_mixed_taps_outdated_version_installed
extra_outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.0"
setup_tab_for_prefix(outdated_prefix)
- setup_tab_for_prefix(extra_outdated_prefix, "homebrew/core")
+ setup_tab_for_prefix(extra_outdated_prefix, :tap => "homebrew/core")
+ reset_outdated_versions
refute_predicate f.outdated_versions, :empty?
- setup_tab_for_prefix(outdated_prefix, "user/repo")
+ setup_tab_for_prefix(outdated_prefix, :tap => "user/repo")
+ reset_outdated_versions
refute_predicate f.outdated_versions, :empty?
end
def test_same_version_tap_installed
f.instance_variable_set(:@tap, CoreTap.instance)
- setup_tab_for_prefix(same_prefix, "homebrew/core")
+ setup_tab_for_prefix(same_prefix, :tap => "homebrew/core")
+
+ assert_predicate f.outdated_versions, :empty?
+
+ setup_tab_for_prefix(same_prefix, :tap => "user/repo")
+ reset_outdated_versions
assert_predicate f.outdated_versions, :empty?
+ end
+
+ def test_outdated_installed_head_less_than_stable
+ tab = setup_tab_for_prefix(head_prefix, :versions => { "stable" => "1.0" })
+ refute_predicate f.outdated_versions, :empty?
- setup_tab_for_prefix(same_prefix, "user/repo")
+ # Tab.for_keg(head_prefix) will be fetched from CACHE but we write it anyway
+ tab.source["versions"] = { "stable" => f.version.to_s }
+ tab.write
+ reset_outdated_versions
assert_predicate f.outdated_versions, :empty?
end
+
+ def test_outdated_fetch_head
+ outdated_stable_prefix = HOMEBREW_CELLAR.join("testball/1.0")
+ head_prefix_a = HOMEBREW_CELLAR.join("testball/HEAD")
+ head_prefix_b = HOMEBREW_CELLAR.join("testball/HEAD-aaaaaaa_1")
+ head_prefix_c = HOMEBREW_CELLAR.join("testball/HEAD-5658946")
+
+ setup_tab_for_prefix(outdated_stable_prefix)
+ tab_a = setup_tab_for_prefix(head_prefix_a, :versions => { "stable" => "1.0" })
+ setup_tab_for_prefix(head_prefix_b)
+
+ initial_env = ENV.to_hash
+ testball_repo = HOMEBREW_PREFIX.join("testball_repo")
+ testball_repo.mkdir
+
+ @f = formula("testball") do
+ url "foo"
+ version "2.10"
+ head "file://#{testball_repo}", :using => :git
+ end
+
+ %w[AUTHOR COMMITTER].each do |role|
+ ENV["GIT_#{role}_NAME"] = "brew tests"
+ ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost"
+ ENV["GIT_#{role}_DATE"] = "Thu May 21 00:04:11 2009 +0100"
+ end
+
+ testball_repo.cd do
+ FileUtils.touch "LICENSE"
+ shutup do
+ system "git", "init"
+ system "git", "add", "--all"
+ system "git", "commit", "-m", "Initial commit"
+ end
+ end
+
+ refute_predicate f.outdated_versions(:fetch_head => true), :empty?
+
+ tab_a.source["versions"] = { "stable" => f.version.to_s }
+ tab_a.write
+ reset_outdated_versions
+ refute_predicate f.outdated_versions(:fetch_head => true), :empty?
+
+ head_prefix_a.rmtree
+ reset_outdated_versions
+ refute_predicate f.outdated_versions(:fetch_head => true), :empty?
+
+ setup_tab_for_prefix(head_prefix_c, :source_modified_time => 1)
+ reset_outdated_versions
+ assert_predicate f.outdated_versions(:fetch_head => true), :empty?
+ ensure
+ ENV.replace(initial_env)
+ testball_repo.rmtree if testball_repo.exist?
+ outdated_stable_prefix.rmtree if outdated_stable_prefix.exist?
+ head_prefix_b.rmtree if head_prefix.exist?
+ head_prefix_c.rmtree if head_prefix_c.exist?
+ FileUtils.rm_rf HOMEBREW_CACHE/"testball--git"
+ FileUtils.rm_rf HOMEBREW_CELLAR/"testball"
+ end
end | false |
Other | Homebrew | brew | 001bef0604534adeb5f85d77e00a20e8a1542b7a.json | formula: detect outdated HEAD in outdated_versions | Library/Homebrew/formula.rb | @@ -1000,7 +1000,7 @@ def migration_needed?
end
# @private
- def outdated_versions
+ def outdated_versions(options = {})
@outdated_versions ||= begin
all_versions = []
@@ -1009,16 +1009,22 @@ def outdated_versions
installed_kegs.each do |keg|
version = keg.version
all_versions << version
- return [] if pkg_version <= version
+
+ return [] if pkg_version <= version && !version.head?
end
- all_versions.sort!
+ head_version = latest_head_version
+ if head_version
+ head_version_outdated?(head_version, options) ? all_versions.sort! : []
+ else
+ all_versions.sort!
+ end
end
end
# @private
- def outdated?
- !outdated_versions.empty?
+ def outdated?(options = {})
+ !outdated_versions(options).empty?
rescue Migrator::MigrationNeededError
true
end | false |
Other | Homebrew | brew | 1b88c2912b9e0fb9b03580da3707ec36e2d0c888.json | formula: add new HEAD methods
* add `latest_head_version` to return latest HEAD version installed
* add `latest_head_prefix` to return Pathname with latest HEAD version
* add `head_version_outdated?` to check if HEAD version is up-to-date | Library/Homebrew/formula.rb | @@ -413,16 +413,36 @@ def linked_keg
Pathname.new("#{HOMEBREW_LIBRARY}/LinkedKegs/#{name}")
end
- def latest_head_prefix
+ def latest_head_version
head_versions = installed_prefixes.map do |pn|
pn_pkgversion = PkgVersion.parse(pn.basename.to_s)
pn_pkgversion if pn_pkgversion.head?
end.compact
- latest_head_version = head_versions.max_by do |pn_pkgversion|
+ head_versions.max_by do |pn_pkgversion|
[Tab.for_keg(prefix(pn_pkgversion)).source_modified_time, pn_pkgversion.revision]
end
- prefix(latest_head_version) if latest_head_version
+ end
+
+ def latest_head_prefix
+ head_version = latest_head_version
+ prefix(head_version) if head_version
+ end
+
+ def head_version_outdated?(version, options={})
+ tab = Tab.for_keg(prefix(version))
+
+ return true if stable && tab.stable_version && tab.stable_version < stable.version
+ return true if devel && tab.devel_version && tab.devel_version < devel.version
+
+ if options[:fetch_head]
+ return false unless head && head.downloader.is_a?(VCSDownloadStrategy)
+ downloader = head.downloader
+ downloader.shutup! unless ARGV.verbose?
+ downloader.commit_outdated?(version.version.commit)
+ else
+ false
+ end
end
# The latest prefix for this formula. Checks for {#head}, then {#devel} | false |
Other | Homebrew | brew | 5ddee3502e7c8dd67b1fec4de2f72df6fd16cc94.json | download_strategy: use short hash for mercurial | Library/Homebrew/download_strategy.rb | @@ -913,7 +913,7 @@ def source_modified_time
end
def last_commit
- Utils.popen_read("hg", "parent", "--template", "{node}", "-R", cached_location.to_s)
+ Utils.popen_read("hg", "parent", "--template", "{node|short}", "-R", cached_location.to_s)
end
private | false |
Other | Homebrew | brew | 1114219384baf0948cabcce8752a4537896f7704.json | Add tests for Tab versions | Library/Homebrew/test/fixtures/receipt.json | @@ -16,6 +16,11 @@
"source": {
"path": "/usr/local/Library/Taps/hombrew/homebrew-core/Formula/foo.rb",
"tap": "homebrew/core",
- "spec": "stable"
+ "spec": "stable",
+ "versions": {
+ "stable": "2.14",
+ "devel": "2.15",
+ "head": "HEAD-0000000"
+ }
}
} | true |
Other | Homebrew | brew | 1114219384baf0948cabcce8752a4537896f7704.json | Add tests for Tab versions | Library/Homebrew/test/test_tab.rb | @@ -20,6 +20,11 @@ def setup
"tap" => "homebrew/core",
"path" => nil,
"spec" => "stable",
+ "versions" => {
+ "stable" => "0.10",
+ "devel" => "0.14",
+ "head" => "HEAD-1111111",
+ }
})
end
@@ -35,6 +40,9 @@ def test_defaults
assert_nil tab.tap
assert_nil tab.time
assert_nil tab.HEAD
+ assert_nil tab.stable_version
+ assert_nil tab.devel_version
+ assert_nil tab.head_version
assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler
assert_nil tab.cxxstdlib.type
end
@@ -105,6 +113,9 @@ def test_from_file
assert_equal TEST_SHA1, tab.HEAD
assert_equal :clang, tab.cxxstdlib.compiler
assert_equal :libcxx, tab.cxxstdlib.type
+ assert_equal "2.14", tab.stable_version.to_s
+ assert_equal "2.15", tab.devel_version.to_s
+ assert_equal "HEAD-0000000", tab.head_version.to_s
end
def test_to_json
@@ -119,6 +130,9 @@ def test_to_json
assert_equal @tab.HEAD, tab.HEAD
assert_equal @tab.compiler, tab.compiler
assert_equal @tab.stdlib, tab.stdlib
+ assert_equal @tab.stable_version, tab.stable_version
+ assert_equal @tab.devel_version, tab.devel_version
+ assert_equal @tab.head_version, tab.head_version
end
def test_remap_deprecated_options | true |
Other | Homebrew | brew | d59f0f77a7513f85bb8f27dd81f2ee08a2ad7605.json | tests: fix fluctuations in test coverage (#647)
This basically started once our integration tests caused the overall
test time to raise above 10 minutes, causing some coverage data to be
dropped because SimpleCov believed it to be stale. | Library/Homebrew/test/.simplecov | @@ -7,6 +7,11 @@ SimpleCov.start do
coverage_dir File.expand_path("#{tests_path}/coverage")
root File.expand_path("#{tests_path}/..")
+ # We manage the result cache ourselves and the default of 10 minutes can be
+ # too low (particularly on Travis CI), causing results from some integration
+ # tests to be dropped. This causes random fluctuations in test coverage.
+ merge_timeout 86400
+
add_filter "/Homebrew/compat/"
add_filter "/Homebrew/test/"
add_filter "/Homebrew/vendor/" | false |
Other | Homebrew | brew | 65203bbd1ea4513b4db3b7ed151626e1338ae70a.json | test-bot: avoid duplicate coverage reports
When running on Travis CI, both the Linux and macOS build will send a
coverage report, causing them to be merged by Coveralls. This results
in inferior coverage due to the early stage of the Linux-specific tests
and is probably not what we want. Make sure we only send a report for
macOS (assuming we stick with a single macOS build in `.travis.yml`). | Library/Homebrew/dev-cmd/test-bot.rb | @@ -21,7 +21,8 @@
# as raw bytes instead of re-encoding in UTF-8.
# --fast: Don't install any packages, but run e.g. audit anyway.
# --keep-tmp: Keep temporary files written by main installs and tests that are run.
-# --no-pull Don't use `brew pull` when possible.
+# --no-pull: Don't use `brew pull` when possible.
+# --coverage: Generate coverage report and send it to Coveralls.
#
# --ci-master: Shortcut for Homebrew master branch CI options.
# --ci-pr: Shortcut for Homebrew pull request CI options.
@@ -661,14 +662,14 @@ def homebrew
if @tap.nil?
tests_args = []
- tests_args_coverage = []
+ tests_args_no_compat = []
if RUBY_TWO
tests_args << "--official-cmd-taps"
- tests_args_coverage << "--coverage" if ENV["TRAVIS"]
+ tests_args_no_compat << "--coverage" if ARGV.include?("--coverage")
end
test "brew", "tests", *tests_args
test "brew", "tests", "--generic", *tests_args
- test "brew", "tests", "--no-compat", *tests_args_coverage
+ test "brew", "tests", "--no-compat", *tests_args_no_compat
test "brew", "readall", "--syntax"
# TODO: try to fix this on Linux at some stage.
if OS.mac?
@@ -929,6 +930,13 @@ def sanitize_ARGV_and_ENV
ARGV << "--verbose"
ARGV << "--ci-master" if ENV["TRAVIS_PULL_REQUEST"] == "false"
ENV["HOMEBREW_VERBOSE_USING_DOTS"] = "1"
+
+ # Only report coverage if build runs on macOS and this is indeed Homebrew,
+ # as we don't want this to be averaged with inferior Linux test coverage.
+ repo = ENV["TRAVIS_REPO_SLUG"]
+ if repo && repo.start_with?("Homebrew/") && ENV["OSX"]
+ ARGV << "--coverage"
+ end
end
if ARGV.include?("--ci-master") || ARGV.include?("--ci-pr") \ | false |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/audit.rb | @@ -628,7 +628,8 @@ def audit_revision
fv = FormulaVersions.new(formula, :max_depth => 10)
revision_map = fv.revision_map("origin/master")
- if (revisions = revision_map[formula.version]).any?
+ revisions = revision_map[formula.version]
+ if !revisions.empty?
problem "revision should not decrease" if formula.revision < revisions.max
elsif formula.revision != 0
if formula.stable
@@ -644,7 +645,7 @@ def audit_revision
def audit_legacy_patches
return unless formula.respond_to?(:patches)
legacy_patches = Patch.normalize_legacy_patches(formula.patches).grep(LegacyPatch)
- if legacy_patches.any?
+ unless legacy_patches.empty?
problem "Use the patch DSL instead of defining a 'patches' method"
legacy_patches.each { |p| audit_patch(p) }
end | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/bottle.rb | @@ -58,10 +58,10 @@ def print_filename(string, filename)
next if Metafiles::EXTENSIONS.include? file.extname
linked_libraries = Keg.file_linked_libraries(file, string)
- result ||= linked_libraries.any?
+ result ||= !linked_libraries.empty?
if ARGV.verbose?
- print_filename(string, file) if linked_libraries.any?
+ print_filename(string, file) unless linked_libraries.empty?
linked_libraries.each do |lib|
puts " #{Tty.gray}-->#{Tty.reset} links to #{lib}"
end
@@ -83,7 +83,7 @@ def print_filename(string, filename)
end
end
- if ARGV.verbose? && text_matches.any?
+ if ARGV.verbose? && !text_matches.empty?
print_filename string, file
text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset|
puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
@@ -157,7 +157,7 @@ def bottle_formula(f)
versions = FormulaVersions.new(f)
bottle_revisions = versions.bottle_version_map("origin/master")[f.pkg_version]
bottle_revisions.pop if bottle_revisions.last.to_i > 0
- bottle_revision = bottle_revisions.any? ? bottle_revisions.max.to_i + 1 : 0
+ bottle_revision = bottle_revisions.empty? ? 0 : bottle_revisions.max.to_i + 1
end
filename = Bottle::Filename.create(f, Utils::Bottles.tag, bottle_revision)
@@ -287,7 +287,7 @@ def bottle_formula(f)
old_spec.send(field) != bottle.send(field)
end
bad_fields.delete(:cellar) if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation
- if bad_fields.any?
+ unless bad_fields.empty?
bottle_path.unlink if bottle_path.exist?
odie "--keep-old is passed but there are changes in: #{bad_fields.join ", "}"
end
@@ -387,7 +387,7 @@ def merge
next if key == "cellar" && old_value == "any" && value == "any_skip_relocation"
mismatches << key if old_value.empty? || value != old_value
end
- if mismatches.any?
+ unless mismatches.empty?
odie "--keep-old was passed but there were changes in #{mismatches.join(", ")}!"
end
output = bottle_output bottle | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/info.rb | @@ -118,22 +118,22 @@ def info_formula(f)
attrs << "pinned at #{f.pinned_version}" if f.pinned?
attrs << "keg-only" if f.keg_only?
- puts "#{f.full_name}: #{specs * ", "}#{" [#{attrs * ", "}]" if attrs.any?}"
+ puts "#{f.full_name}: #{specs * ", "}#{" [#{attrs * ", "}]" unless attrs.empty?}"
puts f.desc if f.desc
puts "#{Tty.em}#{f.homepage}#{Tty.reset}" if f.homepage
conflicts = f.conflicts.map(&:name).sort!
puts "Conflicts with: #{conflicts*", "}" unless conflicts.empty?
kegs = f.installed_kegs.sort_by(&:version)
- if kegs.any?
+ if kegs.empty?
+ puts "Not installed"
+ else
kegs.each do |keg|
puts "#{keg} (#{keg.abv})#{" *" if keg.linked?}"
tab = Tab.for_keg(keg).to_s
puts " #{tab}" unless tab.empty?
end
- else
- puts "Not installed"
end
puts "From: #{Tty.em}#{github_info(f)}#{Tty.reset}" | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/install.rb | @@ -82,7 +82,7 @@ def install
begin
formulae = []
- if ARGV.casks.any?
+ unless ARGV.casks.empty?
args = []
args << "--force" if ARGV.force?
args << "--debug" if ARGV.debug? | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/list.rb | @@ -28,7 +28,7 @@ def list
# Unbrewed uses the PREFIX, which will exist
# Things below use the CELLAR, which doesn't until the first formula is installed.
unless HOMEBREW_CELLAR.exist?
- raise NoSuchKegError.new(ARGV.named.first) if ARGV.named.any?
+ raise NoSuchKegError.new(ARGV.named.first) unless ARGV.named.empty?
return
end
| true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/outdated.rb | @@ -17,13 +17,17 @@
module Homebrew
def outdated
- formulae = ARGV.resolved_formulae.any? ? ARGV.resolved_formulae : Formula.installed
+ formulae = if ARGV.resolved_formulae.empty?
+ Formula.installed
+ else
+ ARGV.resolved_formulae
+ end
if ARGV.json == "v1"
outdated = print_outdated_json(formulae)
else
outdated = print_outdated(formulae)
end
- Homebrew.failed = ARGV.resolved_formulae.any? && outdated.any?
+ Homebrew.failed = !ARGV.resolved_formulae.empty? && !outdated.empty?
end
def print_outdated(formulae) | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/readall.rb | @@ -22,10 +22,10 @@ def readall
end
options = { :aliases => ARGV.include?("--aliases") }
- taps = if ARGV.named.any?
- [Tap.fetch(ARGV.named.first)]
- else
+ taps = if ARGV.named.empty?
Tap
+ else
+ [Tap.fetch(ARGV.named.first)]
end
taps.each do |tap|
Homebrew.failed = true unless Readall.valid_tap?(tap, options) | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/search.rb | @@ -89,7 +89,7 @@ def search
arg.include?(char) && !arg.start_with?("/")
end
end
- if ARGV.any? && bad_regex
+ if !ARGV.empty? && bad_regex
ohai "Did you mean to perform a regular expression search?"
ohai "Surround your query with /slashes/ to search by regex."
end | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/cmd/upgrade.rb | @@ -21,16 +21,16 @@ def upgrade
if ARGV.named.empty?
outdated = Formula.installed.select(&:outdated?)
exit 0 if outdated.empty?
- elsif ARGV.named.any?
+ else
outdated = ARGV.resolved_formulae.select(&:outdated?)
(ARGV.resolved_formulae - outdated).each do |f|
versions = f.installed_kegs.map { |keg| keg.version }
- if versions.any?
+ if versions.empty?
+ onoe "#{f.full_name} not installed"
+ else
version = versions.max
onoe "#{f.full_name} #{version} already installed"
- else
- onoe "#{f.full_name} not installed"
end
end
exit 1 if outdated.empty? | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -25,7 +25,7 @@ def inreplace_pairs(path, replacement_pairs)
end
contents.gsub!(old, new)
end
- if contents.errors.any?
+ unless contents.errors.empty?
raise Utils::InreplaceError, path => contents.errors
end
contents | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/dev-cmd/test-bot.rb | @@ -342,7 +342,7 @@ def diff_formulae(start_revision, end_revision, path, filter)
@name = "#{diff_start_sha1}-#{diff_end_sha1}"
end
# Handle formulae arguments being passed on the command-line e.g. `brew test-bot wget fish`.
- elsif @formulae && @formulae.any?
+ elsif @formulae && !@formulae.empty?
@name = "#{@formulae.first}-#{diff_end_sha1}"
diff_start_sha1 = diff_end_sha1
# Handle a hash being passed on the command-line e.g. `brew test-bot 1a2b3c`.
@@ -602,7 +602,7 @@ def formula(formula_name)
test "brew", "uninstall", "--force", formula_name
FileUtils.ln bottle_filename, HOMEBREW_CACHE/bottle_filename, :force => true
@formulae.delete(formula_name)
- if unchanged_build_dependencies.any?
+ unless unchanged_build_dependencies.empty?
test "brew", "uninstall", "--force", *unchanged_build_dependencies
unchanged_dependencies -= unchanged_build_dependencies
end
@@ -652,7 +652,7 @@ def formula(formula_name)
test "brew", "uninstall", "--devel", "--force", formula_name
end
end
- test "brew", "uninstall", "--force", *unchanged_dependencies if unchanged_dependencies.any?
+ test "brew", "uninstall", "--force", *unchanged_dependencies unless unchanged_dependencies.empty?
end
def homebrew | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/exceptions.rb | @@ -350,7 +350,7 @@ def dump
end
end
puts
- if RUBY_VERSION >= "1.8.7" && issues && issues.any?
+ if RUBY_VERSION >= "1.8.7" && issues && !issues.empty?
puts "These open issues may also help:"
puts issues.map { |i| "#{i["title"]} #{i["html_url"]}" }.join("\n")
end | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/formula.rb | @@ -998,7 +998,7 @@ def outdated_versions
# @private
def outdated?
- outdated_versions.any?
+ !outdated_versions.empty?
rescue Migrator::MigrationNeededError
true
end
@@ -1517,7 +1517,7 @@ def eligible_kegs_for_cleanup
installed_kegs.select { |k| pkg_version > k.version }
end
- if eligible_kegs.any?
+ unless eligible_kegs.empty?
eligible_kegs.each do |keg|
if keg.linked?
opoo "Skipping (old) #{keg} due to it being linked"
@@ -1526,7 +1526,7 @@ def eligible_kegs_for_cleanup
end
end
end
- elsif installed_prefixes.any? && !pinned?
+ elsif !installed_prefixes.empty? && !pinned?
# If the cellar only has one version installed, don't complain
# that we can't tell which one to keep. Don't complain at all if the
# only installed version is a pinned formula. | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/formula_pin.rb | @@ -31,7 +31,7 @@ def pinned?
end
def pinnable?
- @f.installed_prefixes.any?
+ !@f.installed_prefixes.empty?
end
def pinned_version | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/keg.rb | @@ -253,19 +253,19 @@ def completion_installed?(shell)
when :zsh then path.join("share", "zsh", "site-functions")
when :fish then path.join("share", "fish", "vendor_completions.d")
end
- dir && dir.directory? && dir.children.any?
+ dir && dir.directory? && !dir.children.empty?
end
def plist_installed?
- Dir["#{path}/*.plist"].any?
+ !Dir["#{path}/*.plist"].empty?
end
def python_site_packages_installed?
path.join("lib", "python2.7", "site-packages").directory?
end
def python_pth_files_installed?
- Dir["#{path}/lib/python2.7/site-packages/*.pth"].any?
+ !Dir["#{path}/lib/python2.7/site-packages/*.pth"].empty?
end
def apps | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/language/python.rb | @@ -131,8 +131,8 @@ def virtualenv_create(venv_root, python = "python", formula = self)
dep_site_packages = Formula[d.name].opt_lib/"python#{xy}/site-packages"
next unless dep_site_packages.exist?
"import site; site.addsitedir('#{dep_site_packages}')\n"
- end
- if pth_contents.any?
+ end.compact
+ unless pth_contents.empty?
(venv_root/"lib/python#{xy}/site-packages/homebrew_deps.pth").write pth_contents.join
end
| true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/software_spec.rb | @@ -77,7 +77,7 @@ def bottle_disable_reason
end
def bottle_defined?
- bottle_specification.collector.keys.any?
+ !bottle_specification.collector.keys.empty?
end
def bottled? | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/utils/github.rb | @@ -259,10 +259,10 @@ def print_pull_requests_matching(query)
open_or_closed_prs = issues_matching(query, :type => "pr")
open_prs = open_or_closed_prs.select { |i| i["state"] == "open" }
- if open_prs.any?
+ if !open_prs.empty?
puts "Open pull requests:"
prs = open_prs
- elsif open_or_closed_prs.any?
+ elsif !open_or_closed_prs.empty?
puts "Closed pull requests:"
prs = open_or_closed_prs
else | true |
Other | Homebrew | brew | a8566c9848122474b92fc8989eec196d5f4fb69b.json | various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)). | Library/Homebrew/utils/inreplace.rb | @@ -28,12 +28,12 @@ def inreplace(paths, before = nil, after = nil, audit_result = true)
s.gsub!(before, after, audit_result)
end
- errors[path] = s.errors if s.errors.any?
+ errors[path] = s.errors unless s.errors.empty?
Pathname(path).atomic_write(s)
end
- raise InreplaceError.new(errors) if errors.any?
+ raise InreplaceError.new(errors) unless errors.empty?
end
module_function :inreplace
end | true |
Other | Homebrew | brew | 4338f35b848ad61462fc4f73e1365e6c002201a2.json | tap: add cask methods. | Library/Homebrew/cmd/update-report.rb | @@ -193,7 +193,7 @@ def report
dst = Pathname.new paths.last
next unless dst.extname == ".rb"
- next unless paths.any? { |p| tap.formula_file?(p)}
+ next unless paths.any? { |p| tap.formula_file?(p) || tap.cask_file?(p)}
case status
when "A", "D" | true |
Other | Homebrew | brew | 4338f35b848ad61462fc4f73e1365e6c002201a2.json | tap: add cask methods. | Library/Homebrew/tap.rb | @@ -72,6 +72,7 @@ def initialize(user, repo)
def clear_cache
@remote = nil
@formula_dir = nil
+ @cask_dir = nil
@formula_files = nil
@alias_dir = nil
@alias_files = nil
@@ -304,6 +305,11 @@ def formula_dir
@formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?)
end
+ # path to the directory of all casks for caskroom/cask {Tap}.
+ def cask_dir
+ @cask_dir ||= path/"Casks"
+ end
+
# an array of all {Formula} files of this {Tap}.
def formula_files
@formula_files ||= if formula_dir
@@ -322,6 +328,15 @@ def formula_file?(file)
file.extname == ".rb" && file.parent == formula_dir
end
+ # return true if given path would present a cask file in this {Tap}.
+ # accepts both absolute path and relative path (relative to this {Tap}'s path)
+ # @private
+ def cask_file?(file)
+ file = Pathname.new(file) unless file.is_a? Pathname
+ file = file.expand_path(path)
+ file.extname == ".rb" && file.parent == cask_dir
+ end
+
# an array of all {Formula} names of this {Tap}.
def formula_names
@formula_names ||= formula_files.map { |f| formula_file_to_name(f) } | true |
Other | Homebrew | brew | a6033529cfdcfc6458aaa83a0bc9c4c141c60f96.json | Revert "tap: add cask methods."
This reverts commit 05daa0574732a7884bd158b2c3e14bd0709367da. | Library/Homebrew/tap.rb | @@ -72,7 +72,6 @@ def initialize(user, repo)
def clear_cache
@remote = nil
@formula_dir = nil
- @cask_dir = nil
@formula_files = nil
@alias_dir = nil
@alias_files = nil
@@ -305,11 +304,6 @@ def formula_dir
@formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?)
end
- # path to the directory of all casks for caskroom/cask {Tap}.
- def cask_dir
- @cask_dir ||= [path/"Casks", path].detect(&:directory?)
- end
-
# an array of all {Formula} files of this {Tap}.
def formula_files
@formula_files ||= if formula_dir
@@ -325,7 +319,7 @@ def formula_files
def formula_file?(file)
file = Pathname.new(file) unless file.is_a? Pathname
file = file.expand_path(path)
- file.extname == ".rb" && (file.parent == formula_dir || file.parent == cask_dir)
+ file.extname == ".rb" && file.parent == formula_dir
end
# an array of all {Formula} names of this {Tap}.
@@ -568,14 +562,6 @@ def formula_dir
end
end
- # @private
- def cask_dir
- @cask_dir ||= begin
- self.class.ensure_installed!
- super
- end
- end
-
# @private
def alias_dir
@alias_dir ||= begin | false |
Other | Homebrew | brew | 05daa0574732a7884bd158b2c3e14bd0709367da.json | tap: add cask methods.
Closes #562. | Library/Homebrew/tap.rb | @@ -72,6 +72,7 @@ def initialize(user, repo)
def clear_cache
@remote = nil
@formula_dir = nil
+ @cask_dir = nil
@formula_files = nil
@alias_dir = nil
@alias_files = nil
@@ -304,6 +305,11 @@ def formula_dir
@formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?)
end
+ # path to the directory of all casks for caskroom/cask {Tap}.
+ def cask_dir
+ @cask_dir ||= [path/"Casks", path].detect(&:directory?)
+ end
+
# an array of all {Formula} files of this {Tap}.
def formula_files
@formula_files ||= if formula_dir
@@ -319,7 +325,7 @@ def formula_files
def formula_file?(file)
file = Pathname.new(file) unless file.is_a? Pathname
file = file.expand_path(path)
- file.extname == ".rb" && file.parent == formula_dir
+ file.extname == ".rb" && (file.parent == formula_dir || file.parent == cask_dir)
end
# an array of all {Formula} names of this {Tap}.
@@ -562,6 +568,14 @@ def formula_dir
end
end
+ # @private
+ def cask_dir
+ @cask_dir ||= begin
+ self.class.ensure_installed!
+ super
+ end
+ end
+
# @private
def alias_dir
@alias_dir ||= begin | false |
Other | Homebrew | brew | 7a00f03c92607f65336be0285584e8351ad8a73a.json | utils: tell people to report deprecations to tap.
This should hopefully avoid Homebrew/brew or Homebrew/homebrew-core
having these exceptions reported to us. | Library/Homebrew/test/test_utils.rb | @@ -223,4 +223,17 @@ def test_truncate_text_to_approximate_size
s = truncate_text_to_approximate_size(long_s, n, :front_weight => 1.0)
assert_equal(("x" * (n - glue.length)) + glue, s)
end
+
+ def test_odeprecated
+ ARGV.stubs(:homebrew_developer?).returns false
+ e = assert_raises(FormulaMethodDeprecatedError) do
+ odeprecated("method", "replacement",
+ :caller => ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
+ :die => true)
+ end
+ assert_match "method", e.message
+ assert_match "replacement", e.message
+ assert_match "homebrew/homebrew-core", e.message
+ assert_match "homebrew/core", e.message
+ end
end | true |
Other | Homebrew | brew | 7a00f03c92607f65336be0285584e8351ad8a73a.json | utils: tell people to report deprecations to tap.
This should hopefully avoid Homebrew/brew or Homebrew/homebrew-core
having these exceptions reported to us. | Library/Homebrew/utils.rb | @@ -130,8 +130,13 @@ def odeprecated(method, replacement = nil, options = {})
# - Location outside of 'compat/'.
# - Location of caller of deprecated method (if all else fails).
backtrace = options.fetch(:caller, caller)
+ tap_message = nil
caller_message = backtrace.detect do |line|
- line.start_with?("#{HOMEBREW_LIBRARY}/Taps/")
+ if line =~ %r{^#{Regexp.escape HOMEBREW_LIBRARY}/Taps/([^/]+/[^/]+)/}
+ tap = Tap.fetch $1
+ tap_message = "\nPlease report this to the #{tap} tap!"
+ true
+ end
end
caller_message ||= backtrace.detect do |line|
!line.start_with?("#{HOMEBREW_LIBRARY_PATH}/compat/")
@@ -141,7 +146,7 @@ def odeprecated(method, replacement = nil, options = {})
message = <<-EOS.undent
Calling #{method} is #{verb}!
#{replacement_message}
- #{caller_message}
+ #{caller_message}#{tap_message}
EOS
if ARGV.homebrew_developer? || options[:die] | true |
Other | Homebrew | brew | 202f793d8a46bcc186740429af26ea14093d49f8.json | cleaner: kill unnecessary perl elements
We shouldn't be packaging either `perllocal.pod` or `.packlist` files. Both
are only really useful outside of package management. They get automatically
generated whenever you install a Perl module.
Debian, Arch, MacPorts & others remove them and we should have been as well
really; keeping them causes completely unnecessary conflicts between formulae. | Library/Homebrew/cleaner.rb | @@ -1,6 +1,8 @@
# Cleans a newly installed keg.
# By default:
# * removes .la files
+# * removes perllocal.pod files
+# * removes .packlist files
# * removes empty directories
# * sets permissions on executables
# * removes unresolved symlinks
@@ -89,6 +91,14 @@ def clean_dir(d)
next
elsif path.extname == ".la"
path.unlink
+ elsif path.basename.to_s == "perllocal.pod"
+ # Both this file & the .packlist one below are completely unnecessary
+ # to package & causes pointless conflict with other formulae. They are
+ # removed by Debian, Arch & MacPorts amongst other packagers as well.
+ # The files are created as part of installing any Perl module.
+ path.unlink
+ elsif path.basename.to_s == ".packlist" # Hidden file, not file extension!
+ path.unlink
else
# Set permissions for executables and non-executables
perms = if executable_path?(path) | false |
Other | Homebrew | brew | 0a33cc591d258e07f2279bc0440d62e38983fd67.json | utils: provide a better location in 'odeprecated'
Try to find a formula in the backtrace to make the warning message more
helpful in identifying the culprit, as the formula is not always the
immediate caller of a deprecated method. Provide some sane fallbacks if
there's not formula in the call stack. | Library/Homebrew/utils.rb | @@ -125,9 +125,18 @@ def odeprecated(method, replacement = nil, options = {})
"There is no replacement."
end
- # Show the first location that's not in compat.
- backtrace = options[:caller] || caller
- caller_message = backtrace[1]
+ # Try to show the most relevant location in message, i.e. (if applicable):
+ # - Location in a formula.
+ # - Location outside of 'compat/'.
+ # - Location of caller of deprecated method (if all else fails).
+ backtrace = options.fetch(:caller, caller)
+ caller_message = backtrace.detect do |line|
+ line.start_with?("#{HOMEBREW_LIBRARY}/Taps/")
+ end
+ caller_message ||= backtrace.detect do |line|
+ !line.start_with?("#{HOMEBREW_LIBRARY_PATH}/compat/")
+ end
+ caller_message ||= backtrace[1]
message = <<-EOS.undent
Calling #{method} is #{verb}!
@@ -136,7 +145,7 @@ def odeprecated(method, replacement = nil, options = {})
EOS
if ARGV.homebrew_developer? || options[:die]
- raise FormulaMethodDeprecatedError.new message
+ raise FormulaMethodDeprecatedError, message
else
opoo "#{message}\n"
end | false |
Other | Homebrew | brew | bc5b9c1e976121af04f8c80dc8794af96e0a1ae5.json | test-bot: fix non-OS X report generation. | Library/Homebrew/dev-cmd/test-bot.rb | @@ -40,6 +40,7 @@
require "rexml/cdata"
require "tap"
require "development_tools"
+require "utils/bottles"
module Homebrew
BYTES_IN_1_MEGABYTE = 1024*1024
@@ -994,7 +995,7 @@ def test_bot
tests.each do |test|
testsuite = testsuites.add_element "testsuite"
- testsuite.add_attribute "name", "brew-test-bot.#{MacOS.cat}"
+ testsuite.add_attribute "name", "brew-test-bot.#{Utils::Bottles.tag}"
testsuite.add_attribute "tests", test.steps.count
test.steps.each do |step| | false |
Other | Homebrew | brew | 80b68add133516e5c0bebc497c07dc0ed95bb68b.json | compat: add Rubocop file. | Library/Homebrew/compat/.rubocop.yml | @@ -0,0 +1,7 @@
+inherit_from: ../../.rubocop.yml
+
+# We won't change method or predicate names because of backward compatibility.
+Style/MethodName:
+ Enabled: false
+Style/PredicateName:
+ Enabled: false | false |
Other | Homebrew | brew | 569c80323b7b28028552e21759790b83f5b305b3.json | hardware: add ARM detection from Linuxbrew. | Library/Homebrew/hardware.rb | @@ -70,6 +70,10 @@ def ppc?
type == :ppc
end
+ def arm?
+ type == :arm
+ end
+
def features
[]
end | false |
Other | Homebrew | brew | 70a1ef5bdf113c18792197f361bf18c587ae7a9f.json | testing_env: add needs_python method. | Library/Homebrew/test/testing_env.rb | @@ -97,6 +97,10 @@ def needs_compat
skip "Requires compat/ code" if ENV["HOMEBREW_NO_COMPAT"]
end
+ def needs_python
+ skip "Requires Python" unless which("python")
+ end
+
def assert_nothing_raised
yield
end | false |
Other | Homebrew | brew | c90552f66bb174e3c0c69de88ce389acbedbac8b.json | tab: use the correct default compiler. | Library/Homebrew/tab.rb | @@ -140,7 +140,7 @@ def self.empty
"source_modified_time" => 0,
"HEAD" => nil,
"stdlib" => nil,
- "compiler" => "clang",
+ "compiler" => DevelopmentTools.default_compiler,
"source" => {
"path" => nil,
"tap" => nil, | false |
Other | Homebrew | brew | 1aded31fec4a98c2521bca685166f82a8d7d66c6.json | test_utils: remove unnecessary full paths. | Library/Homebrew/test/test_utils.rb | @@ -161,21 +161,21 @@ def test_shell_profile
end
def test_popen_read
- out = Utils.popen_read("/bin/sh", "-c", "echo success").chomp
+ out = Utils.popen_read("sh", "-c", "echo success").chomp
assert_equal "success", out
assert_predicate $?, :success?
end
def test_popen_read_with_block
- out = Utils.popen_read("/bin/sh", "-c", "echo success") do |pipe|
+ out = Utils.popen_read("sh", "-c", "echo success") do |pipe|
pipe.read.chomp
end
assert_equal "success", out
assert_predicate $?, :success?
end
def test_popen_write_with_block
- Utils.popen_write("/usr/bin/grep", "-q", "success") do |pipe|
+ Utils.popen_write("grep", "-q", "success") do |pipe|
pipe.write("success\n")
end
assert_predicate $?, :success? | false |
Other | Homebrew | brew | 97b6a3069ea909d2dc6987f49f3e47eeda7054b1.json | test: add default Linux x86_64 bottle. | Library/Homebrew/test/bottles/testball_bottle-0.1.linux_x86_64.bottle.tar.gz | @@ -0,0 +1 @@
+testball_bottle-0.1.yosemite.bottle.tar.gz
\ No newline at end of file | false |
Other | Homebrew | brew | 3318967609952420980e1f87f2c6a5eac061065f.json | os: fix Rubocop warnings. | Library/Homebrew/os.rb | @@ -1,23 +1,24 @@
module OS
def self.mac?
- /darwin/i === RUBY_PLATFORM && !ENV["HOMEBREW_TEST_GENERIC_OS"]
+ return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
+ RUBY_PLATFORM.to_s.downcase.include? "darwin"
end
def self.linux?
- /linux/i === RUBY_PLATFORM
+ RUBY_PLATFORM.to_s.downcase.include? "linux"
end
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
if OS.mac?
require "os/mac"
- ISSUES_URL = "https://git.io/brew-troubleshooting"
- PATH_OPEN = "/usr/bin/open"
+ ISSUES_URL = "https://git.io/brew-troubleshooting".freeze
+ PATH_OPEN = "/usr/bin/open".freeze
# compatibility
- ::MACOS_FULL_VERSION = OS::Mac.full_version.to_s
- ::MACOS_VERSION = OS::Mac.version.to_s
+ ::MACOS_FULL_VERSION = OS::Mac.full_version.to_s.freeze
+ ::MACOS_VERSION = OS::Mac.version.to_s.freeze
elsif OS.linux?
- ISSUES_URL = "https://github.com/Homebrew/linuxbrew/wiki/troubleshooting"
- PATH_OPEN = "xdg-open"
+ ISSUES_URL = "https://github.com/Homebrew/linuxbrew/wiki/troubleshooting".freeze
+ PATH_OPEN = "xdg-open".freeze
end
end | false |
Other | Homebrew | brew | 932e145d9c44ef6c9f828422bf1daef8f10baa6f.json | test-bot: run all tests in generic mode. | Library/Homebrew/dev-cmd/test-bot.rb | @@ -665,8 +665,7 @@ def homebrew
tests_args_coverage << "--coverage" if ENV["TRAVIS"]
end
test "brew", "tests", *tests_args
- test "brew", "tests", "--generic", "--only=integration_cmds",
- *tests_args
+ test "brew", "tests", "--generic", *tests_args
test "brew", "tests", "--no-compat", *tests_args_coverage
test "brew", "readall", "--syntax"
# test update from origin/master to current commit. | false |
Other | Homebrew | brew | 536c42f7e6214087812413177d8bcebf3ab04f6e.json | test_version_subclasses: make OS X specific. | Library/Homebrew/test/test_os_mac_version.rb | @@ -2,7 +2,7 @@
require "version"
require "os/mac/version"
-class MacOSVersionTests < Homebrew::TestCase
+class OSMacVersionTests < Homebrew::TestCase
def setup
@v = MacOS::Version.new("10.7")
end | false |
Other | Homebrew | brew | 08f68fc4dd6afc6c118ad631889c2a35e4e8d07e.json | test_x11_requirement: make OS X specific. | Library/Homebrew/test/test_os_mac_x11_requirement.rb | @@ -0,0 +1,13 @@
+require "testing_env"
+require "requirements/x11_requirement"
+
+class OSMacX11RequirementTests < Homebrew::TestCase
+ def test_satisfied
+ MacOS::XQuartz.stubs(:version).returns("2.7.5")
+ MacOS::XQuartz.stubs(:installed?).returns(true)
+ assert_predicate X11Requirement.new, :satisfied?
+
+ MacOS::XQuartz.stubs(:installed?).returns(false)
+ refute_predicate X11Requirement.new, :satisfied?
+ end
+end | true |
Other | Homebrew | brew | 08f68fc4dd6afc6c118ad631889c2a35e4e8d07e.json | test_x11_requirement: make OS X specific. | Library/Homebrew/test/test_x11_requirement.rb | @@ -28,13 +28,4 @@ def test_x_env
ENV.expects(:x11)
x.modify_build_environment
end
-
- def test_satisfied
- MacOS::XQuartz.stubs(:version).returns("2.7.5")
- MacOS::XQuartz.stubs(:installed?).returns(true)
- assert_predicate X11Requirement.new, :satisfied?
-
- MacOS::XQuartz.stubs(:installed?).returns(false)
- refute_predicate X11Requirement.new, :satisfied?
- end
end | true |
Other | Homebrew | brew | bdc1991d7792f495a540fe775da01f408cc4c640.json | utils/github: fix broken pipe error
Closes #573. | Library/Homebrew/utils/github.rb | @@ -52,11 +52,7 @@ def api_credentials
elsif ENV["HOMEBREW_GITHUB_API_USERNAME"] && ENV["HOMEBREW_GITHUB_API_PASSWORD"]
[ENV["HOMEBREW_GITHUB_API_USERNAME"], ENV["HOMEBREW_GITHUB_API_PASSWORD"]]
else
- github_credentials = Utils.popen("git credential-osxkeychain get", "w+") do |io|
- io.puts "protocol=https\nhost=github.com"
- io.close_write
- io.read
- end
+ github_credentials = api_credentials_from_keychain
github_username = github_credentials[/username=(.+)/, 1]
github_password = github_credentials[/password=(.+)/, 1]
if github_username && github_password
@@ -68,6 +64,20 @@ def api_credentials
end
end
+ def api_credentials_from_keychain
+ Utils.popen(["git", "credential-osxkeychain", "get"], "w+") do |pipe|
+ pipe.write "protocol=https\nhost=github.com\n"
+ pipe.close_write
+ pipe.read
+ end
+ rescue Errno::EPIPE
+ # The above invocation via `Utils.popen` can fail, causing the pipe to be
+ # prematurely closed (before we can write to it) and thus resulting in a
+ # broken pipe error. The root cause is usually a missing or malfunctioning
+ # `git-credential-osxkeychain` helper.
+ ""
+ end
+
def api_credentials_type
token, username = api_credentials
if token && !token.empty? | false |
Other | Homebrew | brew | 39453691ba3208dbd2e6ce1fd341d430b31dff55.json | tests: extend cmd_fail to all non-zero exit codes (#595) | Library/Homebrew/test/test_integration_cmds.rb | @@ -102,8 +102,8 @@ def cmd(*args)
def cmd_fail(*args)
output = cmd_output(*args)
status = $?.exitstatus
- $stderr.puts "\n#{output}" if status != 1
- assert_equal 1, status
+ $stderr.puts "\n#{output}" if status == 0
+ refute_equal 0, status
output
end
| false |
Other | Homebrew | brew | 2783adec4a906c8fb5c45aa1305b1460b5bc8a5b.json | Add helper class for Python virtualenvs | Library/Homebrew/language/python.rb | @@ -1,4 +1,5 @@
require "utils"
+require "language/python_virtualenv_constants"
module Language
module Python
@@ -96,5 +97,135 @@ def self.setup_install_args(prefix)
def self.package_available?(python, module_name)
quiet_system python, "-c", "import #{module_name}"
end
- end
-end
+
+ # Mixin module for {Formula} adding virtualenv support features.
+ module Virtualenv
+ def self.included(base)
+ base.class_eval do
+ resource "homebrew-virtualenv" do
+ url PYTHON_VIRTUALENV_URL
+ sha256 PYTHON_VIRTUALENV_SHA256
+ end
+ end
+ end
+
+ # Instantiates, creates, and yields a {Virtualenv} object for use from
+ # Formula#install, which provides helper methods for instantiating and
+ # installing packages into a Python virtualenv.
+ # @param venv_root [Pathname, String] the path to the root of the virtualenv
+ # (often `libexec/"venv"`)
+ # @param python [String] which interpreter to use (e.g. "python"
+ # or "python3")
+ # @param formula [Formula] the active Formula
+ # @return [Virtualenv] a {Virtualenv} instance
+ def virtualenv_create(venv_root, python = "python", formula = self)
+ venv = Virtualenv.new formula, venv_root, python
+ venv.create
+ venv
+ end
+
+ # Helper method for the common case of installing a Python application.
+ # Creates a virtualenv in `libexec`, installs all `resource`s defined
+ # on the formula, and then installs the formula.
+ def virtualenv_install_with_resources
+ venv = virtualenv_create(libexec)
+ venv.pip_install resources
+ venv.link_scripts(bin) { venv.pip_install buildpath }
+ venv
+ end
+
+ # Convenience wrapper for creating and installing packages into Python
+ # virtualenvs.
+ class Virtualenv
+ # Initializes a Virtualenv instance. This does not create the virtualenv
+ # on disk; {#create} does that.
+ # @param formula [Formula] the active Formula
+ # @param venv_root [Pathname, String] the path to the root of the
+ # virtualenv
+ # @param python [String] which interpreter to use; i.e. "python" or
+ # "python3"
+ def initialize(formula, venv_root, python)
+ @formula = formula
+ @venv_root = Pathname.new(venv_root)
+ @python = python
+ end
+
+ # Obtains a copy of the virtualenv library and creates a new virtualenv
+ # on disk.
+ # @return [void]
+ def create
+ return if (@venv_root/"bin/python").exist?
+
+ @formula.resource("homebrew-virtualenv").stage do |stage|
+ old_pythonpath = ENV.delete "PYTHONPATH"
+ begin
+ xy = Language::Python.major_minor_version(@python)
+ staging = Pathname.new(stage.staging.tmpdir)
+ ENV.prepend_create_path "PYTHONPATH", staging/"target/lib/python#{xy}/site-packages"
+ @formula.system @python, *Language::Python.setup_install_args(staging/"target")
+ @formula.system @python, "-s", staging/"target/bin/virtualenv", "-p", @python, @venv_root
+ ensure
+ ENV["PYTHONPATH"] = old_pythonpath
+ end
+ end
+
+ # Robustify symlinks to survive python3 patch upgrades
+ @venv_root.find do |f|
+ next unless f.symlink?
+ if (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR
+ python = rp.include?("python3") ? "python3" : "python"
+ new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
+ f.unlink
+ f.make_symlink new_target
+ end
+ end
+ end
+
+ # Installs packages represented by `targets` into the virtualenv.
+ # @param targets [String, Pathname, Resource,
+ # Array<String, Pathname, Resource>] (A) token(s) passed to pip
+ # representing the object to be installed. This can be a directory
+ # containing a setup.py, a {Resource} which will be staged and
+ # installed, or a package identifier to be fetched from PyPI.
+ # Multiline strings are allowed and treated as though they represent
+ # the contents of a `requirements.txt`.
+ # @return [void]
+ def pip_install(targets)
+ targets = [targets] unless targets.is_a? Array
+ targets.each do |t|
+ if t.respond_to? :stage
+ next if t.name == "homebrew-virtualenv"
+ t.stage { do_install Pathname.pwd }
+ else
+ t = t.lines.map(&:strip) if t.respond_to?(:lines) && t =~ /\n/
+ do_install t
+ end
+ end
+ end
+
+ # Compares the venv bin directory before and after executing a block,
+ # and symlinks any new scripts into `destination`.
+ # Use like: venv.link_scripts(bin) { venv.pip_install my_package }
+ # @param destination [Pathname, String] Destination into which new
+ # scripts should be linked.
+ # @return [void]
+ def link_scripts(destination)
+ bin_before = Dir[@venv_root/"bin/*"].to_set
+ yield
+ bin_after = Dir[@venv_root/"bin/*"].to_set
+ destination = Pathname.new(destination)
+ destination.install_symlink((bin_after - bin_before).to_a)
+ end
+
+ private
+
+ def do_install(targets)
+ targets = [targets] unless targets.is_a? Array
+ @formula.system @venv_root/"bin/pip", "install",
+ "-v", "--no-deps", "--no-binary", ":all:",
+ *targets
+ end
+ end # class Virtualenv
+ end # module Virtualenv
+ end # module Python
+end # module Language | true |
Other | Homebrew | brew | 2783adec4a906c8fb5c45aa1305b1460b5bc8a5b.json | Add helper class for Python virtualenvs | Library/Homebrew/language/python_virtualenv_constants.rb | @@ -0,0 +1,2 @@
+PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/5c/79/5dae7494b9f5ed061cff9a8ab8d6e1f02db352f3facf907d9eb614fb80e9/virtualenv-15.0.2.tar.gz"
+PYTHON_VIRTUALENV_SHA256 = "fab40f32d9ad298fba04a260f3073505a16d52539a84843cf8c8369d4fd17167" | true |
Other | Homebrew | brew | 157d461626007b22354a85cf463870f283f81fcb.json | README: add Contributing section.
Also, explicitly welcome new/beginner contributors and give them a suggested
starting point to contribute to Homebrew. Based on the boiler plate I tend to
send people to for GSoC, Outreachy or generally people who say "I want to try
and contribute to open-source". | README.md | @@ -16,6 +16,13 @@ Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/brew/bl
**If you don't read these it will take us far longer to help you with your problem.**
+## Contributing
+We'd love you to contribute to Homebrew. First, please read our [Contribution Guide](https://github.com/Homebrew/brew/blob/master/.github/CONTRIBUTING.md) and [Code of Conduct](https://github.com/Homebrew/brew/blob/master/CODEOFCONDUCT.md#code-of-conduct).
+
+We explicitly welcome contributions from people who have never contributed to open-source before: we were all beginners once! We can help build on a partially working pull request with the aim of getting it merged. We are also actively seeking to diversify our contributors and especially welcome contributions from women from all backgrounds and people of colour.
+
+A good starting point for contributing is running `brew audit` (or `brew audit --strict`) with some of the packages you use (e.g. `brew audit wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit` shows no results and [submit a pull request](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md). If no formulae you use have warnings you can run `brew audit` without arguments to have it run on all packages and pick one. Good luck!
+
## Security
Please report security issues to security@brew.sh.
| false |
Other | Homebrew | brew | 1455aa3da6335b1eeb284e61171cff524c620fa3.json | Fix spelling of penryn (#580)
penryn was misspelled, which led to me doing a fruitless code search for where the architecture stuff is set. | share/doc/homebrew/Bottles.md | @@ -9,7 +9,7 @@ Bottles will not be used if the user requests it (see above), if the formula req
## Bottle Creation
Bottles are currently created using the [Brew Test Bot](Brew-Test-Bot.md). We will be slowly adding them to all formulae.
-By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for. (That's Core 2 for 64-bit OSs, Core for 32-bit.) This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimized for something else, you can pass the `--bottle-arch=` option to build for another architecture - for example, `brew install foo --bottle-arch=penyrn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad!
+By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for. (That's Core 2 for 64-bit OSs, Core for 32-bit.) This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimized for something else, you can pass the `--bottle-arch=` option to build for another architecture - for example, `brew install foo --bottle-arch=penryn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad!
## Bottle Format
Bottles are simple gzipped tarballs of compiled binaries. Any metadata is stored in a formula's bottle DSL and in the bottle filename (i.e. MacOS version, revision). | false |
Other | Homebrew | brew | 265c1263494012d8e0e6cdd8b3522a664dde7aab.json | analytics.sh: use full uuidgen path on OS X.
Fixes #575. | Library/Homebrew/utils/analytics.sh | @@ -38,6 +38,9 @@ setup-analytics() {
if [[ -n "$HOMEBREW_LINUX" ]]
then
HOMEBREW_ANALYTICS_USER_UUID="$(tr a-f A-F < /proc/sys/kernel/random/uuid)"
+ elif [[ -n "$HOMEBREW_OSX" ]]
+ then
+ HOMEBREW_ANALYTICS_USER_UUID="$(/usr/bin/uuidgen)"
else
HOMEBREW_ANALYTICS_USER_UUID="$(uuidgen)"
fi | false |
Other | Homebrew | brew | 43dafc9859e415ac85c4a082b23ceadd5813c196.json | brew.rb: Use odie instead of onoe+exit
Closes #577.
Signed-off-by: Baptiste Fontaine <b@ptistefontaine.fr> | Library/Homebrew/brew.rb | @@ -107,8 +107,7 @@ def require?(path)
safe_system(*tap_commands)
exec HOMEBREW_BREW_FILE, cmd, *ARGV
else
- onoe "Unknown command: #{cmd}"
- exit 1
+ odie "Unknown command: #{cmd}"
end
end
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.