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 | f951a22beacdae7dd95c94eba67236fe221a3ca0.json | Install etc/var files on postinstall.
Also, don't delete them after that. This means that `brew postinstall`
becomes a way to easily reinstall configuration files for any formula
without needing any changes to any bottles or requiring a reinstall. | Library/Homebrew/formula.rb | @@ -1004,11 +1004,6 @@ def pour_bottle_check_unsatisfied_reason
# Can be overridden to run commands on both source and bottle installation.
def post_install; end
- # @private
- def post_install_defined?
- method(:post_install).owner == self.class
- end
-
# @private
def run_post_install
@prefix_returns_versioned_prefix = true
@@ -1025,6 +1020,11 @@ def run_post_install
ENV.clear_sensitive_environment!
+ Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path|
+ path.extend(InstallRenamed)
+ path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX)
+ end
+
with_logging("post_install") do
post_install
end | true |
Other | Homebrew | brew | f951a22beacdae7dd95c94eba67236fe221a3ca0.json | Install etc/var files on postinstall.
Also, don't delete them after that. This means that `brew postinstall`
becomes a way to easily reinstall configuration files for any formula
without needing any changes to any bottles or requiring a reinstall. | Library/Homebrew/formula_installer.rb | @@ -564,13 +564,11 @@ def finish
fix_dynamic_linkage(keg)
end
- if formula.post_install_defined?
- if build_bottle?
- ohai "Not running post_install as we're building a bottle"
- puts "You can run it manually using `brew postinstall #{formula.full_name}`"
- else
- post_install
- end
+ if build_bottle?
+ ohai "Not running post_install as we're building a bottle"
+ puts "You can run it manually using `brew postinstall #{formula.full_name}`"
+ else
+ post_install
end
caveats
@@ -832,12 +830,6 @@ def pour
skip_linkage = formula.bottle_specification.skip_relocation?
keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
- Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
- path.extend(InstallRenamed)
- path.cp_path_sub(formula.bottle_prefix, HOMEBREW_PREFIX)
- end
- FileUtils.rm_rf formula.bottle_prefix
-
tab = Tab.for_keg(keg)
CxxStdlib.check_compatibility( | true |
Other | Homebrew | brew | f951a22beacdae7dd95c94eba67236fe221a3ca0.json | Install etc/var files on postinstall.
Also, don't delete them after that. This means that `brew postinstall`
becomes a way to easily reinstall configuration files for any formula
without needing any changes to any bottles or requiring a reinstall. | Library/Homebrew/test/formula_spec.rb | @@ -10,7 +10,6 @@
RSpec::Matchers.alias_matcher :have_changed_alias, :be_alias_changed
RSpec::Matchers.alias_matcher :have_option_defined, :be_option_defined
-RSpec::Matchers.alias_matcher :have_post_install_defined, :be_post_install_defined
RSpec::Matchers.alias_matcher :have_test_defined, :be_test_defined
RSpec::Matchers.alias_matcher :pour_bottle, :be_pour_bottle
@@ -624,23 +623,6 @@ def options
expect(f.desc).to eq("a formula")
end
- specify "#post_install_defined?" do
- f1 = formula do
- url "foo-1.0"
-
- def post_install
- # do nothing
- end
- end
-
- f2 = formula do
- url "foo-1.0"
- end
-
- expect(f1).to have_post_install_defined
- expect(f2).not_to have_post_install_defined
- end
-
specify "#test_defined?" do
f1 = formula do
url "foo-1.0" | true |
Other | Homebrew | brew | 5b19563937bab44fb98648a8dabdb9dc930a0ac3.json | utils: create GEM_HOME when installing Gems.
It may not exist before Gem installation which means that the resulting
installed gem will not be found in the PATH. | Library/Homebrew/utils.rb | @@ -189,6 +189,9 @@ def install_gem_setup_path!(name, version = nil, executable = name)
Gem.clear_paths
Gem::Specification.reset
+ # Create GEM_HOME which may not exist yet so it exists when creating PATH.
+ FileUtils.mkdir_p Gem.bindir
+
# Add Gem binary directory and (if missing) Ruby binary directory to PATH.
path = PATH.new(ENV["PATH"])
path.prepend(RUBY_BIN) if which("ruby") != RUBY_PATH | false |
Other | Homebrew | brew | bf491e5102f52847ba93aad0dc0f2976f86395d6.json | audit_spec: add keg_only_style tests | Library/Homebrew/test/dev-cmd/audit_spec.rb | @@ -322,6 +322,69 @@ def caveats
.to eq(["Don't recommend setuid in the caveats, suggest sudo instead."])
end
+ describe "#audit_keg_only_style" do
+ specify "keg_only_needs_downcasing" do
+ fa = formula_auditor "foo", <<-EOS.undent, strict: true
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+
+ keg_only "Because why not"
+ end
+ EOS
+
+ fa.audit_keg_only_style
+ expect(fa.problems)
+ .to eq(["'Because' from the keg_only reason should be 'because'.\n"])
+ end
+
+ specify "keg_only_redundant_period" do
+ fa = formula_auditor "foo", <<-EOS.undent, strict: true
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+
+ keg_only "because this line ends in a period."
+ end
+ EOS
+
+ fa.audit_keg_only_style
+ expect(fa.problems)
+ .to eq(["keg_only reason should not end with a period."])
+ end
+
+ specify "keg_only_handles_block_correctly" do
+ fa = formula_auditor "foo", <<-EOS.undent, strict: true
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+
+ keg_only <<-EOF.undent
+ this line starts with a lowercase word.
+
+ This line does not but that shouldn't be a
+ problem
+ EOF
+ end
+ EOS
+
+ fa.audit_keg_only_style
+ expect(fa.problems)
+ .to eq([])
+ end
+
+ specify "keg_only_handles_whitelist_correctly" do
+ fa = formula_auditor "foo", <<-EOS.undent, strict: true
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+
+ keg_only "Apple ships foo in the CLT package"
+ end
+ EOS
+
+ fa.audit_keg_only_style
+ expect(fa.problems)
+ .to eq([])
+ end
+ end
+
describe "#audit_homepage" do
specify "homepage URLs" do
fa = formula_auditor "foo", <<-EOS.undent, online: true | false |
Other | Homebrew | brew | b8e17502a304b987268340611127907fe6e0a518.json | README: update hosting providers. | README.md | @@ -65,9 +65,7 @@ Our Xserve ESXi boxes for CI are hosted by [MacStadium](https://www.macstadium.c
[](https://www.macstadium.com)
-Our Mac Minis for CI were paid for by [our Kickstarter supporters](http://docs.brew.sh/Kickstarter-Supporters.html).
-
-Our Mac Minis for CI are hosted by [The Positive Internet Company](http://www.positive-internet.com).
+Our Jenkins CI installation is hosted by [DigitalOcean](https://m.do.co/c/7e39c35d5581).
Our bottles (binary packages) are hosted by [Bintray](https://bintray.com/homebrew).
| false |
Other | Homebrew | brew | ffe1ee1636bba266b2d8180300375dc1a86794cd.json | Install a bottle from an URL | Library/Homebrew/formulary.rb | @@ -105,7 +105,18 @@ def load_file
# Loads formulae from bottles.
class BottleLoader < FormulaLoader
def initialize(bottle_name)
- @bottle_filename = Pathname(bottle_name).realpath
+ case bottle_name
+ when %r{(https?|ftp|file)://}
+ # The name of the formula is found between the last slash and the last hyphen.
+ resource = Resource.new bottle_name[%r{([^/]+)-}, 1] { url bottle_name }
+ downloader = CurlBottleDownloadStrategy.new resource.name, resource
+ @bottle_filename = downloader.cached_location
+ cached = @bottle_filename.exist?
+ downloader.fetch
+ ohai "Pouring the cached bottle" if cached
+ else
+ @bottle_filename = Pathname(bottle_name).realpath
+ end
name, full_name = Utils::Bottles.resolve_formula_names @bottle_filename
super name, Formulary.path(full_name)
end
@@ -335,10 +346,10 @@ def self.path(ref)
def self.loader_for(ref, from: nil)
case ref
- when %r{(https?|ftp|file)://}
- return FromUrlLoader.new(ref)
when Pathname::BOTTLE_EXTNAME_RX
return BottleLoader.new(ref)
+ when %r{(https?|ftp|file)://}
+ return FromUrlLoader.new(ref)
when HOMEBREW_TAP_FORMULA_REGEX
return TapLoader.new(ref, from: from)
end | false |
Other | Homebrew | brew | 1be5eeec26000b881c2ec8ff53333266eedd9fff.json | Add test and comment for `PATH#existing`. | Library/Homebrew/PATH.rb | @@ -59,6 +59,7 @@ def empty?
def existing
existing_path = select(&File.method(:directory?))
+ # return nil instead of empty PATH, to unset environment variables
existing_path unless existing_path.empty?
end
| true |
Other | Homebrew | brew | 1be5eeec26000b881c2ec8ff53333266eedd9fff.json | Add test and comment for `PATH#existing`. | Library/Homebrew/test/PATH_spec.rb | @@ -107,5 +107,9 @@
expect(path.existing.to_ary).to eq(["/path1"])
expect(path.to_ary).to eq(["/path1", "/path2"])
end
+
+ it "returns nil instead of an empty #{described_class}" do
+ expect(described_class.new.existing).to be nil
+ end
end
end | true |
Other | Homebrew | brew | 1c7238e59ba49e8c86c9830fa43d4007d24f6e83.json | Add tests for `PATH#select` and `PATH#reject`. | Library/Homebrew/test/PATH_spec.rb | @@ -86,6 +86,18 @@
end
end
+ describe "#select" do
+ it "returns an object of the same class instead of an Array" do
+ expect(described_class.new.select { true }).to be_a(described_class)
+ end
+ end
+
+ describe "#reject" do
+ it "returns an object of the same class instead of an Array" do
+ expect(described_class.new.reject { true }).to be_a(described_class)
+ end
+ end
+
describe "#existing" do
it "returns a new PATH without non-existent paths" do
allow(File).to receive(:directory?).with("/path1").and_return(true) | false |
Other | Homebrew | brew | e70f2ec33233422b70db047338aa85d9e2088042.json | Make sure duplicates are remove from `PATH`. | Library/Homebrew/PATH.rb | @@ -4,12 +4,12 @@ def initialize(*paths)
end
def prepend(*paths)
- @paths.unshift(*parse(*paths))
+ @paths = parse(*paths, *@paths)
self
end
def append(*paths)
- @paths.concat(parse(*paths))
+ @paths = parse(*@paths, *paths)
self
end
| true |
Other | Homebrew | brew | e70f2ec33233422b70db047338aa85d9e2088042.json | Make sure duplicates are remove from `PATH`. | Library/Homebrew/test/PATH_spec.rb | @@ -13,6 +13,10 @@
it "splits an existing PATH" do
expect(described_class.new("/path1:/path2")).to eq(["/path1", "/path2"])
end
+
+ it "removes duplicates" do
+ expect(described_class.new("/path1", "/path1")).to eq("/path1")
+ end
end
describe "#to_ary" do
@@ -31,12 +35,20 @@
it "prepends a path to a PATH" do
expect(described_class.new("/path1").prepend("/path2").to_str).to eq("/path2:/path1")
end
+
+ it "removes duplicates" do
+ expect(described_class.new("/path1").prepend("/path1").to_str).to eq("/path1")
+ end
end
describe "#append" do
it "prepends a path to a PATH" do
expect(described_class.new("/path1").append("/path2").to_str).to eq("/path1:/path2")
end
+
+ it "removes duplicates" do
+ expect(described_class.new("/path1").append("/path1").to_str).to eq("/path1")
+ end
end
describe "#validate" do | true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/brew.rb | @@ -12,9 +12,9 @@
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
$:.unshift(HOMEBREW_LIBRARY_PATH.to_s)
require "global"
+require "tap"
if ARGV == %w[--version] || ARGV == %w[-v]
- require "tap"
puts "Homebrew #{HOMEBREW_VERSION}"
puts "Homebrew/homebrew-core #{CoreTap.instance.version_string}"
exit 0
@@ -47,13 +47,15 @@ def require?(path)
end
end
+ path = PATH.new(ENV["PATH"])
+
# Add contributed commands to PATH before checking.
- Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/cmd"].each do |tap_cmd_dir|
- ENV["PATH"] += "#{File::PATH_SEPARATOR}#{tap_cmd_dir}"
- end
+ path.append(Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd"))
# Add SCM wrappers.
- ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_SHIMS_PATH}/scm"
+ path.append(HOMEBREW_SHIMS_PATH/"scm")
+
+ ENV["PATH"] = path
if cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd) | true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/cmd/sh.rb | @@ -23,7 +23,7 @@ def sh
ENV.setup_build_environment
if superenv?
# superenv stopped adding brew's bin but generally users will want it
- ENV["PATH"] = ENV["PATH"].split(File::PATH_SEPARATOR).insert(1, "#{HOMEBREW_PREFIX}/bin").join(File::PATH_SEPARATOR)
+ ENV["PATH"] = PATH.new(PATH.new(ENV["PATH"]).to_a.insert(1, HOMEBREW_PREFIX/"bin"))
end
ENV["PS1"] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
ENV["VERBOSE"] = "1" | true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/diagnostic.rb | @@ -100,7 +100,7 @@ def check_for_installed_developer_tools
# See https://github.com/Homebrew/legacy-homebrew/pull/9986
def check_path_for_trailing_slashes
- all_paths = ENV["PATH"].split(File::PATH_SEPARATOR)
+ all_paths = PATH.new(ENV["PATH"]).to_a
bad_paths = all_paths.select { |p| p[-1..-1] == "/" }
return if bad_paths.empty?
| true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/extend/ENV/shared.rb | @@ -1,6 +1,7 @@
require "formula"
require "compilers"
require "development_tools"
+require "PATH"
# Homebrew extends Ruby's `ENV` to make our code more readable.
# Implemented in {SharedEnvExtension} and either {Superenv} or
@@ -80,7 +81,7 @@ def prepend(keys, value, separator = " ")
end
def append_path(key, path)
- append key, path, File::PATH_SEPARATOR if File.directory? path
+ self[key] = PATH.new(self[key]).append(path)
end
# Prepends a directory to `PATH`.
@@ -92,7 +93,7 @@ def append_path(key, path)
# (e.g. <pre>ENV.prepend_path "PATH", which("emacs").dirname</pre>)
def prepend_path(key, path)
return if %w[/usr/bin /bin /usr/sbin /sbin].include? path.to_s
- prepend key, path, File::PATH_SEPARATOR if File.directory? path
+ self[key] = PATH.new(self[key]).prepend(path)
end
def prepend_create_path(key, path)
@@ -196,7 +197,7 @@ def ncurses_define
# @private
def userpaths!
- paths = self["PATH"].split(File::PATH_SEPARATOR)
+ paths = PATH.new(self["PATH"]).to_a
# put Superenv.bin and opt path at the first
new_paths = paths.select { |p| p.start_with?("#{HOMEBREW_REPOSITORY}/Library/ENV", "#{HOMEBREW_PREFIX}/opt") }
# XXX hot fix to prefer brewed stuff (e.g. python) over /usr/bin.
@@ -211,7 +212,7 @@ def userpaths!
nil
end
end - %w[/usr/X11/bin /opt/X11/bin]
- self["PATH"] = new_paths.uniq.join(File::PATH_SEPARATOR)
+ self["PATH"] = PATH.new(new_paths.uniq)
end
def fortran
@@ -244,7 +245,7 @@ def fortran
else
if (gfortran = which("gfortran", (HOMEBREW_PREFIX/"bin").to_s))
ohai "Using Homebrew-provided fortran compiler."
- elsif (gfortran = which("gfortran", ORIGINAL_PATHS.join(File::PATH_SEPARATOR)))
+ elsif (gfortran = which("gfortran", PATH.new(ORIGINAL_PATHS)))
ohai "Using a fortran compiler found at #{gfortran}."
end
if gfortran | true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/extend/ENV/super.rb | @@ -104,7 +104,7 @@ def determine_path
path = PATH.new(Superenv.bin)
# Formula dependencies can override standard tools.
- path.append(deps.map { |d| d.opt_bin.to_s })
+ path.append(deps.map(&:opt_bin))
path.append(homebrew_extra_paths)
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
| true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/global.rb | @@ -56,7 +56,7 @@ def raise_deprecation_exceptions?
require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"]
ENV["HOMEBREW_PATH"] ||= ENV["PATH"]
-ORIGINAL_PATHS = ENV["HOMEBREW_PATH"].split(File::PATH_SEPARATOR).map do |p|
+ORIGINAL_PATHS = PATH.new(ENV["HOMEBREW_PATH"]).to_a.map do |p|
begin
Pathname.new(p).expand_path
rescue | true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/requirement.rb | @@ -96,7 +96,7 @@ def modify_build_environment
# PATH.
parent = satisfied_result_parent
return unless parent
- return if ENV["PATH"].split(File::PATH_SEPARATOR).include?(parent.to_s)
+ return if PATH.new(ENV["PATH"]).to_a.include?(parent.to_s)
ENV.append_path("PATH", parent)
end
@@ -151,11 +151,11 @@ def infer_name
end
def which(cmd)
- super(cmd, ORIGINAL_PATHS.join(File::PATH_SEPARATOR))
+ super(cmd, PATH.new(ORIGINAL_PATHS))
end
def which_all(cmd)
- super(cmd, ORIGINAL_PATHS.join(File::PATH_SEPARATOR))
+ super(cmd, PATH.new(ORIGINAL_PATHS))
end
class << self | true |
Other | Homebrew | brew | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.json | Use `PATH` where possible. | Library/Homebrew/utils.rb | @@ -293,7 +293,7 @@ def quiet_system(cmd, *args)
end
def which(cmd, path = ENV["PATH"])
- path.split(File::PATH_SEPARATOR).each do |p|
+ PATH.new(path).to_a.each do |p|
begin
pcmd = File.expand_path(cmd, p)
rescue ArgumentError
@@ -307,7 +307,7 @@ def which(cmd, path = ENV["PATH"])
end
def which_all(cmd, path = ENV["PATH"])
- path.to_s.split(File::PATH_SEPARATOR).map do |p|
+ PATH.new(path).to_a.map do |p|
begin
pcmd = File.expand_path(cmd, p)
rescue ArgumentError
@@ -416,7 +416,7 @@ def nostdout
end
def paths(env_path = ENV["PATH"])
- @paths ||= env_path.split(File::PATH_SEPARATOR).collect do |p|
+ @paths ||= PATH.new(env_path).to_a.collect do |p|
begin
File.expand_path(p).chomp("/")
rescue ArgumentError | true |
Other | Homebrew | brew | a16746906d463ce9e4dc129bc5a76b81585ee1dd.json | Add `PATH` class. | Library/Homebrew/PATH.rb | @@ -0,0 +1,61 @@
+class PATH
+ def initialize(*paths)
+ @paths = parse(*paths)
+ end
+
+ def prepend(*paths)
+ @paths.unshift(*parse(*paths))
+ self
+ end
+
+ def append(*paths)
+ @paths.concat(parse(*paths))
+ self
+ end
+
+ def to_ary
+ @paths
+ end
+ alias to_a to_ary
+
+ def to_str
+ @paths.join(File::PATH_SEPARATOR)
+ end
+ alias to_s to_str
+
+ def eql?(other)
+ if other.respond_to?(:to_ary)
+ return true if to_ary == other.to_ary
+ end
+
+ if other.respond_to?(:to_str)
+ return true if to_str == other.to_str
+ end
+
+ false
+ end
+ alias == eql?
+
+ def empty?
+ @paths.empty?
+ end
+
+ def inspect
+ "<PATH##{to_str}>"
+ end
+
+ def validate
+ self.class.new(@paths.select(&File.method(:directory?)))
+ end
+
+ private
+
+ def parse(*paths)
+ paths
+ .flatten
+ .flat_map { |p| p.respond_to?(:to_str) ? p.to_str.split(File::PATH_SEPARATOR): p }
+ .compact
+ .map { |p| p.respond_to?(:to_path) ? p.to_path : p.to_str }
+ .uniq
+ end
+end | true |
Other | Homebrew | brew | a16746906d463ce9e4dc129bc5a76b81585ee1dd.json | Add `PATH` class. | Library/Homebrew/global.rb | @@ -3,6 +3,7 @@
require "extend/pathname"
require "extend/git_repository"
require "extend/ARGV"
+require "PATH"
require "extend/string"
require "os"
require "utils" | true |
Other | Homebrew | brew | a16746906d463ce9e4dc129bc5a76b81585ee1dd.json | Add `PATH` class. | Library/Homebrew/test/PATH_spec.rb | @@ -0,0 +1,52 @@
+require "PATH"
+
+describe PATH do
+ describe "#initialize" do
+ it "can take multiple arguments" do
+ expect(described_class.new("/path1", "/path2")).to eq("/path1:/path2")
+ end
+
+ it "can parse a mix of arrays and arguments" do
+ expect(described_class.new(["/path1", "/path2"], "/path3")).to eq("/path1:/path2:/path3")
+ end
+
+ it "splits an existing PATH" do
+ expect(described_class.new("/path1:/path2")).to eq(["/path1", "/path2"])
+ end
+ end
+
+ describe "#to_ary" do
+ it "returns a PATH array" do
+ expect(described_class.new("/path1", "/path2").to_ary).to eq(["/path1", "/path2"])
+ end
+ end
+
+ describe "#to_str" do
+ it "returns a PATH string" do
+ expect(described_class.new("/path1", "/path2").to_str).to eq("/path1:/path2")
+ end
+ end
+
+ describe "#prepend" do
+ it "prepends a path to a PATH" do
+ expect(described_class.new("/path1").prepend("/path2").to_str).to eq("/path2:/path1")
+ end
+ end
+
+ describe "#append" do
+ it "prepends a path to a PATH" do
+ expect(described_class.new("/path1").append("/path2").to_str).to eq("/path1:/path2")
+ end
+ end
+
+ describe "#validate" do
+ it "returns a new PATH without non-existent paths" do
+ allow(File).to receive(:directory?).with("/path1").and_return(true)
+ allow(File).to receive(:directory?).with("/path2").and_return(false)
+
+ path = described_class.new("/path1", "/path2")
+ expect(path.validate.to_ary).to eq(["/path1"])
+ expect(path.to_ary).to eq(["/path1", "/path2"])
+ end
+ end
+end | true |
Other | Homebrew | brew | 7a75de7cb135cfa832acbf58819329cc19b0fe41.json | pull: fix status code check in check_bintray_mirror
The status code of the last redirect should be 2xx to be deemed successful. | Library/Homebrew/dev-cmd/pull.rb | @@ -608,7 +608,7 @@ def verify_bintray_published(formulae_names)
def check_bintray_mirror(name, url)
headers = curl_output("--connect-timeout", "15", "--head", url)[0]
status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
- return if status_code.start_with?("3")
+ return if status_code.start_with?("2")
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
opoo "Do you need to upload it with `brew mirror #{name}`?"
end | false |
Other | Homebrew | brew | 539881f51a69b1f5cf169766d1115c8b7343bd09.json | Taps and Forks: remove mailing list mention. | docs/Interesting-Taps-&-Forks.md | @@ -15,7 +15,7 @@ Homebrew has the capability to add (and remove) multiple taps to your local inst
`brew search` looks in these taps as well as in [homebrew/core](https://github.com/Homebrew/homebrew-core) so don't worry about missing stuff.
-You can be added as a maintainer for one of the Homebrew organization taps and aid the project! If you are interested write to our list: homebrew-discuss@googlegroups.com. We want your help!
+You can be added as a maintainer for one of the Homebrew organization taps and aid the project! If you are interested please feel free to ask in an issue or pull request after submitting multiple high-quality pull requests and We want your help!
## Other interesting taps
| false |
Other | Homebrew | brew | f02d7b93a79ccc71e1314f743e6cab19dff2b439.json | brew.sh: use OS X in user agent rather than macOS.
This matches what Safari does on macOS 10.12 and is generally what
tools like Google Analytics expect the format to be. | Library/Homebrew/brew.sh | @@ -100,7 +100,8 @@ then
# This is i386 even on x86_64 machines
[[ "$HOMEBREW_PROCESSOR" = "i386" ]] && HOMEBREW_PROCESSOR="Intel"
HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
- HOMEBREW_OS_VERSION="macOS $HOMEBREW_MACOS_VERSION"
+ # Don't change this from OS X to match what macOS itself does
+ HOMEBREW_OS_VERSION="OS X $HOMEBREW_MACOS_VERSION"
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" && | false |
Other | Homebrew | brew | 5647fdb2f9317d3b808a08b6ac711634e463ed75.json | audit: fix audit of new formulae.
When auditing new formulae without `--new-formula` the
`audit_revision_and_version_scheme` method fails ungracefully. Instead,
set some better defaults so fewer checks are needed.
Fixes #2551. | Library/Homebrew/dev-cmd/audit.rb | @@ -750,7 +750,7 @@ def audit_revision_and_version_scheme
current_version_scheme = formula.version_scheme
[:stable, :devel].each do |spec|
spec_version_scheme_map = attributes_map[:version_scheme][spec]
- next if spec_version_scheme_map.nil? || spec_version_scheme_map.empty?
+ next if spec_version_scheme_map.empty?
version_schemes = spec_version_scheme_map.values.flatten
max_version_scheme = version_schemes.max
@@ -783,28 +783,24 @@ def audit_revision_and_version_scheme
end
current_revision = formula.revision
- if formula.stable
- if revision_map = attributes_map[:revision][:stable]
- if !revision_map.nil? && !revision_map.empty?
- stable_revisions = revision_map[formula.stable.version]
- stable_revisions ||= []
- current_revision = formula.revision
- max_revision = stable_revisions.max || 0
-
- if current_revision < max_revision
- problem "revision should not decrease (from #{max_revision} to #{current_revision})"
- end
+ revision_map = attributes_map[:revision][:stable]
+ if formula.stable && !revision_map.empty?
+ stable_revisions = revision_map[formula.stable.version]
+ stable_revisions ||= []
+ max_revision = stable_revisions.max || 0
+
+ if current_revision < max_revision
+ problem "revision should not decrease (from #{max_revision} to #{current_revision})"
+ end
- stable_revisions -= [formula.revision]
- if !current_revision.zero? && stable_revisions.empty? &&
- revision_map.keys.length > 1
- problem "'revision #{formula.revision}' should be removed"
- elsif current_revision > 1 &&
- current_revision != max_revision &&
- !stable_revisions.include?(current_revision - 1)
- problem "revisions should only increment by 1"
- end
- end
+ stable_revisions -= [formula.revision]
+ if !current_revision.zero? && stable_revisions.empty? &&
+ revision_map.keys.length > 1
+ problem "'revision #{formula.revision}' should be removed"
+ elsif current_revision > 1 &&
+ current_revision != max_revision &&
+ !stable_revisions.include?(current_revision - 1)
+ problem "revisions should only increment by 1"
end
elsif !current_revision.zero? # head/devel-only formula
problem "'revision #{current_revision}' should be removed" | true |
Other | Homebrew | brew | 5647fdb2f9317d3b808a08b6ac711634e463ed75.json | audit: fix audit of new formulae.
When auditing new formulae without `--new-formula` the
`audit_revision_and_version_scheme` method fails ungracefully. Instead,
set some better defaults so fewer checks are needed.
Fixes #2551. | Library/Homebrew/formula_versions.rb | @@ -67,11 +67,17 @@ def version_attributes_map(attributes, branch)
attributes_map = {}
return attributes_map if attributes.empty?
+ attributes.each do |attribute|
+ attributes_map[attribute] ||= {
+ stable: {},
+ devel: {},
+ }
+ end
+
stable_versions_seen = 0
rev_list(branch) do |rev|
formula_at_revision(rev) do |f|
attributes.each do |attribute|
- attributes_map[attribute] ||= {}
map = attributes_map[attribute]
set_attribute_map(map, f, attribute)
@@ -89,12 +95,10 @@ def version_attributes_map(attributes, branch)
def set_attribute_map(map, f, attribute)
if f.stable
- map[:stable] ||= {}
map[:stable][f.stable.version] ||= []
map[:stable][f.stable.version] << f.send(attribute)
end
return unless f.devel
- map[:devel] ||= {}
map[:devel][f.devel.version] ||= []
map[:devel][f.devel.version] << f.send(attribute)
end | true |
Other | Homebrew | brew | 3589e24df03adc074081549229d8cc244643eee4.json | tap: fix env typo. | Library/Homebrew/tap.rb | @@ -527,7 +527,7 @@ def read_or_set_private_config
# A specialized {Tap} class for the core formulae
class CoreTap < Tap
def default_remote
- if OS.mac? || ENV["$HOMEBREW_FORCE_HOMEBREW_ORG"]
+ if OS.mac? || ENV["HOMEBREW_FORCE_HOMEBREW_ORG"]
"https://github.com/Homebrew/homebrew-core".freeze
else
"https://github.com/Linuxbrew/homebrew-core".freeze | false |
Other | Homebrew | brew | b2a291529d0878a51e3e082c3668c54abdbff6c1.json | audit: fix use of search_tap method.
This was removed in #2540 but this call site was note updated to use
the `search_taps` method instead. | Library/Homebrew/dev-cmd/audit.rb | @@ -368,11 +368,11 @@ def audit_formula_name
same_name_tap_formulae = @@local_official_taps_name_map[name] || []
if @online
- @@remote_official_taps ||= OFFICIAL_TAPS - Tap.select(&:official?).map(&:repo)
-
- same_name_tap_formulae += @@remote_official_taps.map do |tap|
- Thread.new { Homebrew.search_tap "homebrew", tap, name }
- end.flat_map(&:value)
+ Homebrew.search_taps(name).each do |tap_formula_full_name|
+ tap_formula_name = tap_formula_full_name.split("/").last
+ next if tap_formula_name != name
+ same_name_tap_formulae << tap_formula_full_name
+ end
end
same_name_tap_formulae.delete(full_name) | false |
Other | Homebrew | brew | 133e5ddf6ad1b7c931f4686922ba4d61ea450f3a.json | Remove unnecessary block. | Library/Homebrew/utils/github.rb | @@ -234,7 +234,7 @@ def issues_matching(query, qualifiers = {})
end
def repository(user, repo)
- open(URI.parse("#{API_URL}/repos/#{user}/#{repo}")) { |j| j }
+ open(URI.parse("#{API_URL}/repos/#{user}/#{repo}"))
end
def search_code(*params) | false |
Other | Homebrew | brew | 238cd5430f47895ef930756f2c3fb8b770a89f46.json | Add remote search to `brew cask search`. | Library/Homebrew/cask/lib/hbc/cli/search.rb | @@ -13,6 +13,15 @@ def self.extract_regexp(string)
end
end
+ def self.search_remote(query)
+ matches = GitHub.search_code("user:caskroom", "path:Casks", "filename:#{query}", "extension:rb")
+ [*matches].map do |match|
+ tap = Tap.fetch(match["repository"]["full_name"])
+ next if tap.installed?
+ "#{tap.name}/#{File.basename(match["path"], ".rb")}"
+ end.compact
+ end
+
def self.search(*arguments)
exact_match = nil
partial_matches = []
@@ -29,27 +38,34 @@ def self.search(*arguments)
partial_matches = simplified_tokens.grep(/#{simplified_search_term}/i) { |t| all_tokens[simplified_tokens.index(t)] }
partial_matches.delete(exact_match)
end
- [exact_match, partial_matches, search_term]
+
+ remote_matches = search_remote(search_term)
+
+ [exact_match, partial_matches, remote_matches, search_term]
end
- def self.render_results(exact_match, partial_matches, search_term)
+ def self.render_results(exact_match, partial_matches, remote_matches, search_term)
if !exact_match && partial_matches.empty?
puts "No Cask found for \"#{search_term}\"."
return
end
if exact_match
- ohai "Exact match"
+ ohai "Exact Match"
puts highlight_installed exact_match
end
- return if partial_matches.empty?
-
- if extract_regexp search_term
- ohai "Regexp matches"
- else
- ohai "Partial matches"
+ unless partial_matches.empty?
+ if extract_regexp search_term
+ ohai "Regexp Matches"
+ else
+ ohai "Partial Matches"
+ end
+ puts Formatter.columns(partial_matches.map(&method(:highlight_installed)))
end
- puts Formatter.columns(partial_matches.map(&method(:highlight_installed)))
+
+ return if remote_matches.empty?
+ ohai "Remote Matches"
+ puts Formatter.columns(remote_matches.map(&method(:highlight_installed)))
end
def self.highlight_installed(token) | true |
Other | Homebrew | brew | 238cd5430f47895ef930756f2c3fb8b770a89f46.json | Add remote search to `brew cask search`. | Library/Homebrew/test/cask/cli/search_spec.rb | @@ -3,7 +3,7 @@
expect {
Hbc::CLI::Search.run("local")
}.to output(<<-EOS.undent).to_stdout
- ==> Partial matches
+ ==> Partial Matches
local-caffeine
local-transmission
EOS
@@ -42,13 +42,13 @@
it "accepts a regexp argument" do
expect {
Hbc::CLI::Search.run("/^local-c[a-z]ffeine$/")
- }.to output("==> Regexp matches\nlocal-caffeine\n").to_stdout
+ }.to output("==> Regexp Matches\nlocal-caffeine\n").to_stdout
end
it "Returns both exact and partial matches" do
expect {
Hbc::CLI::Search.run("test-opera")
- }.to output(/^==> Exact match\ntest-opera\n==> Partial matches\ntest-opera-mail/).to_stdout
+ }.to output(/^==> Exact Match\ntest-opera\n==> Partial Matches\ntest-opera-mail/).to_stdout
end
it "does not search the Tap name" do | true |
Other | Homebrew | brew | b3c69aba87f21bb2a3b6a78de3328e22fe39e1c6.json | search: use single HTTP call for tap searches.
Use GitHub's code search API to search using the filename based on the
search query. This means we only need a single HTTP call and no more
multithreading madness. This also means we're able to search everything
in the Homebrew and Caskroom organisation by default without having to
maintain a list of things to search (and not) in here. | Library/Homebrew/cmd/search.rb | @@ -16,15 +16,12 @@
require "formula"
require "missing_formula"
require "utils"
-require "thread"
require "official_taps"
require "descriptions"
module Homebrew
module_function
- SEARCH_ERROR_QUEUE = Queue.new
-
def search
if ARGV.empty?
puts Formatter.columns(Formula.full_names)
@@ -61,8 +58,8 @@ def search
regex = query_regexp(query)
local_results = search_formulae(regex)
puts Formatter.columns(local_results) unless local_results.empty?
- tap_results = search_taps(regex)
- puts Formatter.columns(tap_results) unless tap_results.empty?
+ tap_results = search_taps(query)
+ puts Formatter.columns(tap_results) if tap_results && !tap_results.empty?
if $stdout.tty?
count = local_results.length + tap_results.length
@@ -75,34 +72,25 @@ def search
puts reason
elsif count.zero?
puts "No formula found for #{query.inspect}."
- begin
- GitHub.print_pull_requests_matching(query)
- rescue GitHub::Error => e
- SEARCH_ERROR_QUEUE << e
- end
+ GitHub.print_pull_requests_matching(query)
end
end
end
- if $stdout.tty?
- metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ?]
- bad_regex = metacharacters.any? do |char|
- ARGV.any? do |arg|
- arg.include?(char) && !arg.start_with?("/")
- end
- end
- 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."
+ return unless $stdout.tty?
+ return if ARGV.empty?
+ metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ?].freeze
+ return unless metacharacters.any? do |char|
+ ARGV.any? do |arg|
+ arg.include?(char) && !arg.start_with?("/")
end
end
-
- raise SEARCH_ERROR_QUEUE.pop unless SEARCH_ERROR_QUEUE.empty?
+ ohai <<-EOS.undent
+ Did you mean to perform a regular expression search?
+ Surround your query with /slashes/ to search locally by regex.
+ EOS
end
- SEARCHABLE_TAPS = OFFICIAL_TAPS.map { |tap| ["Homebrew", tap] } +
- OFFICIAL_CASK_TAPS.map { |tap| ["caskroom", tap] }
-
def query_regexp(query)
case query
when %r{^/(.*)/$} then Regexp.new($1)
@@ -112,53 +100,22 @@ def query_regexp(query)
odie "#{query} is not a valid regex"
end
- def search_taps(regex_or_string)
- SEARCHABLE_TAPS.map do |user, repo|
- Thread.new { search_tap(user, repo, regex_or_string) }
- end.inject([]) do |results, t|
- results.concat(t.value)
- end
- end
-
- def search_tap(user, repo, regex_or_string)
- regex = regex_or_string.is_a?(String) ? /^#{Regexp.escape(regex_or_string)}$/ : regex_or_string
-
- if (HOMEBREW_LIBRARY/"Taps/#{user.downcase}/homebrew-#{repo.downcase}").directory? && \
- user != "caskroom"
- return []
+ def search_taps(query)
+ valid_dirnames = ["Formula", "HomebrewFormula", "Casks", ".", ""].freeze
+ q = "user:Homebrew%20user:caskroom%20filename:#{query}"
+ GitHub.open "https://api.github.com/search/code?q=#{q}" do |json|
+ json["items"].map do |object|
+ dirname, filename = File.split(object["path"])
+ next unless valid_dirnames.include?(dirname)
+ user = object["repository"]["owner"]["login"]
+ user = user.downcase if user == "Homebrew"
+ repo = object["repository"]["name"].sub(/^homebrew-/, "")
+ tap = Tap.fetch user, repo
+ next if tap.installed?
+ basename = File.basename(filename, ".rb")
+ "#{user}/#{repo}/#{basename}"
+ end.compact
end
-
- remote_tap_formulae = Hash.new do |cache, key|
- user, repo = key.split("/", 2)
- tree = {}
-
- GitHub.open "https://api.github.com/repos/#{user}/homebrew-#{repo}/git/trees/HEAD?recursive=1" do |json|
- json["tree"].each do |object|
- next unless object["type"] == "blob"
-
- subtree, file = File.split(object["path"])
-
- if File.extname(file) == ".rb"
- tree[subtree] ||= []
- tree[subtree] << file
- end
- end
- end
-
- paths = tree["Formula"] || tree["HomebrewFormula"] || tree["."] || []
- paths += tree["Casks"] || []
- cache[key] = paths.map { |path| File.basename(path, ".rb") }
- end
-
- names = remote_tap_formulae["#{user}/#{repo}"]
- user = user.downcase if user == "Homebrew" # special handling for the Homebrew organization
- names.select { |name| name =~ regex }.map { |name| "#{user}/#{repo}/#{name}" }
- rescue GitHub::HTTPNotFoundError
- opoo "Failed to search tap: #{user}/#{repo}. Please run `brew update`"
- []
- rescue GitHub::Error => e
- SEARCH_ERROR_QUEUE << e
- []
end
def search_formulae(regex) | true |
Other | Homebrew | brew | b3c69aba87f21bb2a3b6a78de3328e22fe39e1c6.json | search: use single HTTP call for tap searches.
Use GitHub's code search API to search using the filename based on the
search query. This means we only need a single HTTP call and no more
multithreading madness. This also means we're able to search everything
in the Homebrew and Caskroom organisation by default without having to
maintain a list of things to search (and not) in here. | Library/Homebrew/test/cmd/search_remote_tap_spec.rb | @@ -1,19 +1,24 @@
require "cmd/search"
describe Homebrew do
- specify "#search_tap" do
+ specify "#search_taps" do
json_response = {
- "tree" => [
+ "items" => [
{
- "path" => "Formula/not-a-formula.rb",
- "type" => "blob",
+ "path" => "Formula/some-formula.rb",
+ "repository" => {
+ "name" => "homebrew-foo",
+ "owner" => {
+ "login" => "Homebrew",
+ },
+ },
},
],
}
allow(GitHub).to receive(:open).and_yield(json_response)
- expect(described_class.search_tap("homebrew", "not-a-tap", "not-a-formula"))
- .to eq(["homebrew/not-a-tap/not-a-formula"])
+ expect(described_class.search_taps("some-formula"))
+ .to match(["homebrew/foo/some-formula"])
end
end | true |
Other | Homebrew | brew | 3585dfd9bd84005ba20e4a97802dea13fb82c63e.json | remove inner group | Library/Homebrew/version.rb | @@ -346,7 +346,7 @@ def self._parse(spec)
# date-based versioning
# e.g. ltopers-v2017-04-14.tar.gz
- m = /-v?(?:\d{4}-\d{2}-\d{2})/.match(stem)
+ m = /-v?(\d{4}-\d{2}-\d{2})/.match(stem)
return m.captures.first unless m.nil?
# e.g. lame-398-1 | false |
Other | Homebrew | brew | 17aa90a2c591d922b293a73bdf68e0bfeb0e1301.json | remove inner uncaptured group | Library/Homebrew/version.rb | @@ -346,7 +346,7 @@ def self._parse(spec)
# date-based versioning
# e.g. ltopers-v2017-04-14.tar.gz
- m = /-v?((?:\d{4}-\d{2}-\d{2}))/.match(stem)
+ m = /-v?(?:\d{4}-\d{2}-\d{2})/.match(stem)
return m.captures.first unless m.nil?
# e.g. lame-398-1 | false |
Other | Homebrew | brew | e8ef50d0750b8e3b36427e2fc8878fbcd6f3f443.json | readall: fix tapping taps without aliases.
Fixes https://github.com/caskroom/homebrew-cask/issues/32840.
Fixes https://github.com/Homebrew/brew/issues/2529. | Library/Homebrew/readall.rb | @@ -25,7 +25,7 @@ def valid_ruby_syntax?(ruby_files)
end
def valid_aliases?(alias_dir, formula_dir)
- return false unless alias_dir.directory?
+ return true unless alias_dir.directory?
failed = false
alias_dir.each_child do |f| | false |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/dev-cmd/mirror.rb | @@ -8,10 +8,10 @@ module Homebrew
def mirror
odie "This command requires at least formula argument!" if ARGV.named.empty?
- bintray_user = ENV["BINTRAY_USER"]
- bintray_key = ENV["BINTRAY_KEY"]
+ bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
+ bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
if !bintray_user || !bintray_key
- raise "Missing BINTRAY_USER or BINTRAY_KEY variables!"
+ raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!"
end
ARGV.formulae.each do |f| | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/dev-cmd/pull.rb | @@ -263,7 +263,7 @@ def publish_changed_formula_bottles(_tap, changed_formulae_names)
end
published = []
- bintray_creds = { user: ENV["BINTRAY_USER"], key: ENV["BINTRAY_KEY"] }
+ bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] }
if bintray_creds[:user] && bintray_creds[:key]
changed_formulae_names.each do |name|
f = Formula[name]
@@ -272,7 +272,7 @@ def publish_changed_formula_bottles(_tap, changed_formulae_names)
published << f.full_name
end
else
- opoo "You must set BINTRAY_USER and BINTRAY_KEY to add or update bottles on Bintray!"
+ opoo "You must set HOMEBREW_BINTRAY_USER and HOMEBREW_BINTRAY_KEY to add or update bottles on Bintray!"
end
published
end | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/diagnostic.rb | @@ -439,7 +439,7 @@ def check_user_path_1
message = ""
- paths.each do |p|
+ paths(ENV["HOMEBREW_PATH"]).each do |p|
case p
when "/usr/bin"
unless $seen_prefix_bin
@@ -609,7 +609,7 @@ def check_for_config_scripts
/Applications/Server.app/Contents/ServerRoot/usr/sbin
].map(&:downcase)
- paths.each do |p|
+ paths(ENV["HOMEBREW_PATH"]).each do |p|
next if whitelist.include?(p.downcase) || !File.directory?(p)
realpath = Pathname.new(p).realpath.to_s | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/extend/ENV.rb | @@ -26,6 +26,13 @@ def with_build_environment
ensure
replace(old_env)
end
+
+ def clear_sensitive_environment!
+ ENV.keys.each do |key|
+ next unless /(cookie|key|token)/i =~ key
+ ENV.delete key
+ end
+ end
end
ENV.extend(EnvActivation) | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/formula.rb | @@ -13,6 +13,7 @@
require "tap"
require "keg"
require "migrator"
+require "extend/ENV"
# A formula provides instructions and metadata for Homebrew to install a piece
# of software. Every Homebrew formula is a {Formula}.
@@ -1013,10 +1014,17 @@ def run_post_install
@prefix_returns_versioned_prefix = true
build = self.build
self.build = Tab.for_formula(self)
+
old_tmpdir = ENV["TMPDIR"]
old_temp = ENV["TEMP"]
old_tmp = ENV["TMP"]
+ old_path = ENV["HOMEBREW_PATH"]
+
ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP
+ ENV["HOMEBREW_PATH"] = nil
+
+ ENV.clear_sensitive_environment!
+
with_logging("post_install") do
post_install
end
@@ -1025,6 +1033,7 @@ def run_post_install
ENV["TMPDIR"] = old_tmpdir
ENV["TEMP"] = old_temp
ENV["TMP"] = old_tmp
+ ENV["HOMEBREW_PATH"] = old_path
@prefix_returns_versioned_prefix = false
end
@@ -1664,9 +1673,15 @@ def run_test
old_temp = ENV["TEMP"]
old_tmp = ENV["TMP"]
old_term = ENV["TERM"]
+ old_path = ENV["HOMEBREW_PATH"]
+
ENV["CURL_HOME"] = old_curl_home || old_home
ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP
ENV["TERM"] = "dumb"
+ ENV["HOMEBREW_PATH"] = nil
+
+ ENV.clear_sensitive_environment!
+
mktemp("#{name}-test") do |staging|
staging.retain! if ARGV.keep_tmp?
@testpath = staging.tmpdir
@@ -1689,6 +1704,7 @@ def run_test
ENV["TEMP"] = old_temp
ENV["TMP"] = old_tmp
ENV["TERM"] = old_term
+ ENV["HOMEBREW_PATH"] = old_path
@prefix_returns_versioned_prefix = false
end
@@ -1925,17 +1941,24 @@ def stage
mkdir_p env_home
old_home = ENV["HOME"]
- ENV["HOME"] = env_home
old_curl_home = ENV["CURL_HOME"]
+ old_path = ENV["HOMEBREW_PATH"]
+
+ ENV["HOME"] = env_home
ENV["CURL_HOME"] = old_curl_home || old_home
+ ENV["HOMEBREW_PATH"] = nil
+
setup_home env_home
+ ENV.clear_sensitive_environment!
+
begin
yield staging
ensure
@buildpath = nil
ENV["HOME"] = old_home
ENV["CURL_HOME"] = old_curl_home
+ ENV["HOMEBREW_PATH"] = old_path
end
end
end | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/global.rb | @@ -53,7 +53,7 @@ def raise_deprecation_exceptions?
require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"]
-ORIGINAL_PATHS = ENV["PATH"].split(File::PATH_SEPARATOR).map do |p|
+ORIGINAL_PATHS = ENV["HOMEBREW_PATH"].split(File::PATH_SEPARATOR).map do |p|
begin
Pathname.new(p).expand_path
rescue | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/test/diagnostic_spec.rb | @@ -122,8 +122,9 @@
specify "#check_user_path_3" do
begin
sbin = HOMEBREW_PREFIX/"sbin"
- ENV["PATH"] = "#{HOMEBREW_PREFIX}/bin#{File::PATH_SEPARATOR}" +
- ENV["PATH"].gsub(/(?:^|#{Regexp.escape(File::PATH_SEPARATOR)})#{Regexp.escape(sbin)}/, "")
+ ENV["HOMEBREW_PATH"] =
+ "#{HOMEBREW_PREFIX}/bin#{File::PATH_SEPARATOR}" +
+ ENV["HOMEBREW_PATH"].gsub(/(?:^|#{Regexp.escape(File::PATH_SEPARATOR)})#{Regexp.escape(sbin)}/, "")
(sbin/"something").mkpath
expect(subject.check_user_path_1).to be nil
@@ -149,7 +150,9 @@
file = "#{path}/foo-config"
FileUtils.touch file
FileUtils.chmod 0755, file
- ENV["PATH"] = "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}"
+ ENV["HOMEBREW_PATH"] =
+ ENV["PATH"] =
+ "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}"
expect(subject.check_for_config_scripts)
.to match('"config" scripts exist') | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb | @@ -72,6 +72,7 @@ def brew(*args)
env.merge!(
"PATH" => path,
+ "HOMEBREW_PATH" => path,
"HOMEBREW_BREW_FILE" => HOMEBREW_PREFIX/"bin/brew",
"HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR, | true |
Other | Homebrew | brew | d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.json | Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrewβs userβs
PATH for e.g. `brew doctor` etc. | Library/Homebrew/utils.rb | @@ -406,8 +406,8 @@ def nostdout
end
end
-def paths
- @paths ||= ENV["PATH"].split(File::PATH_SEPARATOR).collect do |p|
+def paths(env_path = ENV["PATH"])
+ @paths ||= env_path.split(File::PATH_SEPARATOR).collect do |p|
begin
File.expand_path(p).chomp("/")
rescue ArgumentError | true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/dev-cmd/tests.rb | @@ -33,7 +33,12 @@ def tests
ENV["HOMEBREW_DEVELOPER"] = "1"
ENV["HOMEBREW_NO_COMPAT"] = "1" if ARGV.include? "--no-compat"
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if ARGV.include? "--generic"
- ENV["HOMEBREW_NO_GITHUB_API"] = "1" unless ARGV.include? "--online"
+
+ if ARGV.include? "--online"
+ ENV["HOMEBREW_TEST_ONLINE"] = "1"
+ else
+ ENV["HOMEBREW_NO_GITHUB_API"] = "1"
+ end
if ARGV.include? "--official-cmd-taps"
ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] = "1" | true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/test/cask/cli/style_spec.rb | @@ -81,7 +81,7 @@
end
context "version" do
- it "matches `HOMEBREW_RUBOCOP_VERSION`" do
+ it "matches `HOMEBREW_RUBOCOP_VERSION`", :needs_network do
stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote")
expect(status).to be_a_success | true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/test/cask/cli/uninstall_spec.rb | @@ -13,7 +13,9 @@
it "tries anyway on a non-present Cask when --force is given" do
expect {
- Hbc::CLI::Uninstall.run("local-caffeine", "--force")
+ shutup do
+ Hbc::CLI::Uninstall.run("local-caffeine", "--force")
+ end
}.not_to raise_error
end
| true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/test/cmd/bundle_spec.rb | @@ -1,6 +1,6 @@
describe "brew bundle", :integration_test, :needs_test_cmd_taps do
describe "check" do
- it "checks if a Brewfile's dependencies are satisfied" do
+ it "checks if a Brewfile's dependencies are satisfied", :needs_network do
setup_remote_tap "homebrew/bundle"
HOMEBREW_REPOSITORY.cd do | true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/test/dev-cmd/pull_spec.rb | @@ -6,9 +6,7 @@
.and be_a_failure
end
- it "fetches a patch from a GitHub commit or pull request and applies it" do
- skip "Requires network connection." if ENV["HOMEBREW_NO_GITHUB_API"]
-
+ it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do
CoreTap.instance.path.cd do
shutup do
system "git", "init" | true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/test/missing_formula_spec.rb | @@ -139,7 +139,7 @@
end
context "::deleted_reason" do
- subject { described_class.deleted_reason(formula) }
+ subject { described_class.deleted_reason(formula, silent: true) }
before do
Tap.clear_cache | true |
Other | Homebrew | brew | a6df701fad516a1da54ea245fb47826d47dc03b5.json | tests: reduce some noise.
- Tweak the way offline skipping happens
- Skip more tests that break when offline
- Hide more stdout output from tests. | Library/Homebrew/test/spec_helper.rb | @@ -61,6 +61,10 @@
skip "Python not installed." unless which("python")
end
+ config.before(:each, :needs_network) do
+ skip "Requires network connection." unless ENV["HOMEBREW_TEST_ONLINE"]
+ end
+
config.around(:each) do |example|
begin
TEST_DIRECTORIES.each(&:mkpath) | true |
Other | Homebrew | brew | e41f0bf8c8365c150935f03f3ecd14b44187b2ef.json | formula_installer: remove feature flags.
We've been testing the recursive dependency check and allowing unlinked
dependencies in CI for a while with no adverse consequences so enable
them globally now for all users. | Library/Homebrew/formula_installer.rb | @@ -173,34 +173,22 @@ def check_install_sanity
EOS
end
- if ENV["HOMEBREW_CHECK_RECURSIVE_VERSION_DEPENDENCIES"]
- version_hash = {}
- version_conflicts = Set.new
- recursive_formulae.each do |f|
- name = f.name
- unversioned_name, = name.split("@")
- version_hash[unversioned_name] ||= Set.new
- version_hash[unversioned_name] << name
- next if version_hash[unversioned_name].length < 2
- version_conflicts += version_hash[unversioned_name]
- end
- unless version_conflicts.empty?
- raise CannotInstallFormulaError, <<-EOS.undent
- #{formula.full_name} contains conflicting version recursive dependencies:
- #{version_conflicts.to_a.join ", "}
- View these with `brew deps --tree #{formula.full_name}`.
- EOS
- end
- end
-
- unless ENV["HOMEBREW_NO_CHECK_UNLINKED_DEPENDENCIES"]
- unlinked_deps = recursive_formulae.select do |dep|
- dep.installed? && !dep.keg_only? && !dep.linked_keg.directory?
- end
-
- unless unlinked_deps.empty?
- raise CannotInstallFormulaError, "You must `brew link #{unlinked_deps*" "}` before #{formula.full_name} can be installed"
- end
+ version_hash = {}
+ version_conflicts = Set.new
+ recursive_formulae.each do |f|
+ name = f.name
+ unversioned_name, = name.split("@")
+ version_hash[unversioned_name] ||= Set.new
+ version_hash[unversioned_name] << name
+ next if version_hash[unversioned_name].length < 2
+ version_conflicts += version_hash[unversioned_name]
+ end
+ unless version_conflicts.empty?
+ raise CannotInstallFormulaError, <<-EOS.undent
+ #{formula.full_name} contains conflicting version recursive dependencies:
+ #{version_conflicts.to_a.join ", "}
+ View these with `brew deps --tree #{formula.full_name}`.
+ EOS
end
pinned_unsatisfied_deps = recursive_deps.select do |dep| | false |
Other | Homebrew | brew | cc634b2d50cc0e8c1e8a38196f4bcdad4e0a69b6.json | Set timeout to 10 seconds instead of retrying. | Library/Homebrew/cask/lib/hbc/system_command.rb | @@ -91,16 +91,10 @@ def write_input_to(raw_stdin)
end
def each_line_from(sources)
- tries = 3
-
loop do
- selected_sources = IO.select(sources, [], [], 1)
+ selected_sources = IO.select(sources, [], [], 10)
- if selected_sources.nil?
- next unless (tries -= 1).zero?
- odebug "IO#select failed, skipping line."
- break
- end
+ break if selected_sources.nil?
readable_sources = selected_sources[0].delete_if(&:eof?)
| false |
Other | Homebrew | brew | 824462c5c08da8a35c8b3bd5d1dedb73998c7460.json | README: Add Charlie to former maintainers. | README.md | @@ -42,7 +42,7 @@ Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid).
Homebrew's current maintainers are [Alyssa Ross](https://github.com/alyssais), [Andrew Janke](https://github.com/apjanke), [Baptiste Fontaine](https://github.com/bfontaine), [Alex Dunn](https://github.com/dunn), [FX Coudert](https://github.com/fxcoudert), [ilovezfs](https://github.com/ilovezfs), [Josh Hagins](https://github.com/jawshooah), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Markus Reiter](https://github.com/reitermarkus), [Tim Smith](https://github.com/tdsmith), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky) and [William Woodruff](https://github.com/woodruffw).
-Former maintainers with significant contributions include [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
+Former maintainers with significant contributions include [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
## Community
- [discourse.brew.sh (forum)](https://discourse.brew.sh) | true |
Other | Homebrew | brew | 824462c5c08da8a35c8b3bd5d1dedb73998c7460.json | README: Add Charlie to former maintainers. | docs/Manpage.md | @@ -1077,7 +1077,7 @@ Homebrew's lead maintainer is Mike McQuaid.
Homebrew's current maintainers are Alyssa Ross, Andrew Janke, Baptiste Fontaine, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff.
-Former maintainers with significant contributions include Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell.
+Former maintainers with significant contributions include Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell.
## BUGS
| true |
Other | Homebrew | brew | 824462c5c08da8a35c8b3bd5d1dedb73998c7460.json | README: Add Charlie to former maintainers. | manpages/brew.1 | @@ -1120,7 +1120,7 @@ Homebrew\'s lead maintainer is Mike McQuaid\.
Homebrew\'s current maintainers are Alyssa Ross, Andrew Janke, Baptiste Fontaine, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff\.
.
.P
-Former maintainers with significant contributions include Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Jack Nagel, Adam Vandenberg and Homebrew\'s creator: Max Howell\.
+Former maintainers with significant contributions include Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg and Homebrew\'s creator: Max Howell\.
.
.SH "BUGS"
See our issues on GitHub: | true |
Other | Homebrew | brew | 20ad7f9cf6e69196b224f95e9fce4b8af8a6d284.json | README: point security to HackerOne. | README.md | @@ -35,12 +35,7 @@ We explicitly welcome contributions from people who have never contributed to op
A good starting point for contributing is running `brew audit --strict`with some of the packages you use (e.g. `brew audit --strict wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit --strict` shows no results and [submit a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html). If no formulae you use have warnings you can run `brew audit --strict` without arguments to have it run on all packages and pick one. Good luck!
## Security
-Please report security issues to security@brew.sh.
-
-This is our PGP key which is valid until May 24, 2017.
-* Key ID: `0xE33A3D3CCE59E297`
-* Fingerprint: `C657 8F76 2E23 441E C879 EC5C E33A 3D3C CE59 E297`
-* Full key: https://keybase.io/homebrew/key.asc
+Please report security issues to our [HackerOne](https://hackerone.com/homebrew/).
## Who Are You?
Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid). | false |
Other | Homebrew | brew | 43253ede656a93562344c8a39b7e3145ad2358fc.json | create: use GitHub metadata where available.
GitHub provides a description and homepage field so let `brew create`
use them where possible. Also, detect GitHub repositories based on
`releases` as well as `archive`s. | Library/Homebrew/dev-cmd/create.rb | @@ -10,7 +10,8 @@
#: If `--meson` is passed, create a basic template for a Meson-style build.
#:
#: If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
-#: will thus not add the SHA256 to the formula for you.
+#: will thus not add the SHA256 to the formula for you. It will also not check
+#: the GitHub API for GitHub projects (to fill out the description and homepage).
#:
#: The options `--set-name` and `--set-version` each take an argument and allow
#: you to explicitly set the name and version of the package you are creating.
@@ -100,19 +101,23 @@ def __gets
end
class FormulaCreator
- attr_reader :url, :sha256
+ attr_reader :url, :sha256, :desc, :homepage
attr_accessor :name, :version, :tap, :path, :mode
def url=(url)
@url = url
path = Pathname.new(url)
if @name.nil?
case url
- when %r{github\.com/\S+/(\S+)\.git}
- @name = $1
+ when %r{github\.com/(\S+)/(\S+)\.git}
+ @user = $1
+ @name = $2
@head = true
- when %r{github\.com/\S+/(\S+)/archive/}
- @name = $1
+ @github = true
+ when %r{github\.com/(\S+)/(\S+)/(archive|releases)/}
+ @user = $1
+ @name = $2
+ @github = true
else
@name = path.basename.to_s[/(.*?)[-_.]?#{Regexp.escape(path.version.to_s)}/, 1]
end
@@ -131,7 +136,7 @@ def update_path
end
def fetch?
- !head? && !ARGV.include?("--no-fetch")
+ !ARGV.include?("--no-fetch")
end
def head?
@@ -145,11 +150,25 @@ def generate!
opoo "Version cannot be determined from URL."
puts "You'll need to add an explicit 'version' to the formula."
elsif fetch?
- r = Resource.new
- r.url(url)
- r.version(version)
- r.owner = self
- @sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
+ unless head?
+ r = Resource.new
+ r.url(url)
+ r.version(version)
+ r.owner = self
+ @sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
+ end
+
+ if @user && @name
+ begin
+ metadata = GitHub.repository(@user, @name)
+ @desc = metadata["description"]
+ @homepage = metadata["homepage"]
+ rescue GitHub::HTTPNotFoundError
+ # If there was no repository found assume the network connection is at
+ # fault rather than the input URL.
+ nil
+ end
+ end
end
path.write ERB.new(template, nil, ">").result(binding)
@@ -161,8 +180,8 @@ def template; <<-EOS.undent
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class #{Formulary.class_s(name)} < Formula
- desc ""
- homepage ""
+ desc "#{desc}"
+ homepage "#{homepage}"
<% if head? %>
head "#{url}"
<% else %> | true |
Other | Homebrew | brew | 43253ede656a93562344c8a39b7e3145ad2358fc.json | create: use GitHub metadata where available.
GitHub provides a description and homepage field so let `brew create`
use them where possible. Also, detect GitHub repositories based on
`releases` as well as `archive`s. | docs/Manpage.md | @@ -709,7 +709,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--meson` is passed, create a basic template for a Meson-style build.
If `--no-fetch` is passed, Homebrew will not download `URL` to the cache and
- will thus not add the SHA256 to the formula for you.
+ will thus not add the SHA256 to the formula for you. It will also not check
+ the GitHub API for GitHub projects (to fill out the description and homepage).
The options `--set-name` and `--set-version` each take an argument and allow
you to explicitly set the name and version of the package you are creating. | true |
Other | Homebrew | brew | 43253ede656a93562344c8a39b7e3145ad2358fc.json | create: use GitHub metadata where available.
GitHub provides a description and homepage field so let `brew create`
use them where possible. Also, detect GitHub repositories based on
`releases` as well as `archive`s. | manpages/brew.1 | @@ -729,7 +729,7 @@ Generate a formula for the downloadable file at \fIURL\fR and open it in the edi
If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. If \fB\-\-meson\fR is passed, create a basic template for a Meson\-style build\.
.
.IP
-If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\.
+If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. It will also not check the GitHub API for GitHub projects (to fill out the description and homepage)\.
.
.IP
The options \fB\-\-set\-name\fR and \fB\-\-set\-version\fR each take an argument and allow you to explicitly set the name and version of the package you are creating\. | true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | Library/Homebrew/dev-cmd/audit.rb | @@ -1,4 +1,4 @@
-#: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [<formulae>]:
+#: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=`<method>|`--except=`<method] [<formulae>]:
#: Check <formulae> for Homebrew coding style violations. This should be
#: run before submitting a new formula.
#:
@@ -23,6 +23,10 @@
#: If `--display-filename` is passed, every line of output is prefixed with the
#: name of the file or formula being audited, to make the output easy to grep.
#:
+#: If `--only` is passed, only the methods named `audit_<method>` will be run.
+#:
+#: If `--except` is passed, the methods named `audit_<method>` will not be run.
+#:
#: `audit` exits with a non-zero status if any errors are found. This is useful,
#: for instance, for implementing pre-commit hooks.
@@ -728,7 +732,7 @@ def audit_specs
}
end
- spec.patches.each { |p| audit_patch(p) if p.external? }
+ spec.patches.each { |p| patch_problems(p) if p.external? }
end
%w[Stable Devel].each do |name|
@@ -864,10 +868,10 @@ def audit_legacy_patches
return if legacy_patches.empty?
problem "Use the patch DSL instead of defining a 'patches' method"
- legacy_patches.each { |p| audit_patch(p) }
+ legacy_patches.each { |p| patch_problems(p) }
end
- def audit_patch(patch)
+ def patch_problems(patch)
case patch.url
when /raw\.github\.com/, %r{gist\.github\.com/raw}, %r{gist\.github\.com/.+/raw},
%r{gist\.githubusercontent\.com/.+/raw}
@@ -939,7 +943,13 @@ def audit_text
problem "require \"language/go\" is unnecessary unless using `go_resource`s"
end
- def audit_line(line, _lineno)
+ def audit_lines
+ text.without_patch.split("\n").each_with_index do |line, lineno|
+ line_problems(line, lineno+1)
+ end
+ end
+
+ def line_problems(line, _lineno)
if line =~ /<(Formula|AmazonWebServicesFormula|ScriptFileFormula|GithubGistFormula)/
problem "Use a space in class inheritance: class Foo < #{$1}"
end
@@ -1142,11 +1152,11 @@ def audit_line(line, _lineno)
end
if line =~ /depends_on :(.+) (if.+|unless.+)$/
- audit_conditional_dep($1.to_sym, $2, $&)
+ conditional_dep_problems($1.to_sym, $2, $&)
end
if line =~ /depends_on ['"](.+)['"] (if.+|unless.+)$/
- audit_conditional_dep($1, $2, $&)
+ conditional_dep_problems($1, $2, $&)
end
if line =~ /(Dir\[("[^\*{},]+")\])/
@@ -1234,7 +1244,7 @@ def audit_prefix_has_contents
EOS
end
- def audit_conditional_dep(dep, condition, line)
+ def conditional_dep_problems(dep, condition, line)
quoted_dep = quote_dep(dep)
dep = Regexp.escape(dep.to_s)
@@ -1250,30 +1260,26 @@ def quote_dep(dep)
dep.is_a?(Symbol) ? dep.inspect : "'#{dep}'"
end
- def audit_check_output(output)
+ def problem_if_output(output)
problem(output) if output
end
def audit
- audit_file
- audit_formula_name
- audit_class
- audit_specs
- audit_revision_and_version_scheme
- audit_homepage
- audit_bottle_spec
- audit_github_repository
- audit_deps
- audit_conflicts
- audit_options
- audit_legacy_patches
- audit_text
- audit_caveats
- text.without_patch.split("\n").each_with_index { |line, lineno| audit_line(line, lineno+1) }
- audit_installed
- audit_prefix_has_contents
- audit_reverse_migration
- audit_style
+ only_audits = ARGV.value("only").to_s.split(",")
+ except_audits = ARGV.value("except").to_s.split(",")
+ if !only_audits.empty? && !except_audits.empty?
+ odie "--only and --except cannot be used simulataneously!"
+ end
+
+ methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
+ name = audit_method_name.gsub(/^audit_/, "")
+ if !only_audits.empty?
+ next unless only_audits.include?(name)
+ elsif !except_audits.empty?
+ next if except_audits.include?(name)
+ end
+ send(audit_method_name)
+ end
end
private | true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | Library/Homebrew/extend/os/mac/formula_cellar_checks.rb | @@ -67,7 +67,7 @@ def check_linkage
checker = LinkageChecker.new(keg, formula)
return unless checker.broken_dylibs?
- audit_check_output <<-EOS.undent
+ problem_if_output <<-EOS.undent
The installation was broken.
Broken dylib links found:
#{checker.broken_dylibs.to_a * "\n "}
@@ -76,9 +76,9 @@ def check_linkage
def audit_installed
generic_audit_installed
- audit_check_output(check_shadowed_headers)
- audit_check_output(check_openssl_links)
- audit_check_output(check_python_framework_links(formula.lib))
+ problem_if_output(check_shadowed_headers)
+ problem_if_output(check_openssl_links)
+ problem_if_output(check_python_framework_links(formula.lib))
check_linkage
end
end | true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | Library/Homebrew/formula_cellar_checks.rb | @@ -154,17 +154,17 @@ def check_elisp_root(share, name)
end
def audit_installed
- audit_check_output(check_manpages)
- audit_check_output(check_infopages)
- audit_check_output(check_jars)
- audit_check_output(check_non_libraries)
- audit_check_output(check_non_executables(formula.bin))
- audit_check_output(check_generic_executables(formula.bin))
- audit_check_output(check_non_executables(formula.sbin))
- audit_check_output(check_generic_executables(formula.sbin))
- audit_check_output(check_easy_install_pth(formula.lib))
- audit_check_output(check_elisp_dirname(formula.share, formula.name))
- audit_check_output(check_elisp_root(formula.share, formula.name))
+ problem_if_output(check_manpages)
+ problem_if_output(check_infopages)
+ problem_if_output(check_jars)
+ problem_if_output(check_non_libraries)
+ problem_if_output(check_non_executables(formula.bin))
+ problem_if_output(check_generic_executables(formula.bin))
+ problem_if_output(check_non_executables(formula.sbin))
+ problem_if_output(check_generic_executables(formula.sbin))
+ problem_if_output(check_easy_install_pth(formula.lib))
+ problem_if_output(check_elisp_dirname(formula.share, formula.name))
+ problem_if_output(check_elisp_root(formula.share, formula.name))
end
alias generic_audit_installed audit_installed
| true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | Library/Homebrew/formula_installer.rb | @@ -858,15 +858,15 @@ def pour
tab.write
end
- def audit_check_output(output)
+ def problem_if_output(output)
return unless output
opoo output
@show_summary_heading = true
end
def audit_installed
- audit_check_output(check_env_path(formula.bin))
- audit_check_output(check_env_path(formula.sbin))
+ problem_if_output(check_env_path(formula.bin))
+ problem_if_output(check_env_path(formula.sbin))
super
end
| true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | Library/Homebrew/test/dev-cmd/audit_spec.rb | @@ -303,33 +303,33 @@ class Foo < AmazonWebServicesFormula
end
end
- describe "#audit_line" do
+ describe "#line_problems" do
specify "pkgshare" do
fa = formula_auditor "foo", <<-EOS.undent, strict: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
end
EOS
- fa.audit_line 'ohai "#{share}/foo"', 3
+ fa.line_problems 'ohai "#{share}/foo"', 3
expect(fa.problems.shift).to eq("Use \#{pkgshare} instead of \#{share}/foo")
- fa.audit_line 'ohai "#{share}/foo/bar"', 3
+ fa.line_problems 'ohai "#{share}/foo/bar"', 3
expect(fa.problems.shift).to eq("Use \#{pkgshare} instead of \#{share}/foo")
- fa.audit_line 'ohai share/"foo"', 3
+ fa.line_problems 'ohai share/"foo"', 3
expect(fa.problems.shift).to eq('Use pkgshare instead of (share/"foo")')
- fa.audit_line 'ohai share/"foo/bar"', 3
+ fa.line_problems 'ohai share/"foo/bar"', 3
expect(fa.problems.shift).to eq('Use pkgshare instead of (share/"foo")')
- fa.audit_line 'ohai "#{share}/foo-bar"', 3
+ fa.line_problems 'ohai "#{share}/foo-bar"', 3
expect(fa.problems).to eq([])
- fa.audit_line 'ohai share/"foo-bar"', 3
+ fa.line_problems 'ohai share/"foo-bar"', 3
expect(fa.problems).to eq([])
- fa.audit_line 'ohai share/"bar"', 3
+ fa.line_problems 'ohai share/"bar"', 3
expect(fa.problems).to eq([])
end
@@ -344,11 +344,11 @@ class Foolibcxx < Formula
end
EOS
- fa.audit_line 'ohai "#{share}/foolibc++"', 3
+ fa.line_problems 'ohai "#{share}/foolibc++"', 3
expect(fa.problems.shift)
.to eq("Use \#{pkgshare} instead of \#{share}/foolibc++")
- fa.audit_line 'ohai share/"foolibc++"', 3
+ fa.line_problems 'ohai share/"foolibc++"', 3
expect(fa.problems.shift)
.to eq('Use pkgshare instead of (share/"foolibc++")')
end
@@ -360,18 +360,18 @@ class Foo<Formula
end
EOS
- fa.audit_line "class Foo<Formula", 1
+ fa.line_problems "class Foo<Formula", 1
expect(fa.problems.shift)
.to eq("Use a space in class inheritance: class Foo < Formula")
end
specify "default template" do
fa = formula_auditor "foo", "class Foo < Formula; url '/foo-1.0.tgz'; end"
- fa.audit_line '# system "cmake", ".", *std_cmake_args', 3
+ fa.line_problems '# system "cmake", ".", *std_cmake_args', 3
expect(fa.problems.shift).to eq("Commented cmake call found")
- fa.audit_line "# PLEASE REMOVE", 3
+ fa.line_problems "# PLEASE REMOVE", 3
expect(fa.problems.shift).to eq("Please remove default template comments")
end
end | true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | docs/Manpage.md | @@ -606,7 +606,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
## DEVELOPER COMMANDS
- * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`formulae`]:
+ * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=``method`|`--except=``method] [<formulae`]:
Check `formulae` for Homebrew coding style violations. This should be
run before submitting a new formula.
@@ -631,6 +631,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--display-filename` is passed, every line of output is prefixed with the
name of the file or formula being audited, to make the output easy to grep.
+ If `--only` is passed, only the methods named `audit_`method`` will be run.
+
+ If `--except` is passed, the methods named `audit_`method`` will not be run.
+
`audit` exits with a non-zero status if any errors are found. This is useful,
for instance, for implementing pre-commit hooks.
| true |
Other | Homebrew | brew | 3f8722c971cedf8b2c66d918fc4dd608bf439009.json | audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups. | manpages/brew.1 | @@ -631,7 +631,7 @@ Print the version number of Homebrew to standard output and exit\.
.SH "DEVELOPER COMMANDS"
.
.TP
-\fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-fix\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fIformulae\fR]
+\fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-fix\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fB\-\-only=\fR\fImethod\fR|\fB\-\-except=\fR\fImethod] [<formulae\fR]
Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\.
.
.IP
@@ -656,6 +656,12 @@ If \fB\-\-display\-cop\-names\fR is passed, the RuboCop cop name for each violat
If \fB\-\-display\-filename\fR is passed, every line of output is prefixed with the name of the file or formula being audited, to make the output easy to grep\.
.
.IP
+If \fB\-\-only\fR is passed, only the methods named \fBaudit_<method>\fR will be run\.
+.
+.IP
+If \fB\-\-except\fR is passed, the methods named \fBaudit_<method>\fR will not be run\.
+.
+.IP
\fBaudit\fR exits with a non\-zero status if any errors are found\. This is useful, for instance, for implementing pre\-commit hooks\.
.
.TP | true |
Other | Homebrew | brew | 14a7ef591b68ebb4d901c2f2a9a1553be0e7af03.json | gpg_spec: switch structure to if/else instead of rescue | Library/Homebrew/test/gpg_spec.rb | @@ -12,11 +12,13 @@
shutup do
subject.create_test_key(dir)
+ gpg = subject::GPG_EXECUTABLE
+ @version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0]
end
- begin
+ if @version.to_s.start_with?("2.1")
expect(dir/".gnupg/pubring.kbx").to be_file
- rescue RSpec::Expectations::ExpectationNotMetError
+ else
expect(dir/".gnupg/secring.gpg").to be_file
end
end | false |
Other | Homebrew | brew | 57b230dd5c9ff01f59b2c6e0f8c527bbc95b9dce.json | audit: fix core formula alias check.
Was missing a formula object being passed. | Library/Homebrew/dev-cmd/audit.rb | @@ -476,7 +476,7 @@ def audit_deps
end
if @@aliases.include?(dep.name) &&
- (core_formula? || !dep_f.versioned_formula?)
+ (dep_f.core_formula? || !dep_f.versioned_formula?)
problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'."
end
| false |
Other | Homebrew | brew | 573aeff11513a679577994cce84d31011090902b.json | Add Skylake to Linux hardware list | Library/Homebrew/extend/os/linux/hardware/cpu.rb | @@ -49,6 +49,8 @@ def family
:haswell
when 0x3d, 0x47, 0x4f, 0x56
:broadwell
+ when 0x5e
+ :skylake
when 0x8e
:kabylake
else | false |
Other | Homebrew | brew | c3b309e7957d38952a85b4d320ac73112d2733af.json | java_requirement: Add newline to failure message
Signed-off-by: Bob W. Hogg <rwhogg@linux.com> | Library/Homebrew/requirements/java_requirement.rb | @@ -18,7 +18,7 @@ def initialize(tags)
def message
version_string = " #{@version}" if @version
- s = "Java#{version_string} is required to install this formula."
+ s = "Java#{version_string} is required to install this formula.\n"
s += super
s
end | false |
Other | Homebrew | brew | ae97a9c34eff45766be9af76bd79057c4acae77f.json | docs: use long flags. | docs/FAQ.md | @@ -174,11 +174,11 @@ If itβs been a while, bump it with a βbumpβ comment. Sometimes we miss req
Yes! Itβs easy! Just `brew edit <formula>`. You donβt have to submit modifications back to `homebrew/core`, just edit the formula as you personally need it and `brew install`. As a bonus `brew update` will merge your changes with upstream so you can still keep the formula up-to-date **with** your personal modifications!
## Can I make new formulae?
-Yes! Itβs easy! Just `brew create URL`. Homebrew will then open the
-formula in `EDITOR` so you can edit it, but it probably already
-installs; try it: `brew install <formula>`. If you encounter any issues,
-run the command with the `-d` switch like so: `brew install -d <formula>`,
-which drops you into a debugging shell.
+Yes! Itβs easy! Just `brew create URL`. Homebrew will then open the formula in
+`EDITOR` so you can edit it, but it probably already installs; try it: `brew
+install <formula>`. If you encounter any issues, run the command with the
+`--debug` switch like so: `brew install --debug <formula>`, which drops you
+into a debugging shell.
If you want your new formula to be part of `homebrew/core` or want
to learn more about writing formulae, then please read the [Formula Cookbook](Formula-Cookbook.md). | true |
Other | Homebrew | brew | ae97a9c34eff45766be9af76bd79057c4acae77f.json | docs: use long flags. | docs/Formula-Cookbook.md | @@ -90,7 +90,7 @@ Try to summarize from the [`homepage`](http://www.rubydoc.info/github/Homebrew/b
### Check the build system
```sh
-brew install -i foo
+brew install --interactive foo
```
Youβre now at a new prompt with the tarball extracted to a temporary sandbox. | true |
Other | Homebrew | brew | 18c7254ecddc67851e9aa087eabd203b336d62e8.json | missing_formula: pillow lives in homebrew/science | Library/Homebrew/missing_formula.rb | @@ -31,7 +31,7 @@ def blacklisted_reason(name)
#{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")}
EOS
when "pil" then <<-EOS.undent
- Instead of PIL, consider `pip install pillow` or `brew install Homebrew/python/pillow`.
+ Instead of PIL, consider `pip install pillow` or `brew install Homebrew/science/pillow`.
EOS
when "macruby" then <<-EOS.undent
MacRuby is not packaged and is on an indefinite development hiatus. | false |
Other | Homebrew | brew | 7c048b6f71b031ab8ee1289a70b51cef24408dcc.json | cask: remove pre_bug_report links | Library/Homebrew/cask/lib/hbc/utils.rb | @@ -4,8 +4,7 @@
require "hbc/utils/file"
-PREBUG_URL = "https://github.com/caskroom/homebrew-cask/blob/master/doc/reporting_bugs/pre_bug_report.md".freeze
-ISSUES_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze
+BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze
# monkeypatch Object - not a great idea
class Object
@@ -96,11 +95,7 @@ def self.path_occupied?(path)
def self.error_message_with_suggestions
<<-EOS.undent
Follow the instructions here:
- #{Formatter.url(PREBUG_URL)}
-
- If this doesnβt fix the problem, please report this bug:
- #{Formatter.url(ISSUES_URL)}
-
+ #{Formatter.url(BUG_REPORTS_URL)}
EOS
end
| true |
Other | Homebrew | brew | 7c048b6f71b031ab8ee1289a70b51cef24408dcc.json | cask: remove pre_bug_report links | Library/Homebrew/test/cask/dsl_spec.rb | @@ -26,8 +26,6 @@
.*
Unexpected method 'future_feature' called on Cask unexpected-method-cask\\.
.*
- https://github.com/caskroom/homebrew-cask/blob/master/doc/reporting_bugs/pre_bug_report.md
- .*
https://github.com/caskroom/homebrew-cask#reporting-bugs
EOS
| true |
Other | Homebrew | brew | f5321d1b0d8f24cb2d4773c03f57f1c643fc775f.json | Remove osmium from blacklisted formulas | Library/Homebrew/missing_formula.rb | @@ -64,10 +64,6 @@ def blacklisted_reason(name)
and then follow the tutorial:
#{Formatter.url("https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md")}
EOS
- when "osmium" then <<-EOS.undent
- The creator of Osmium requests that it not be packaged and that people
- use the GitHub master branch instead.
- EOS
when "gfortran" then <<-EOS.undent
GNU Fortran is now provided as part of GCC, and can be installed with:
brew install gcc | true |
Other | Homebrew | brew | f5321d1b0d8f24cb2d4773c03f57f1c643fc775f.json | Remove osmium from blacklisted formulas | Library/Homebrew/test/missing_formula_spec.rb | @@ -88,14 +88,6 @@
it { is_expected.to be_blacklisted }
end
- context "osmium" do
- %w[osmium Osmium].each do |s|
- subject { s }
-
- it { is_expected.to be_blacklisted }
- end
- end
-
context "gfortran" do
subject { "gfortran" }
| true |
Other | Homebrew | brew | 90c6d5f40a950178a5c1fae0fae9f39abcf3ffb4.json | upgrade: perform rename migrations when needed. | Library/Homebrew/cmd/upgrade.rb | @@ -88,6 +88,7 @@ def upgrade
end
formulae_to_install.each do |f|
+ Migrator.migrate_if_needed(f)
upgrade_formula(f)
next unless ARGV.include?("--cleanup")
next unless f.installed? | false |
Other | Homebrew | brew | 61ebc128af718dca9d2a1dda482e29d30f54e72f.json | reinstall: perform rename migrations when needed. | Library/Homebrew/cmd/reinstall.rb | @@ -15,6 +15,7 @@ def reinstall
onoe "#{f.full_name} is pinned. You must unpin it to reinstall."
next
end
+ Migrator.migrate_if_needed(f)
reinstall_formula(f)
end
end | false |
Other | Homebrew | brew | d82522060e62c082fc54f2ee8ea30c46e004917f.json | install: perform rename migrations when needed. | Library/Homebrew/cmd/install.rb | @@ -199,7 +199,10 @@ def install
perform_preinstall_checks
- formulae.each { |f| install_formula(f) }
+ formulae.each do |f|
+ Migrator.migrate_if_needed(f)
+ install_formula(f)
+ end
rescue FormulaClassUnavailableError => e
# Need to rescue before `FormulaUnavailableError` (superclass of this)
# is handled, as searching for a formula doesn't make sense here (the | false |
Other | Homebrew | brew | 5d1f4dd531f9e88c762f2f65e73e67511798c62d.json | migrator: add more helper methods.
Add methods to determine if a migration is needed and perform it if so
(and no-op if not). Additionally, make `ARGV.force?` get passed as a
parameter so it can be overridden without requiring users to pass
`βforce`. | Library/Homebrew/migrator.rb | @@ -83,7 +83,26 @@ def initialize(formula, tap)
# path to newname keg that will be linked if old_linked_keg isn't nil
attr_reader :new_linked_keg_record
- def initialize(formula)
+ def self.needs_migration?(formula)
+ oldname = formula.oldname
+ return false unless oldname
+ oldname_rack = HOMEBREW_CELLAR/oldname
+ return false if oldname_rack.symlink?
+ return false unless oldname_rack.directory?
+ true
+ end
+
+ def self.migrate_if_needed(formula)
+ return unless Migrator.needs_migration?(formula)
+ begin
+ migrator = Migrator.new(formula, force: true)
+ migrator.migrate
+ rescue Exception => e
+ onoe e
+ end
+ end
+
+ def initialize(formula, force: ARGV.force?)
@oldname = formula.oldname
@newname = formula.name
raise MigratorNoOldnameError, formula unless oldname
@@ -95,7 +114,7 @@ def initialize(formula)
@old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
@old_tap = old_tabs.first.tap
- if !ARGV.force? && !from_same_taps?
+ if !force && !from_same_taps?
raise MigratorDifferentTapsError.new(formula, old_tap)
end
| false |
Other | Homebrew | brew | 45357ef0dd2bfc0bf8d957fd890e030fd9f7cf6a.json | Fix handling of tap migrations to new cask names.
Need to check for two `/`s rather than one. | Library/Homebrew/migrator.rb | @@ -122,14 +122,21 @@ def fix_tabs
end
def from_same_taps?
+ new_tap = if old_tap
+ if migrate_tap = old_tap.tap_migrations[formula.oldname]
+ new_tap_user, new_tap_repo, = migrate_tap.split("/")
+ "#{new_tap_user}/#{new_tap_repo}"
+ end
+ end
+
if formula.tap == old_tap
true
# Homebrew didn't use to update tabs while performing tap-migrations,
# so there can be INSTALL_RECEIPT's containing wrong information about tap,
# so we check if there is an entry about oldname migrated to tap and if
# newname's tap is the same as tap to which oldname migrated, then we
# can perform migrations and the taps for oldname and newname are the same.
- elsif formula.tap && old_tap && formula.tap == old_tap.tap_migrations[formula.oldname]
+ elsif formula.tap && old_tap && formula.tap == new_tap
fix_tabs
true
else | true |
Other | Homebrew | brew | 45357ef0dd2bfc0bf8d957fd890e030fd9f7cf6a.json | Fix handling of tap migrations to new cask names.
Need to check for two `/`s rather than one. | Library/Homebrew/missing_formula.rb | @@ -105,10 +105,14 @@ def tap_migration_reason(name)
message = nil
Tap.each do |old_tap|
- new_tap_name = old_tap.tap_migrations[name]
- next unless new_tap_name
+ new_tap = old_tap.tap_migrations[name]
+ next unless new_tap
+
+ new_tap_user, new_tap_repo, = new_tap.split("/")
+ new_tap_name = "#{new_tap_user}/#{new_tap_repo}"
+
message = <<-EOS.undent
- It was migrated from #{old_tap} to #{new_tap_name}.
+ It was migrated from #{old_tap} to #{new_tap}.
You can access it again by running:
brew tap #{new_tap_name}
EOS | true |
Other | Homebrew | brew | e7554b0b3f71e0658e52e8dea974c511bc58aeba.json | audit: Fix cctools invocation check regular expression.
Additionally, ignore the cctools formula itself, since it obviously
needs to check cctools invocations. | Library/Homebrew/dev-cmd/audit.rb | @@ -1185,7 +1185,7 @@ def audit_line(line, _lineno)
problem "'fails_with :llvm' is now a no-op so should be removed"
end
- if line =~ /system\s+['"](otool)|(install_name_tool)|(lipo)/
+ if line =~ /system\s+['"](otool|install_name_tool|lipo)/ && formula.name != "cctools"
problem "Use ruby-macho instead of calling #{$1}"
end
| false |
Other | Homebrew | brew | 51ca9025a5c094d048d248f5fa0e4bf8990bc421.json | formula_installer_spec: add default formula test.
Test the situation where a requirement is satisfied by a non-formula
but the `default_formula` is also installed. | Library/Homebrew/test/formula_installer_spec.rb | @@ -159,6 +159,13 @@ class #{Formulary.class_s(dep_name)} < Formula
it { is_expected.to be false }
end
+ context "it returns false when requirement is satisfied but default formula is installed" do
+ let(:satisfied?) { true }
+ let(:satisfied_by_formula?) { false }
+ let(:installed?) { true }
+ it { is_expected.to be false }
+ end
+
context "it returns true when requirement isn't satisfied" do
let(:satisfied?) { false }
let(:satisfied_by_formula?) { false } | false |
Other | Homebrew | brew | 89f3b6d6a6ce0b1ed993a0988989fc9ac4284fa1.json | update-test: Use git fetch --tags --depth=1
Use git fetch --tags --depth=1 to fetch fewer commits. | Library/Homebrew/dev-cmd/update-test.rb | @@ -36,7 +36,7 @@ def update_test
previous_tag =
Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
unless previous_tag
- safe_system "git", "fetch", "--tags"
+ safe_system "git", "fetch", "--tags", "--depth=1"
previous_tag =
Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
end | false |
Other | Homebrew | brew | c5bac087b34e90933acca1ee0371dd947cfa97a1.json | update latest versions of Xcode for 10.11 & 10.12 | Library/Homebrew/os/mac.rb | @@ -201,6 +201,10 @@ def preferred_arch
"7.3" => { clang: "7.3", clang_build: 703 },
"7.3.1" => { clang: "7.3", clang_build: 703 },
"8.0" => { clang: "8.0", clang_build: 800 },
+ "8.1" => { clang: "8.0", clang_build: 800 },
+ "8.2" => { clang: "8.0", clang_build: 800 },
+ "8.2.1" => { clang: "8.0", clang_build: 800 },
+ "8.3" => { clang: "8.1", clang_build: 802 },
}.freeze
def compilers_standard? | true |
Other | Homebrew | brew | c5bac087b34e90933acca1ee0371dd947cfa97a1.json | update latest versions of Xcode for 10.11 & 10.12 | Library/Homebrew/os/mac/xcode.rb | @@ -16,13 +16,13 @@ def latest_version
when "10.8" then "5.1.1"
when "10.9" then "6.2"
when "10.10" then "7.2.1"
- when "10.11" then "8.2"
- when "10.12" then "8.2"
+ when "10.11" then "8.2.1"
+ when "10.12" then "8.3"
else
raise "macOS '#{MacOS.version}' is invalid" unless OS::Mac.prerelease?
# Default to newest known version of Xcode for unreleased macOS versions.
- "8.2"
+ "8.3"
end
end
@@ -152,7 +152,8 @@ def uncached_version
when 70 then "7.0"
when 73 then "7.3"
when 80 then "8.0"
- else "8.0"
+ when 81 then "8.3"
+ else "8.3"
end
end
@@ -213,8 +214,8 @@ def latest_version
# on the older supported platform for that Xcode release, i.e there's no
# CLT package for 10.11 that contains the Clang version from Xcode 8.
case MacOS.version
- when "10.12" then "800.0.42.1"
- when "10.11" then "703.0.31"
+ when "10.12" then "802.0.38"
+ when "10.11" then "800.0.42.1"
when "10.10" then "700.1.81"
when "10.9" then "600.0.57"
when "10.8" then "503.0.40" | true |
Other | Homebrew | brew | c5bac087b34e90933acca1ee0371dd947cfa97a1.json | update latest versions of Xcode for 10.11 & 10.12 | docs/Xcode.md | @@ -11,8 +11,8 @@ Tools available for your platform:
| 10.8 | 5.1.1 | April 2014 |
| 10.9 | 6.2 | 6.2 |
| 10.10 | 7.2.1 | 7.2 |
-| 10.11 | 8.0 | 7.3 |
-| 10.12 | 8.0 | 8.0 |
+| 10.11 | 8.2.1 | 8.2 |
+| 10.12 | 8.3 | 8.3 |
## Compiler version database
@@ -66,6 +66,10 @@ Tools available for your platform:
| 7.3 | β | β | β | β | 7.3 (703.0.29) | β |
| 7.3.1 | β | β | β | β | 7.3 (703.0.31) | β |
| 8.0 | β | β | β | β | 8.0 (800.0.38) | β |
+| 8.1 | β | β | β | β | 8.0 (800.0.42.1)| β |
+| 8.2 | β | β | β | β | 8.0 (800.0.42.1)| β |
+| 8.2.1 | β | β | β | β | 8.0 (800.0.42.1)| β |
+| 8.3 | β | β | β | β | 8.1 (802.0.38) | β |
## References to Xcode and compiler versions in code
When a new Xcode release is made, the following things need to be | true |
Other | Homebrew | brew | c3bf9bda58aba514259d45972a5172e8801d5c65.json | update-test: improve error handling.
Fail if the start or end commit are missing and retry finding the
previous tag by fetching all tags if they are missing.
This should fix CI on the current Homebrew/brew `master` branch.
Closes #2404. | Library/Homebrew/dev-cmd/update-test.rb | @@ -33,12 +33,24 @@ def update_test
elsif date = ARGV.value("before")
Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp
elsif ARGV.include?("--to-tag")
- Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1].chomp
+ previous_tag =
+ Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
+ unless previous_tag
+ safe_system "git", "fetch", "--tags"
+ previous_tag =
+ Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
+ end
+ previous_tag.to_s.chomp
else
Utils.popen_read("git", "rev-parse", "origin/master").chomp
end
+ odie "Could not find start commit!" if start_commit.empty?
+
start_commit = Utils.popen_read("git", "rev-parse", start_commit).chomp
+ odie "Could not find start commit!" if start_commit.empty?
+
end_commit = Utils.popen_read("git", "rev-parse", "HEAD").chomp
+ odie "Could not find end commit!" if end_commit.empty?
puts "Start commit: #{start_commit}"
puts "End commit: #{end_commit}" | false |
Other | Homebrew | brew | 1f89a332132d8c33e6c9d86d90dbc79005256fce.json | ruby_requirement: fix path prepend | Library/Homebrew/requirements/ruby_requirement.rb | @@ -11,7 +11,7 @@ def initialize(tags)
satisfy(build_env: false) { new_enough_ruby }
env do
- ENV.prepend_path "PATH", new_enough_ruby
+ ENV.prepend_path "PATH", new_enough_ruby.dirname
end
def message | false |
Other | Homebrew | brew | 996dcdee2cacdfee90602387d5c5142d749f00de.json | Add pinned version to outdated json output
The structure should be consistent, so there are always pinned and
pinned_version fields even if there are no pinned versions for a given formula. | Library/Homebrew/cmd/outdated.rb | @@ -88,7 +88,9 @@ def print_outdated_json(formulae)
json << { name: f.full_name,
installed_versions: outdated_versions.collect(&:to_s),
- current_version: current_version }
+ current_version: current_version,
+ pinned: f.pinned?,
+ pinned_version: f.pinned_version }
end
puts JSON.generate(json)
| true |
Other | Homebrew | brew | 996dcdee2cacdfee90602387d5c5142d749f00de.json | Add pinned version to outdated json output
The structure should be consistent, so there are always pinned and
pinned_version fields even if there are no pinned versions for a given formula. | Library/Homebrew/test/cmd/outdated_spec.rb | @@ -38,4 +38,50 @@
.and be_a_success
end
end
+
+ context "json output" do
+ it "includes pinned version in the json output" do
+ setup_test_formula "testball"
+ (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
+
+ shutup do
+ expect { brew "pin", "testball" }.to be_a_success
+ end
+
+ expected_json = [
+ {
+ name: "testball",
+ installed_versions: ["0.0.1"],
+ current_version: "0.1",
+ pinned: true,
+ pinned_version: "0.0.1",
+ },
+ ].to_json
+
+ expect { brew "outdated", "--json=v1" }
+ .to output(expected_json + "\n").to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+
+ it "has no pinned version when the formula isn't pinned" do
+ setup_test_formula "testball"
+ (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
+
+ expected_json = [
+ {
+ name: "testball",
+ installed_versions: ["0.0.1"],
+ current_version: "0.1",
+ pinned: false,
+ pinned_version: nil,
+ },
+ ].to_json
+
+ expect { brew "outdated", "--json=v1" }
+ .to output(expected_json + "\n").to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
end | true |
Other | Homebrew | brew | 70446d9112c0d42ca1ab469af07716bb7281169e.json | Add pinned version to outdated output | Library/Homebrew/cmd/outdated.rb | @@ -64,7 +64,9 @@ def print_outdated(formulae)
"#{full_name} (#{kegs.map(&:version).join(", ")})"
end.join(", ")
- puts "#{outdated_versions} < #{current_version}"
+ pinned_version = " [pinned at #{f.pinned_version}]" if f.pinned?
+
+ puts "#{outdated_versions} < #{current_version}#{pinned_version}"
else
puts f.full_installed_specified_name
end | true |
Other | Homebrew | brew | 70446d9112c0d42ca1ab469af07716bb7281169e.json | Add pinned version to outdated output | Library/Homebrew/test/cmd/outdated_spec.rb | @@ -22,4 +22,20 @@
.and be_a_success
end
end
+
+ context "pinned formula, verbose output" do
+ it "prints out the pinned version" do
+ setup_test_formula "testball"
+ (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
+
+ shutup do
+ expect { brew "pin", "testball" }.to be_a_success
+ end
+
+ expect { brew "outdated", "--verbose" }
+ .to output("testball (0.0.1) < 0.1 [pinned at 0.0.1]\n").to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
end | true |
Other | Homebrew | brew | 755d43d46dc20b9e646909e08de482141de83777.json | Add test for verbose brew outdated output
Split the tests up into quiet and verbose output with contexts. | Library/Homebrew/test/cmd/outdated_spec.rb | @@ -1,11 +1,25 @@
describe "brew outdated", :integration_test do
- it "prints outdated Formulae" do
- setup_test_formula "testball"
- (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
+ context "quiet output" do
+ it "prints outdated Formulae" do
+ setup_test_formula "testball"
+ (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
- expect { brew "outdated" }
- .to output("testball\n").to_stdout
- .and not_to_output.to_stderr
- .and be_a_success
+ expect { brew "outdated" }
+ .to output("testball\n").to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
+
+ context "verbose output" do
+ it "prints out the installed and newer versions" do
+ setup_test_formula "testball"
+ (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
+
+ expect { brew "outdated", "--verbose" }
+ .to output("testball (0.0.1) < 0.1\n").to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
end
end | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.