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 | f40650ecd0ff54b6a710791db42884a3b982d0c1.json | Set the remote config manually
See 5cd6b35 and 8eefd4e. | Library/Homebrew/cmd/update.rb | @@ -79,7 +79,8 @@ def git_init_if_necessary
if Dir[".git/*"].empty?
safe_system "git", "init"
safe_system "git", "config", "core.autocrlf", "false"
- safe_system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew.git"
+ safe_system "git", "config", "remote.origin.url", "https://github.com/Homebrew/homebrew.git"
+ safe_system "git", "config", "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*"
safe_system "git", "fetch", "origin"
safe_system "git", "reset", "--hard", "origin/master"
end | false |
Other | Homebrew | brew | b7b8b88cea98ed4b24b813f13d7b06b538090fa6.json | Replace the build object rather than mutate it | Library/Homebrew/build_options.rb | @@ -1,7 +1,6 @@
require 'options'
class BuildOptions
- attr_accessor :args
attr_accessor :universal
def initialize(args, options)
@@ -15,7 +14,7 @@ def initialize_copy(other)
end
def include? name
- args.include? '--' + name
+ @args.include?("--#{name}")
end
def with? val | true |
Other | Homebrew | brew | b7b8b88cea98ed4b24b813f13d7b06b538090fa6.json | Replace the build object rather than mutate it | Library/Homebrew/dependency.rb | @@ -29,10 +29,9 @@ def hash
end
def to_formula
- f = Formulary.factory(name)
- # Add this dependency's options to the formula's build args
- f.build.args = f.build.args.concat(options)
- f
+ formula = Formulary.factory(name)
+ formula.build = BuildOptions.new(options, formula.options)
+ formula
end
def installed? | true |
Other | Homebrew | brew | b7b8b88cea98ed4b24b813f13d7b06b538090fa6.json | Replace the build object rather than mutate it | Library/Homebrew/formula_installer.rb | @@ -303,15 +303,9 @@ def expand_dependencies(deps)
end
def effective_build_options_for(dependent, inherited_options=[])
- if dependent == f
- build = dependent.build.dup
- build.args |= options
- build
- else
- build = dependent.build.dup
- build.args |= inherited_options
- build
- end
+ args = dependent.build.used_options
+ args |= dependent == f ? options : inherited_options
+ BuildOptions.new(args, dependent.options)
end
def inherited_options_for(dep) | true |
Other | Homebrew | brew | 045a02aa74bf4924ae7d2d2108a2cb89d75a6897.json | Use public api when adding legacy options | Library/Homebrew/formula.rb | @@ -597,7 +597,7 @@ def self.method_added method
specs.each do |spec|
instance.options.each do |opt, desc|
- spec.options << Option.new(opt[/^--(.+)$/, 1], desc)
+ spec.option(opt[/^--(.+)$/, 1], desc)
end
end
| false |
Other | Homebrew | brew | 2f1d40a76437f94720c9969d11ff10555efc5809.json | Disconnect defined options from the build object | Library/Homebrew/build_options.rb | @@ -1,7 +1,5 @@
require 'options'
-# This class holds the build-time options defined for a Formula,
-# and provides named access to those options during install.
class BuildOptions
include Enumerable
| true |
Other | Homebrew | brew | 2f1d40a76437f94720c9969d11ff10555efc5809.json | Disconnect defined options from the build object | Library/Homebrew/cmd/info.rb | @@ -127,7 +127,7 @@ def info_formula f
end
end
- unless f.build.empty?
+ unless f.options.empty?
ohai "Options"
Homebrew.dump_options_for_formula f
end | true |
Other | Homebrew | brew | 2f1d40a76437f94720c9969d11ff10555efc5809.json | Disconnect defined options from the build object | Library/Homebrew/cmd/options.rb | @@ -14,9 +14,9 @@ def options
def puts_options(formulae)
formulae.each do |f|
- next if f.build.empty?
+ next if f.options.empty?
if ARGV.include? '--compact'
- puts f.build.as_flags.sort * " "
+ puts f.options.as_flags.sort * " "
else
puts f.name if formulae.length > 1
dump_options_for_formula f
@@ -26,7 +26,7 @@ def puts_options(formulae)
end
def dump_options_for_formula f
- f.build.sort_by(&:flag).each do |opt|
+ f.options.sort_by(&:flag).each do |opt|
puts "#{opt.flag}\n\t#{opt.description}"
end
puts "--devel\n\tinstall development version #{f.devel.version}" if f.devel | true |
Other | Homebrew | brew | 2f1d40a76437f94720c9969d11ff10555efc5809.json | Disconnect defined options from the build object | Library/Homebrew/formula.rb | @@ -101,6 +101,10 @@ def patchlist
active_spec.patches
end
+ def options
+ active_spec.options
+ end
+
def option_defined?(name)
active_spec.option_defined?(name)
end
@@ -440,7 +444,7 @@ def to_hash
"caveats" => caveats
}
- hsh["options"] = build.map { |opt|
+ hsh["options"] = options.map { |opt|
{ "option" => opt.flag, "description" => opt.description }
}
| true |
Other | Homebrew | brew | 2f1d40a76437f94720c9969d11ff10555efc5809.json | Disconnect defined options from the build object | Library/Homebrew/formula_installer.rb | @@ -461,7 +461,7 @@ def sanitized_ARGV_options
when f.devel then args << "--devel"
end
- f.build.each do |opt, _|
+ f.options.each do |opt, _|
name = opt.name[/\A(.+)=\z$/, 1]
value = ARGV.value(name)
args << "--#{name}=#{value}" if name && value | true |
Other | Homebrew | brew | 2f1d40a76437f94720c9969d11ff10555efc5809.json | Disconnect defined options from the build object | Library/Homebrew/tab.rb | @@ -71,7 +71,7 @@ def self.for_formula f
def self.dummy_tab f=nil
Tab.new :used_options => [],
- :unused_options => (f.build.as_flags rescue []),
+ :unused_options => (f.options.as_flags rescue []),
:built_as_bottle => false,
:poured_from_bottle => false,
:tapped_from => "", | true |
Other | Homebrew | brew | d122ae8eea053b6f1074c34ce55ebc3dc26e0801.json | Handle legacy options in the method_added hook
We only need to process the legacy options at load time, not each time
the class is instantiated, and only when there is an options method
defined. | Library/Homebrew/formula.rb | @@ -37,7 +37,6 @@ def initialize(name, path, spec)
@active_spec = determine_active_spec(spec)
validate_attributes :url, :name, :version
- active_spec.add_legacy_options(options)
@pkg_version = PkgVersion.new(version, revision)
@pin = FormulaPin.new(self)
end
@@ -213,9 +212,6 @@ def post_install; end
# tell the user about any caveats regarding this package, return a string
def caveats; nil end
- # any e.g. configure options for this package
- def options; [] end
-
# Deprecated
DATA = :DATA
def patches; {} end
@@ -592,6 +588,14 @@ def self.method_added method
raise "You cannot override Formula#brew in class #{name}"
when :test
@test_defined = true
+ when :options
+ instance = allocate
+
+ specs.each do |spec|
+ instance.options.each do |opt, desc|
+ spec.options << Option.new(opt[/^--(.+)$/, 1], desc)
+ end
+ end
end
end
| true |
Other | Homebrew | brew | d122ae8eea053b6f1074c34ce55ebc3dc26e0801.json | Handle legacy options in the method_added hook
We only need to process the legacy options at load time, not each time
the class is instantiated, and only when there is an options method
defined. | Library/Homebrew/software_spec.rb | @@ -127,10 +127,6 @@ def add_dep_option(dep)
options << Option.new("without-#{name}", "Build without #{name} support")
end
end
-
- def add_legacy_options(list)
- list.each { |opt, desc| options << Option.new(opt[/^--(.+)$/, 1], desc) }
- end
end
class HeadSoftwareSpec < SoftwareSpec | true |
Other | Homebrew | brew | f306e56d214587b5ef6f6b5505b34280da19a075.json | Add a test for legacy options | Library/Homebrew/test/test_formula.rb | @@ -258,4 +258,20 @@ def test_raises_when_non_formula_constant_exists
Object.send(:remove_const, const)
end
end
+
+ def test_legacy_options
+ f = formula do
+ url "foo-1.0"
+
+ def options
+ [["--foo", "desc"], ["--bar", "desc"]]
+ end
+
+ option "baz"
+ end
+
+ assert f.option_defined?("foo")
+ assert f.option_defined?("bar")
+ assert f.option_defined?("baz")
+ end
end | false |
Other | Homebrew | brew | 47fedf2951d9579ffc3245b577d1ce51b147169a.json | Update tap README template | Library/Contributions/cmd/brew-tap-readme.rb | @@ -15,7 +15,7 @@
You can also install via URL:
```
-brew install https://raw.github.com/Homebrew/homebrew-#{name}/master/<formula>.rb
+brew install https://raw.githubusercontent.com/Homebrew/homebrew-#{name}/master/<formula>.rb
```
Docs | false |
Other | Homebrew | brew | 2a5218dacc4bc6ef574279d5ddf069c33b8b3802.json | Remove unnecessary lasgn | Library/Homebrew/build.rb | @@ -201,7 +201,7 @@ def detect_stdlibs
# of software installs an executable that links against libstdc++
# and dylibs against libc++, libc++-only dependencies can safely
# link against it.
- stdlibs = keg.detect_cxx_stdlibs :skip_executables => true
+ keg.detect_cxx_stdlibs(:skip_executables => true)
end
def fixopt f | false |
Other | Homebrew | brew | 47a82b036e43e7119fb52123a908b3af8e3af76a.json | Move tab creation outside of the debug loop | Library/Homebrew/build.rb | @@ -163,8 +163,6 @@ def install
begin
f.install
- stdlibs = detect_stdlibs
- Tab.create(f, ENV.compiler, stdlibs.first, f.build).write
rescue Exception => e
if ARGV.debug?
debrew e, f
@@ -173,6 +171,9 @@ def install
end
end
+ stdlibs = detect_stdlibs
+ Tab.create(f, ENV.compiler, stdlibs.first, f.build).write
+
# Find and link metafiles
f.prefix.install_metafiles Pathname.pwd
end | false |
Other | Homebrew | brew | e0f86a1a86ec3c42e53fa4b6d29753925aaf2e09.json | Pull effective arch detection into a method | Library/Homebrew/extend/ENV/std.rb | @@ -301,17 +301,19 @@ def set_cpu_flags flags, default=DEFAULT_FLAGS, map=Hardware::CPU.optimization_f
remove flags, %r{-mssse3}
remove flags, %r{-msse4(\.\d)?}
append flags, xarch unless xarch.empty?
+ append flags, map.fetch(effective_arch, default)
+ end
+ def effective_arch
if ARGV.build_bottle?
- arch = ARGV.bottle_arch || Hardware.oldest_cpu
- append flags, Hardware::CPU.optimization_flags.fetch(arch)
+ ARGV.bottle_arch || Hardware.oldest_cpu
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
# If the CPU doesn't support SSE4, we cannot trust -march=native or
# -march=<cpu family> to do the right thing because we might be running
# in a VM or on a Hackintosh.
- append flags, Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
+ Hardware.oldest_cpu
else
- append flags, map.fetch(Hardware::CPU.family, default)
+ Hardware::CPU.family
end
end
| false |
Other | Homebrew | brew | 2c9ad4578458a728ce28ef6eee8cd7c03dd9de30.json | doctor: retire Mono warning
We haven't actually had any complaints about this in awhile; it appears
that cmake no longer picks up this specific framework.
Refs Homebrew/homebrew#11030. | Library/Homebrew/cmd/doctor.rb | @@ -878,7 +878,7 @@ def check_for_linked_keg_only_brews
def check_for_other_frameworks
# Other frameworks that are known to cause problems when present
- %w{Mono.framework expat.framework libexpat.framework}.
+ %w{expat.framework libexpat.framework}.
map{ |frmwrk| "/Library/Frameworks/#{frmwrk}" }.
select{ |frmwrk| File.exist? frmwrk }.
map do |frmwrk| <<-EOS.undent | false |
Other | Homebrew | brew | af804f74759c44f220b4d88b1c0b27218f33110e.json | Remove another unnecessary default argument | Library/Homebrew/formula.rb | @@ -693,8 +693,8 @@ def skip_clean_paths
@skip_clean_paths ||= Set.new
end
- def keg_only reason, explanation=nil
- @keg_only_reason = KegOnlyReason.new(reason, explanation.to_s.chomp)
+ def keg_only reason, explanation=""
+ @keg_only_reason = KegOnlyReason.new(reason, explanation)
end
# Flag for marking whether this formula needs C++ standard library | true |
Other | Homebrew | brew | af804f74759c44f220b4d88b1c0b27218f33110e.json | Remove another unnecessary default argument | Library/Homebrew/formula_support.rb | @@ -4,9 +4,7 @@
# Used to annotate formulae that duplicate OS X provided software
# or cause conflicts when linked in.
class KegOnlyReason
- attr_reader :reason, :explanation
-
- def initialize reason, explanation=nil
+ def initialize(reason, explanation)
@reason = reason
@explanation = explanation
end
@@ -38,9 +36,9 @@ def to_s
#{@explanation}
EOS
when :provided_until_xcode43
- "Xcode provides this software prior to version 4.3.\n\n#{explanation}"
+ "Xcode provides this software prior to version 4.3.\n\n#{@explanation}"
when :provided_until_xcode5
- "Xcode provides this software prior to version 5.\n\n#{explanation}"
+ "Xcode provides this software prior to version 5.\n\n#{@explanation}"
else
@reason
end.strip | true |
Other | Homebrew | brew | 22d1f6516f977520ed67601ffde2bfecea746757.json | Remove a defensive to_s call
This method is only used internally and we always pass strings. | Library/Homebrew/build_options.rb | @@ -21,7 +21,7 @@ def initialize_copy(other)
end
def add(name, description)
- description ||= case name.to_s
+ description ||= case name
when "universal" then "Build a universal binary"
when "32-bit" then "Build 32-bit only"
when "c++11" then "Build using C++11 mode" | false |
Other | Homebrew | brew | dc9872eb834444664cc423a3e1ff167055ebd078.json | Remove default argument
This method is called in two places, always with two arguments. | Library/Homebrew/build_options.rb | @@ -20,7 +20,7 @@ def initialize_copy(other)
@args = other.args.dup
end
- def add name, description=nil
+ def add(name, description)
description ||= case name.to_s
when "universal" then "Build a universal binary"
when "32-bit" then "Build 32-bit only" | false |
Other | Homebrew | brew | acc1c35f35fb86957d56e19988fd4aeabae57b9e.json | Raise ArgumentError for argument errors | Library/Homebrew/software_spec.rb | @@ -78,8 +78,8 @@ def option_defined?(name)
def option name, description=nil
name = 'c++11' if name == :cxx11
name = name.to_s if Symbol === name
- raise "Option name is required." if name.empty?
- raise "Options should not start with dashes." if name[0, 1] == "-"
+ raise ArgumentError, "option name is required" if name.empty?
+ raise ArgumentError, "options should not start with dashes" if name.start_with?("-")
build.add(name, description)
end
| true |
Other | Homebrew | brew | acc1c35f35fb86957d56e19988fd4aeabae57b9e.json | Raise ArgumentError for argument errors | Library/Homebrew/test/test_software_spec.rb | @@ -48,11 +48,11 @@ def test_option
end
def test_option_raises_when_begins_with_dashes
- assert_raises(RuntimeError) { @spec.option('--foo') }
+ assert_raises(ArgumentError) { @spec.option("--foo") }
end
def test_option_raises_when_name_empty
- assert_raises(RuntimeError) { @spec.option('') }
+ assert_raises(ArgumentError) { @spec.option("") }
end
def test_option_accepts_symbols | true |
Other | Homebrew | brew | 20452f3edc22ede05814a7355d65c9ef4547b3b0.json | Add more test coverage for option descriptions | Library/Homebrew/test/test_software_spec.rb | @@ -66,6 +66,16 @@ def test_cxx11_option_special_case
refute @spec.option_defined?("cxx11")
end
+ def test_option_description
+ @spec.option("bar", "description")
+ assert_equal "description", @spec.options.first.description
+ end
+
+ def test_option_description_defaults_to_empty_string
+ @spec.option("foo")
+ assert_equal "", @spec.options.first.description
+ end
+
def test_depends_on
@spec.depends_on('foo')
assert_equal 'foo', @spec.deps.first.name | false |
Other | Homebrew | brew | fa88b9697c56166f03264f69e2b7a63492fb2564.json | Add a test for cxx11 option special case | Library/Homebrew/test/test_software_spec.rb | @@ -60,6 +60,12 @@ def test_option_accepts_symbols
assert @spec.option_defined?("foo")
end
+ def test_cxx11_option_special_case
+ @spec.option(:cxx11)
+ assert @spec.option_defined?("c++11")
+ refute @spec.option_defined?("cxx11")
+ end
+
def test_depends_on
@spec.depends_on('foo')
assert_equal 'foo', @spec.deps.first.name | false |
Other | Homebrew | brew | 22a98624d2d249add58c31833e1b4e452c242d03.json | utils: use the $stderr global variable.
For easier capturing.
Closes Homebrew/homebrew#31303.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/utils.rb | @@ -54,11 +54,11 @@ def oh1 title
end
def opoo warning
- STDERR.puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
+ $stderr.puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
end
def onoe error
- STDERR.puts "#{Tty.red}Error#{Tty.reset}: #{error}"
+ $stderr.puts "#{Tty.red}Error#{Tty.reset}: #{error}"
end
def ofail error | false |
Other | Homebrew | brew | f1cf62a4b5997fd86153d1c66963418bae46368c.json | Add predicate methods to Tab to match BuildOptions | Library/Homebrew/tab.rb | @@ -83,9 +83,9 @@ def self.dummy_tab f=nil
def with? name
if options.include? "with-#{name}"
- used_options.include? "with-#{name}"
+ include? "with-#{name}"
elsif options.include? "without-#{name}"
- not used_options.include? "without-#{name}"
+ not include? "without-#{name}"
else
false
end
@@ -100,7 +100,15 @@ def include? opt
end
def universal?
- used_options.include? "universal"
+ include?("universal")
+ end
+
+ def cxx11?
+ include?("c++11")
+ end
+
+ def build_32_bit?
+ include?("32-bit")
end
def used_options | false |
Other | Homebrew | brew | cf3c12dd5b23d8b44c56303ba1e4796be8b3b3c0.json | Add inspect to CxxStdlib | Library/Homebrew/cxxstdlib.rb | @@ -51,6 +51,10 @@ def type_string
type.to_s.gsub(/cxx$/, 'c++')
end
+ def inspect
+ "#<#{self.class.name}: #{compiler} #{type}>"
+ end
+
class AppleStdlib < CxxStdlib
def apple_compiler?
true | false |
Other | Homebrew | brew | 9aac71045c3f138a50d1dd042bb6bd7696f65ba6.json | Add inspect to CompilerFailure | Library/Homebrew/compilers.rb | @@ -52,6 +52,10 @@ def ===(compiler)
name == compiler.name && version >= compiler.version
end
+ def inspect
+ "#<#{self.class.name}: #{name} #{version}>"
+ end
+
MESSAGES = {
:cxx11 => "This compiler does not support C++11"
} | false |
Other | Homebrew | brew | 5a2ae61e66e517e1688ddcbc7c2ac822d780bbd5.json | Add another TODO | Library/Homebrew/extend/ENV/shared.rb | @@ -136,6 +136,8 @@ def validate_cc!(formula)
# selector will be invoked if the formula fails with any version of clang.
# I think we can safely remove this conditional and always invoke the
# selector.
+ # The compiler priority logic in compilers.rb and default_compiler logic in
+ # os/mac.rb need to be unified somehow.
if formula.fails_with? Compiler.new(compiler)
send CompilerSelector.new(formula).compiler
end | false |
Other | Homebrew | brew | eb528fd7cd01baac4fb0bcdf13ab2c0ab8f6c568.json | Eliminate a nil check | Library/Homebrew/compilers.rb | @@ -3,7 +3,16 @@ module CompilerConstants
GNU_GCC_REGEXP = /^gcc-(4\.[3-9])$/
end
-Compiler = Struct.new(:name, :version, :priority)
+# TODO make this class private to CompilerSelector
+class Compiler
+ attr_reader :name, :version, :priority
+
+ def initialize(name, version=0, priority=0)
+ @name = name
+ @version = version
+ @priority = priority
+ end
+end
class CompilerFailure
attr_reader :name
@@ -40,7 +49,7 @@ def initialize(name, version, &block)
end
def ===(compiler)
- name == compiler.name && version >= (compiler.version || 0)
+ name == compiler.name && version >= compiler.version
end
MESSAGES = { | false |
Other | Homebrew | brew | d54bce6a1af251a32f759e2017e0f4d1bc8d8c53.json | Remove dead code | Library/Homebrew/compilers.rb | @@ -121,12 +121,10 @@ def compiler
def priority_for(cc)
case cc
- when :clang then @versions.clang_build_version >= 318 ? 3 : 0.5
- when :gcc then 2.5
- when :llvm then 2
+ when :clang then @versions.clang_build_version >= 318 ? 3 : 0.5
+ when :gcc then 2.5
+ when :llvm then 2
when :gcc_4_0 then 0.25
- # non-Apple gcc compilers
- else 1.5
end
end
end | false |
Other | Homebrew | brew | b6e9600b9fbcb1f86bc43d78fb461a1247e9aacd.json | Eliminate consideration of major_version
The major version is implicit in the compiler name. Since the name is
used when matching failures to compilers, we don't need to consider the
major version separately. | Library/Homebrew/compilers.rb | @@ -3,13 +3,7 @@ module CompilerConstants
GNU_GCC_REGEXP = /^gcc-(4\.[3-9])$/
end
-class Compiler < Struct.new(:name, :version, :priority)
- # The major version for non-Apple compilers. Used to indicate a compiler
- # series; for instance, if the version is 4.8.2, it would return "4.8".
- def major_version
- version.match(/(\d\.\d)/)[0] if name.is_a? String
- end
-end
+Compiler = Struct.new(:name, :version, :priority)
class CompilerFailure
attr_reader :name
@@ -32,12 +26,11 @@ def self.create(spec, &block)
name = "gcc-#{major_version}"
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
version = "#{major_version}.999"
- GnuCompilerFailure.new(name, major_version, version, &block)
else
name = spec
version = 9999
- new(name, version, &block)
end
+ new(name, version, &block)
end
def initialize(name, version, &block)
@@ -50,19 +43,6 @@ def ===(compiler)
name == compiler.name && version >= (compiler.version || 0)
end
- class GnuCompilerFailure < CompilerFailure
- attr_reader :major_version
-
- def initialize(name, major_version, version, &block)
- @major_version = major_version
- super(name, version, &block)
- end
-
- def ===(compiler)
- super && major_version == compiler.major_version
- end
- end
-
MESSAGES = {
:cxx11 => "This compiler does not support C++11"
} | false |
Other | Homebrew | brew | 4580d86809095a236839d1de55e47e5dc98b7987.json | Use a separate class for GNU compiler failures
major_version is now only used internally by the failure object | Library/Homebrew/compilers.rb | @@ -12,7 +12,7 @@ def major_version
end
class CompilerFailure
- attr_reader :name, :major_version
+ attr_reader :name
attr_rw :cause, :version
# Allows Apple compiler `fails_with` statements to keep using `build`
@@ -32,26 +32,35 @@ def self.create(spec, &block)
name = "gcc-#{major_version}"
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
version = "#{major_version}.999"
+ GnuCompilerFailure.new(name, major_version, version, &block)
else
name = spec
version = 9999
- major_version = nil
+ new(name, version, &block)
end
-
- new(name, version, major_version, &block)
end
- def initialize(name, version, major_version, &block)
+ def initialize(name, version, &block)
@name = name
@version = version
- @major_version = major_version
instance_eval(&block) if block_given?
end
def ===(compiler)
- name == compiler.name &&
- major_version == compiler.major_version &&
- version >= (compiler.version || 0)
+ name == compiler.name && version >= (compiler.version || 0)
+ end
+
+ class GnuCompilerFailure < CompilerFailure
+ attr_reader :major_version
+
+ def initialize(name, major_version, version, &block)
+ @major_version = major_version
+ super(name, version, &block)
+ end
+
+ def ===(compiler)
+ super && major_version == compiler.major_version
+ end
end
MESSAGES = { | false |
Other | Homebrew | brew | fded4d0385171877bc6e60a2f265a2095be652da.json | Remove an is_a check | Library/Homebrew/extend/ENV/shared.rb | @@ -130,7 +130,13 @@ def determine_cc
# an alternate compiler, altering the value of environment variables.
# If no valid compiler is found, raises an exception.
def validate_cc!(formula)
- if formula.fails_with? compiler
+ # FIXME
+ # The compiler object we pass to fails_with? has no version information
+ # attached to it. This means that if we pass Compiler.new(:clang), the
+ # selector will be invoked if the formula fails with any version of clang.
+ # I think we can safely remove this conditional and always invoke the
+ # selector.
+ if formula.fails_with? Compiler.new(compiler)
send CompilerSelector.new(formula).compiler
end
end | true |
Other | Homebrew | brew | fded4d0385171877bc6e60a2f265a2095be652da.json | Remove an is_a check | Library/Homebrew/formula.rb | @@ -232,7 +232,6 @@ def keg_only_reason
end
def fails_with? cc
- cc = Compiler.new(cc) unless cc.is_a? Compiler
(self.class.cc_failures || []).any? do |failure|
# Major version check distinguishes between, e.g.,
# GCC 4.7.1 and GCC 4.8.2, where a comparison is meaningless | true |
Other | Homebrew | brew | 5b38e891073fa324a09d31178c789b2453da54bf.json | Simplify compatibility logic | Library/Homebrew/cxxstdlib.rb | @@ -27,14 +27,8 @@ def compatible_with?(other)
return false unless type == other.type
- if apple_compiler?
- return false unless other.apple_compiler?
- else
- return false if other.apple_compiler?
- return false unless compiler.to_s[4..6] == other.compiler.to_s[4..6]
- end
-
- true
+ apple_compiler? && other.apple_compiler? ||
+ !other.apple_compiler? && compiler.to_s[4..6] == other.compiler.to_s[4..6]
end
def check_dependencies(formula, deps) | false |
Other | Homebrew | brew | 018aeb05ab74629f761741e51436a358db6feb9d.json | Drop unnecessary parens | Library/Homebrew/cxxstdlib.rb | @@ -23,7 +23,7 @@ def initialize(type, compiler)
# libstdc++ is compatible across Apple compilers, but
# not between Apple and GNU compilers, or between GNU compiler versions
def compatible_with?(other)
- (type.nil? || other.type.nil?) || type == other.type
+ type.nil? || other.type.nil? || type == other.type
end
def check_dependencies(formula, deps) | false |
Other | Homebrew | brew | c003e805bea98f6d0be62c0938ccad4f4a7e4ce0.json | add helpers for formula tests | Library/Homebrew/cmd/test.rb | @@ -25,6 +25,8 @@ module Homebrew
FailedAssertion = Test::Unit::AssertionFailedError
end
+ require "formula_assertions"
+
def test
raise FormulaUnspecifiedError if ARGV.named.empty?
@@ -47,6 +49,7 @@ def test
puts "Testing #{f.name}"
f.extend(Test::Unit::Assertions)
+ f.extend(Homebrew::Assertions)
begin
# tests can also return false to indicate failure | true |
Other | Homebrew | brew | c003e805bea98f6d0be62c0938ccad4f4a7e4ce0.json | add helpers for formula tests | Library/Homebrew/formula_assertions.rb | @@ -0,0 +1,23 @@
+require 'test/unit/assertions'
+
+module Homebrew
+ module Assertions
+ include Test::Unit::Assertions
+
+ # Returns the output of running cmd, and asserts the exit status
+ def shell_output(cmd, result=0)
+ output = `#{cmd}`
+ assert_equal result, $?.exitstatus
+ output
+ end
+
+ # Returns the output of running the cmd, with the optional input
+ def pipe_output(cmd, input=nil)
+ IO.popen(cmd, "w+") do |pipe|
+ pipe.write(input) unless input.nil?
+ pipe.close_write
+ pipe.read
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | fad2e26395f09d78e51a9da5965e28d72b3c9cc2.json | Reduce direct accesses of the args collection | Library/Homebrew/build_options.rb | @@ -81,15 +81,15 @@ def without? name
end
def bottle?
- args.include? '--build-bottle'
+ include? "build-bottle"
end
def head?
- args.include? '--HEAD'
+ include? "HEAD"
end
def devel?
- args.include? '--devel'
+ include? "devel"
end
def stable?
@@ -98,19 +98,19 @@ def stable?
# True if the user requested a universal build.
def universal?
- universal || args.include?('--universal') && has_option?('universal')
+ universal || include?("universal") && has_option?("universal")
end
# True if the user requested to enable C++11 mode.
def cxx11?
- args.include?('--c++11') && has_option?('c++11')
+ include?("c++11") && has_option?("c++11")
end
# Request a 32-bit only build.
# This is needed for some use-cases though we prefer to build Universal
# when a 32-bit version is needed.
def build_32_bit?
- args.include?('--32-bit') && has_option?('32-bit')
+ include?("32-bit") && has_option?("32-bit")
end
def used_options | false |
Other | Homebrew | brew | 5ccce044ca04b9586667b538f818d4a018f21fa7.json | Use the tab in place of build during tests | Library/Homebrew/formula.rb | @@ -479,9 +479,7 @@ def verify_download_integrity fn
end
def test
- # Adding the used options allows us to use `build.with?` inside of tests
- tab = Tab.for_name(name)
- tab.used_options.each { |opt| build.args << opt unless build.has_opposite_of? opt }
+ @build = Tab.for_formula(self)
ret = nil
mktemp do
@testpath = Pathname.pwd | false |
Other | Homebrew | brew | 393e10849be14528ee1726e5659562a698686c92.json | Pass the build object into the Tab
Since the Tab is written in the build process, the formula's build
object will have the correct args attached to it already, so we don't
need to reconstruct it. | Library/Homebrew/build.rb | @@ -186,8 +186,7 @@ def install
# link against it.
stdlibs = keg.detect_cxx_stdlibs :skip_executables => true
- Tab.create(f, ENV.compiler, stdlibs.first,
- Options.coerce(ARGV.options_only)).write
+ Tab.create(f, ENV.compiler, stdlibs.first, f.build).write
rescue Exception => e
if ARGV.debug?
debrew e, f | true |
Other | Homebrew | brew | 393e10849be14528ee1726e5659562a698686c92.json | Pass the build object into the Tab
Since the Tab is written in the build process, the formula's build
object will have the correct args attached to it already, so we don't
need to reconstruct it. | Library/Homebrew/tab.rb | @@ -10,16 +10,13 @@
class Tab < OpenStruct
FILENAME = 'INSTALL_RECEIPT.json'
- def self.create f, compiler, stdlib, args
- build = f.build.dup
- build.args = args
-
+ def self.create(formula, compiler, stdlib, build)
Tab.new :used_options => build.used_options,
:unused_options => build.unused_options,
- :tabfile => f.prefix.join(FILENAME),
+ :tabfile => formula.prefix.join(FILENAME),
:built_as_bottle => !!ARGV.build_bottle?,
:poured_from_bottle => false,
- :tapped_from => f.tap,
+ :tapped_from => formula.tap,
:time => Time.now.to_i,
:HEAD => Homebrew.git_head,
:compiler => compiler, | true |
Other | Homebrew | brew | dd331245ab334b2e3fde162b51c3b8b63f065548.json | Remove unused accessor | Library/Homebrew/build_options.rb | @@ -7,7 +7,6 @@ class BuildOptions
attr_accessor :args
attr_accessor :universal
- attr_accessor :cxx11
attr_reader :options
protected :options
@@ -104,7 +103,7 @@ def universal?
# True if the user requested to enable C++11 mode.
def cxx11?
- cxx11 || args.include?('--c++11') && has_option?('c++11')
+ args.include?('--c++11') && has_option?('c++11')
end
# Request a 32-bit only build. | false |
Other | Homebrew | brew | ba4a4e41034be1bde963defa09c295aeabdf2d9c.json | Limit exposure of the options data structures | Library/Homebrew/cmd/doctor.rb | @@ -1006,7 +1006,7 @@ def check_for_non_prefixed_coreutils
end
def check_for_non_prefixed_findutils
- default_names = Tab.for_name('findutils').used_options.include? 'default-names'
+ default_names = Tab.for_name('findutils').include? 'default-names'
if default_names then <<-EOS.undent
Putting non-prefixed findutils in your path can cause python builds to fail.
EOS | false |
Other | Homebrew | brew | c1ba34734db8b98693651300bd19300a90e2ddb8.json | Remove unused require | Library/Homebrew/build.rb | @@ -26,7 +26,6 @@ def main
trap("INT", STD_TRAP) # restore default CTRL-C handler
- require 'hardware'
require 'keg'
require 'extend/ENV'
| false |
Other | Homebrew | brew | a55e196f5f72ef0b1c829007c9b4a68de5c06ef0.json | Simplify internal representation of patches
- remove support for IO objects, since we no longer access ::DATA
directly
- since we don't need to support IO objects, use a separate class for
string patches and stop wrapping strings in StringIO ojects | Library/Homebrew/formula.rb | @@ -671,8 +671,8 @@ def option name, description=nil
specs.each { |spec| spec.option(name, description) }
end
- def patch strip=:p1, io=nil, &block
- specs.each { |spec| spec.patch(strip, io, &block) }
+ def patch strip=:p1, src=nil, &block
+ specs.each { |spec| spec.patch(strip, src, &block) }
end
def plist_options options | true |
Other | Homebrew | brew | a55e196f5f72ef0b1c829007c9b4a68de5c06ef0.json | Simplify internal representation of patches
- remove support for IO objects, since we no longer access ::DATA
directly
- since we don't need to support IO objects, use a separate class for
string patches and stop wrapping strings in StringIO ojects | Library/Homebrew/patch.rb | @@ -1,24 +1,19 @@
require 'resource'
-require 'stringio'
require 'erb'
module Patch
- def self.create(strip, io, &block)
+ def self.create(strip, src, &block)
case strip
when :DATA
DATAPatch.new(:p1)
- when IO, StringIO
- IOPatch.new(strip, :p1)
when String
- IOPatch.new(StringIO.new(strip), :p1)
+ StringPatch.new(:p1, strip)
when Symbol
- case io
+ case src
when :DATA
DATAPatch.new(strip)
- when IO, StringIO
- IOPatch.new(io, strip)
when String
- IOPatch.new(StringIO.new(io), strip)
+ StringPatch.new(strip, src)
else
ExternalPatch.new(strip, &block)
end
@@ -53,43 +48,38 @@ def self.normalize_legacy_patches(list)
end
end
-class IOPatch
+class EmbeddedPatch
attr_writer :owner
attr_reader :strip
+ def initialize(strip)
+ @strip = strip
+ end
+
def external?
false
end
- def initialize(io, strip)
- @io = io
- @strip = strip
+ def contents
+ raise NotImplementedError
end
def apply
data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX)
IO.popen("/usr/bin/patch -g 0 -f -#{strip}", "w") { |p| p.write(data) }
raise ErrorDuringExecution, "Applying DATA patch failed" unless $?.success?
- ensure
- # IO and StringIO cannot be marshaled, so remove the reference
- # in case we are indirectly referenced by an exception later.
- @io = nil
- end
-
- def contents
- @io.read
end
def inspect
"#<#{self.class.name}: #{strip.inspect}>"
end
end
-class DATAPatch < IOPatch
+class DATAPatch < EmbeddedPatch
attr_accessor :path
def initialize(strip)
- @strip = strip
+ super
@path = nil
end
@@ -105,6 +95,17 @@ def contents
end
end
+class StringPatch < EmbeddedPatch
+ def initialize(strip, str)
+ super(strip)
+ @str = str
+ end
+
+ def contents
+ @str
+ end
+end
+
class ExternalPatch
attr_reader :resource, :strip
| true |
Other | Homebrew | brew | a55e196f5f72ef0b1c829007c9b4a68de5c06ef0.json | Simplify internal representation of patches
- remove support for IO objects, since we no longer access ::DATA
directly
- since we don't need to support IO objects, use a separate class for
string patches and stop wrapping strings in StringIO ojects | Library/Homebrew/software_spec.rb | @@ -90,8 +90,8 @@ def requirements
dependency_collector.requirements
end
- def patch strip=:p1, io=nil, &block
- patches << Patch.create(strip, io, &block)
+ def patch strip=:p1, src=nil, &block
+ patches << Patch.create(strip, src, &block)
end
def add_legacy_patches(list) | true |
Other | Homebrew | brew | a55e196f5f72ef0b1c829007c9b4a68de5c06ef0.json | Simplify internal representation of patches
- remove support for IO objects, since we no longer access ::DATA
directly
- since we don't need to support IO objects, use a separate class for
string patches and stop wrapping strings in StringIO ojects | Library/Homebrew/test/test_patch.rb | @@ -9,28 +9,15 @@ def test_create_simple
assert_equal :p2, patch.strip
end
- def test_create_io
- patch = Patch.create(:p0, StringIO.new("foo"))
- assert_kind_of IOPatch, patch
- refute_predicate patch, :external?
- assert_equal :p0, patch.strip
- end
-
- def test_create_io_without_strip
- patch = Patch.create(StringIO.new("foo"), nil)
- assert_kind_of IOPatch, patch
- assert_equal :p1, patch.strip
- end
-
def test_create_string
patch = Patch.create(:p0, "foo")
- assert_kind_of IOPatch, patch
+ assert_kind_of StringPatch, patch
assert_equal :p0, patch.strip
end
def test_create_string_without_strip
patch = Patch.create("foo", nil)
- assert_kind_of IOPatch, patch
+ assert_kind_of StringPatch, patch
assert_equal :p1, patch.strip
end
| true |
Other | Homebrew | brew | 8a971f72686298ba44d427ba65823a6e70b2a4d8.json | Move the fixopt method into the Build class | Library/Homebrew/build.rb | @@ -208,19 +208,19 @@ def install
end
end
end
-end
-def fixopt f
- path = if f.linked_keg.directory? and f.linked_keg.symlink?
- f.linked_keg.resolved_path
- elsif f.prefix.directory?
- f.prefix
- elsif (kids = f.rack.children).size == 1 and kids.first.directory?
- kids.first
- else
- raise
+ def fixopt f
+ path = if f.linked_keg.directory? and f.linked_keg.symlink?
+ f.linked_keg.resolved_path
+ elsif f.prefix.directory?
+ f.prefix
+ elsif (kids = f.rack.children).size == 1 and kids.first.directory?
+ kids.first
+ else
+ raise
+ end
+ Keg.new(path).optlink
+ rescue StandardError
+ raise "#{f.opt_prefix} not present or broken\nPlease reinstall #{f}. Sorry :("
end
- Keg.new(path).optlink
-rescue StandardError
- raise "#{f.opt_prefix} not present or broken\nPlease reinstall #{f}. Sorry :("
end | false |
Other | Homebrew | brew | 90f69372ce046f52d9da0ee3b059d3526c12c3e6.json | Remove inheritance patch classes | Library/Homebrew/patch.rb | @@ -48,22 +48,19 @@ def self.normalize_legacy_patches(list)
patches
end
-
- attr_reader :whence
-
- def external?
- whence == :resource
- end
end
-class IOPatch < Patch
+class IOPatch
attr_writer :owner
attr_reader :strip
+ def external?
+ false
+ end
+
def initialize(io, strip)
@io = io
@strip = strip
- @whence = :io
end
def apply
@@ -83,13 +80,16 @@ def inspect
end
end
-class ExternalPatch < Patch
+class ExternalPatch
attr_reader :resource, :strip
def initialize(strip, &block)
@strip = strip
@resource = Resource.new("patch", &block)
- @whence = :resource
+ end
+
+ def external?
+ true
end
def owner= owner | false |
Other | Homebrew | brew | 5b8e564d7053220498ac8430cbffe69cfd5ec986.json | Add test for reporting tap updates | Library/Homebrew/test/fixtures/updater_fixture.yaml | @@ -43,3 +43,15 @@ update_git_diff_output_with_changed_filetype: |
update_git_diff_output_with_restructured_tap: |
R100 git.rb Formula/git.rb
R100 lua.rb Formula/lua.rb
+update_git_diff_output_with_tap_formulae_changes: |
+ M Rakefile
+ M README.md
+ M Requirements/some_requirement.rb
+ D another_ruby_file.rb
+ A a_ruby_file.rb
+ A CONTRIBUTING.md
+ M Formula/git.rb
+ A Formula/lua.rb
+ M lib/not_a_formula.rb
+ A lib/not_a_formula2.rb
+ D lib/not_a_formula3.rb | true |
Other | Homebrew | brew | 5b8e564d7053220498ac8430cbffe69cfd5ec986.json | Add test for reporting tap updates | Library/Homebrew/test/test_updater.rb | @@ -100,4 +100,22 @@ def test_update_homebrew_with_restructured_tap
assert_equal %w{foo/bar/git foo/bar/lua}, @report.select_formula(:A)
assert_equal %w{foo/bar/git foo/bar/lua}, @report.select_formula(:D)
end
+
+ def test_update_homebrew_with_tap_formulae_changes
+ repo = HOMEBREW_LIBRARY.join("Taps", "foo", "bar")
+ @updater = UpdaterMock.new(repo)
+ repo.join("Formula").mkpath
+
+ perform_update("update_git_diff_output_with_tap_formulae_changes")
+
+ assert_equal %w{foo/bar/lua}, @report.select_formula(:A)
+ assert_equal %w{foo/bar/git}, @report.select_formula(:M)
+ assert_empty @report.select_formula(:D)
+
+ assert_empty @report.removed_tapped_formula
+ assert_equal [repo.join("Formula", "lua.rb")],
+ @report.new_tapped_formula
+ assert_equal [repo.join("Formula", "git.rb")],
+ @report.tapped_formula_for(:M)
+ end
end | true |
Other | Homebrew | brew | 87850d00cda177e15d94c48655b182cc74cb7af2.json | Remove obsolete hacks from updater report | Library/Homebrew/cmd/update.rb | @@ -254,25 +254,7 @@ def dump
end
def tapped_formula_for key
- fetch(key, []).select do |path|
- case path.to_s
- when HOMEBREW_TAP_PATH_REGEX
- valid_formula_location?("#{$1}/#{$2}/#{$3}")
- else
- false
- end
- end.compact
- end
-
- def valid_formula_location?(relative_path)
- parts = relative_path.split('/')[2..-1]
- return false unless File.extname(parts.last) == ".rb"
- case parts.first
- when "Formula", "HomebrewFormula"
- parts.length == 2
- else
- parts.length == 1
- end
+ fetch(key, []).select { |path| HOMEBREW_TAP_PATH_REGEX === path.to_s }
end
def new_tapped_formula
@@ -286,19 +268,19 @@ def removed_tapped_formula
def select_formula key
fetch(key, []).map do |path|
case path.to_s
- when %r{^#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Formula}o
- path.basename(".rb").to_s
when HOMEBREW_TAP_PATH_REGEX
"#{$1}/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}"
+ else
+ path.basename(".rb").to_s
end
- end.compact.sort
+ end.sort
end
def dump_formula_report key, title
formula = select_formula(key)
unless formula.empty?
ohai title
- puts_columns formula.uniq
+ puts_columns formula
end
end
end | false |
Other | Homebrew | brew | 6baf357f8c196dcf26cc3f4a877bd992dbb55e3a.json | update: remove unused rename detection
Right now this code only produces false positives. When we have real
support for renames, we can implement it more carefully.
Closes Homebrew/homebrew#31126. | Library/Homebrew/cmd/update.rb | @@ -172,12 +172,8 @@ def report
map = Hash.new{ |h,k| h[k] = [] }
if initial_revision && initial_revision != current_revision
- `git diff-tree -r --name-status -M85% #{initial_revision} #{current_revision}`.each_line do |line|
- status, path, renamed = line.split
- if renamed
- status = status[0, 1]
- path = renamed
- end
+ `git diff-tree -r --name-status --diff-filter=AMD #{initial_revision} #{current_revision}`.each_line do |line|
+ status, path = line.split
map[status.to_sym] << repository.join(path)
end
end
@@ -226,7 +222,6 @@ def dump
dump_formula_report :A, "New Formulae"
dump_formula_report :M, "Updated Formulae"
dump_formula_report :D, "Deleted Formulae"
- dump_formula_report :R, "Renamed Formulae"
end
def tapped_formula_for key | true |
Other | Homebrew | brew | 6baf357f8c196dcf26cc3f4a877bd992dbb55e3a.json | update: remove unused rename detection
Right now this code only produces false positives. When we have real
support for renames, we can implement it more carefully.
Closes Homebrew/homebrew#31126. | Library/Homebrew/test/fixtures/updater_fixture.yaml | @@ -12,7 +12,6 @@ update_git_diff_output_with_formulae_changes: |
A Library/Formula/ddrescue.rb
A Library/Formula/dict.rb
A Library/Formula/lua.rb
- R094 Library/Formula/shapefile.rb Library/Formula/shapelib.rb
M Library/Formula/xar.rb
M Library/Formula/yajl.rb
M Library/Homebrew/ARGV+yeast.rb | true |
Other | Homebrew | brew | 6baf357f8c196dcf26cc3f4a877bd992dbb55e3a.json | update: remove unused rename detection
Right now this code only produces false positives. When we have real
support for renames, we can implement it more carefully.
Closes Homebrew/homebrew#31126. | Library/Homebrew/test/test_updater.rb | @@ -56,7 +56,7 @@ def perform_update(diff_output="")
@updater.in_repo_expect("git config core.autocrlf false")
@updater.in_repo_expect("git pull -q origin refs/heads/master:refs/remotes/origin/master")
@updater.in_repo_expect("git rev-parse -q --verify HEAD", "3456cdef")
- @updater.in_repo_expect("git diff-tree -r --name-status -M85% 1234abcd 3456cdef", diff_output)
+ @updater.in_repo_expect("git diff-tree -r --name-status --diff-filter=AMD 1234abcd 3456cdef", diff_output)
@updater.pull!
@report.update(@updater.report)
end
@@ -73,15 +73,14 @@ def test_update_homebrew_without_formulae_changes
assert_predicate @updater, :expectations_met?
assert_empty @report.select_formula(:M)
assert_empty @report.select_formula(:A)
- assert_empty @report.select_formula(:R)
+ assert_empty @report.select_formula(:D)
end
def test_update_homebrew_with_formulae_changes
perform_update(fixture('update_git_diff_output_with_formulae_changes'))
assert_predicate @updater, :expectations_met?
assert_equal %w{ xar yajl }, @report.select_formula(:M)
assert_equal %w{ antiword bash-completion ddrescue dict lua }, @report.select_formula(:A)
- assert_equal %w{ shapelib }, @report.select_formula(:R)
end
def test_update_homebrew_with_tapped_formula_changes | true |
Other | Homebrew | brew | 2cf116464dcdd68c10e8a9e6f918568cf594a588.json | update: simplify diff parsing | Library/Homebrew/cmd/update.rb | @@ -168,20 +168,17 @@ def reset_on_interrupt
end
end
- # Matches raw git diff format (see `man git-diff-tree`)
- DIFFTREE_RX = /^:[0-7]{6} [0-7]{6} [0-9a-fA-F]{40} [0-9a-fA-F]{40} ([ACDMRTUX])\d{0,3}\t(.+?)(?:\t(.+))?$/
-
def report
map = Hash.new{ |h,k| h[k] = [] }
if initial_revision && initial_revision != current_revision
- `git diff-tree -r --raw -M85% #{initial_revision} #{current_revision}`.each_line do |line|
- DIFFTREE_RX.match line
- path = case status = $1.to_sym
- when :R then $3
- else $2
- end
- map[status] << repository.join(path)
+ `git diff-tree -r --name-status -M85% #{initial_revision} #{current_revision}`.each_line do |line|
+ status, path, renamed = line.split
+ if renamed
+ status = status[0, 1]
+ path = renamed
+ end
+ map[status.to_sym] << repository.join(path)
end
end
| true |
Other | Homebrew | brew | 2cf116464dcdd68c10e8a9e6f918568cf594a588.json | update: simplify diff parsing | Library/Homebrew/test/fixtures/updater_fixture.yaml | @@ -1,49 +1,49 @@
update_git_diff_output_without_formulae_changes: |
- :100644 100644 9dde0708e2db78e1aa697782bd2ab2ddfd8da984 ee0a81cbe3757e9a4b5aab1c41457f65fed9f258 M Library/Homebrew/ARGV+yeast.rb
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Homebrew/beer_events.rb
- :100644 100644 b4b6d4f7837585bea2608da6eac4864bc410b319 f2f02310189f2114c033fd50e453aabbaa5ec111 A Library/Homebrew/hardware.rb
- :100644 100644 69b22663da0e9060c18143d96d37ab2f5d618579 d18b0e7161b73e7e1a0090b6d1d42a2569efb682 D Library/Homebrew/hw.model.c
- :100644 100644 0bdadb080de7bfb1dd0d5ef5aafbc65da35791ae 39b3e237b773d7eed584996d7c2541de0f36996c M README
- :100644 100644 5bec138e6ce67d3d80446740c309ef40652cebc2 0955e96cb368c95a73f2b01bfd060e575c445152 M bin/brew
+ M Library/Homebrew/ARGV+yeast.rb
+ A Library/Homebrew/beer_events.rb
+ A Library/Homebrew/hardware.rb
+ D Library/Homebrew/hw.model.c
+ M README
+ M bin/brew
update_git_diff_output_with_formulae_changes: |
- :100644 100644 9dde0708e2db78e1aa697782bd2ab2ddfd8da984 ee0a81cbe3757e9a4b5aab1c41457f65fed9f258 M Library/Contributions/brew_bash_completion.sh
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Formula/antiword.rb
- :100644 100644 b4b6d4f7837585bea2608da6eac4864bc410b319 f2f02310189f2114c033fd50e453aabbaa5ec111 A Library/Formula/bash-completion.rb
- :100644 100644 9dde0708e2db78e1aa697782bd2ab2ddfd8da984 ee0a81cbe3757e9a4b5aab1c41457f65fed9f258 A Library/Formula/ddrescue.rb
- :100644 100644 a054cd648c85515484aee25ba22611423b603c69 e0b6354360bff68a6c5a612bf6e2918ceeb2ea0a A Library/Formula/dict.rb
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Formula/lua.rb
- :100644 100644 27740424d7cd046815eb67d253e08641d0c80fc7 d75a4b08302a9d0c741f969aa784878eb45d8366 R094 Library/Formula/shapefile.rb Library/Formula/shapelib.rb
- :100644 100644 69b22663da0e9060c18143d96d37ab2f5d618579 d18b0e7161b73e7e1a0090b6d1d42a2569efb682 M Library/Formula/xar.rb
- :100644 100644 0bdadb080de7bfb1dd0d5ef5aafbc65da35791ae 39b3e237b773d7eed584996d7c2541de0f36996c M Library/Formula/yajl.rb
- :100644 100644 5bec138e6ce67d3d80446740c309ef40652cebc2 0955e96cb368c95a73f2b01bfd060e575c445152 M Library/Homebrew/ARGV+yeast.rb
- :100644 100644 b4b6d4f7837585bea2608da6eac4864bc410b319 f2f02310189f2114c033fd50e453aabbaa5ec111 M Library/Homebrew/beer_events.rb
- :100644 100644 de9faee9b6859d0f4146b60caff1e7643af01a4c 47976729f566a14290d5efe061bbe4547e2d1b9e M Library/Homebrew/hardware.rb
- :100644 100644 69b22663da0e9060c18143d96d37ab2f5d618579 d18b0e7161b73e7e1a0090b6d1d42a2569efb682 M Library/Homebrew/hw.model.c
- :100644 100644 0bdadb080de7bfb1dd0d5ef5aafbc65da35791ae 39b3e237b773d7eed584996d7c2541de0f36996c M Library/Homebrew/hw.model.rb
- :100644 100644 0811641e6101d39b2d832539de01a104e052a97e dc66b94c51c1c2750d4a31e83c41f100c4d079b7 M Library/Homebrew/pathname+yeast.rb
- :100644 100644 440f1c9b10775150999264eb96e93fcfbd7727da 64bb503c712208d00d7cc2d0428d67d482685c22 M Library/Homebrew/unittest.rb
- :100644 100644 cc176d388507c7ed9381a36fd42ae0feceaad593 6a7a2385d89a12b5c7369fa0a87980b285ee5fd8 M Library/Homebrew/utils.rb
- :100644 100644 d1d9c62e6280bcb06c8b884c188d7bd37f8754e3 4aa0473705264cac864bd09f8a9d419d805e4774 M README
- :100644 100644 c0084b02faf7ab04abcffb3d5688e9d7c1ff7ae8 25cae981801e21cde048cd28747241d18093ca71 M bin/brew
+ M Library/Contributions/brew_bash_completion.sh
+ A Library/Formula/antiword.rb
+ A Library/Formula/bash-completion.rb
+ A Library/Formula/ddrescue.rb
+ A Library/Formula/dict.rb
+ A Library/Formula/lua.rb
+ R094 Library/Formula/shapefile.rb Library/Formula/shapelib.rb
+ M Library/Formula/xar.rb
+ M Library/Formula/yajl.rb
+ M Library/Homebrew/ARGV+yeast.rb
+ M Library/Homebrew/beer_events.rb
+ M Library/Homebrew/hardware.rb
+ M Library/Homebrew/hw.model.c
+ M Library/Homebrew/hw.model.rb
+ M Library/Homebrew/pathname+yeast.rb
+ M Library/Homebrew/unittest.rb
+ M Library/Homebrew/utils.rb
+ M README
+ M bin/brew
update_git_diff_output_with_tapped_formulae_changes: |
- :100644 100644 9dde0708e2db78e1aa697782bd2ab2ddfd8da984 ee0a81cbe3757e9a4b5aab1c41457f65fed9f258 M Library/Contributions/brew_bash_completion.sh
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Taps/someuser/sometap/Formula/antiword.rb
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Taps/someuser/sometap/HomebrewFormula/lua.rb
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Taps/someuser/sometap/custom-formula.rb
- :100644 100644 741f11dcd29ec909a94fa54df4bcdd2c1d5bb47b 7535134e865994e8ad66ba02a924a1e6c1271b9e A Library/Taps/someuser/sometap/lib/not-a-formula.rb
+ M Library/Contributions/brew_bash_completion.sh
+ A Library/Taps/someuser/sometap/Formula/antiword.rb
+ A Library/Taps/someuser/sometap/HomebrewFormula/lua.rb
+ A Library/Taps/someuser/sometap/custom-formula.rb
+ A Library/Taps/someuser/sometap/lib/not-a-formula.rb
update_git_diff_output_with_removed_formulae: |
- :000000 100644 0000000000000000000000000000000000000000 e62589998ef688f64aab10d85c3822dfa5cfb31c A Library/Formula/flac123.rb
- :100644 100644 bd7d76cf2fa9805ff23b9e8f48ecfb0e569aadd3 0cc2863c9be33ae946268407618f74897961873d M Library/Formula/gdal.rb
- :100644 100644 de9ac0de9e97b7af740aad11aee3b11a377df953 7f48a6455a892cd3d66ffb6c2003ea5dd6746699 M Library/Formula/grass.rb
- :100644 100644 8f05552e1e52370f78f98d07a1e0ea21a27f87c5 8c4d21c1b3ff3222f7870722d57d64988d81040d M Library/Formula/json_spirit.rb
- :000000 100644 0000000000000000000000000000000000000000 f7b16a549bd17c9a929454cff713947181769769 A Library/Formula/libbson.rb
- :100644 000000 be82458617c7b4208fd5b16772ea502f8cc765c3 0000000000000000000000000000000000000000 D Library/Formula/libgsasl.rb
+ A Library/Formula/flac123.rb
+ M Library/Formula/gdal.rb
+ M Library/Formula/grass.rb
+ M Library/Formula/json_spirit.rb
+ A Library/Formula/libbson.rb
+ D Library/Formula/libgsasl.rb
update_git_diff_output_with_changed_filetype: |
- :000000 100755 0000000000000000000000000000000000000000 f54bc27471cc812686129319db9b7985ca3307af A Library/ENV/4.3/ant
- :120000 100755 ac08cdcf9508eac464f78ddfd0cf25dcf3c336cf 72adb09419ccc1c2aca7862d30b6e778dcb41224 T Library/ENV/4.3/bsdmake
- :100755 100755 1d717718b3f8a0fb393fe3f2f65c8455b6673b10 f7089de36b87392baa09130ff6a0613a0791bd81 M Library/ENV/4.3/make
- :100644 100644 c544295287b6dad3cd8ee5e4579d60fdc7ba6759 6806cd0452b078e354b48c9ec97e93830a516454 M Library/Formula/elixir.rb
- :000000 100644 0000000000000000000000000000000000000000 f7b16a549bd17c9a929454cff713947181769769 A Library/Formula/libbson.rb
- :100644 000000 be82458617c7b4208fd5b16772ea502f8cc765c3 0000000000000000000000000000000000000000 D Library/Formula/libgsasl.rb
- :100644 100644 e6284b8a17d7ae8a6afd0d453c5dbf163b049467 6e340e3c4028eb7dae6e071fd71a83416a849771 M Library/Homebrew/cmd/update.rb
- :100644 100644 446ec056c0c2d05b6c337a6f1df95adc61c7e1f9 03b3a7c438a601b9e561766bf7e34d549149efb0 M SUPPORTERS.md
+ A Library/ENV/4.3/ant
+ T Library/ENV/4.3/bsdmake
+ M Library/ENV/4.3/make
+ M Library/Formula/elixir.rb
+ A Library/Formula/libbson.rb
+ D Library/Formula/libgsasl.rb
+ M Library/Homebrew/cmd/update.rb
+ M SUPPORTERS.md | true |
Other | Homebrew | brew | 2cf116464dcdd68c10e8a9e6f918568cf594a588.json | update: simplify diff parsing | Library/Homebrew/test/test_updater.rb | @@ -56,7 +56,7 @@ def perform_update(diff_output="")
@updater.in_repo_expect("git config core.autocrlf false")
@updater.in_repo_expect("git pull -q origin refs/heads/master:refs/remotes/origin/master")
@updater.in_repo_expect("git rev-parse -q --verify HEAD", "3456cdef")
- @updater.in_repo_expect("git diff-tree -r --raw -M85% 1234abcd 3456cdef", diff_output)
+ @updater.in_repo_expect("git diff-tree -r --name-status -M85% 1234abcd 3456cdef", diff_output)
@updater.pull!
@report.update(@updater.report)
end | true |
Other | Homebrew | brew | 7078af82184d09e977a7aa8a186dfb643395fbfa.json | Pass the string directly to the output method | Library/Homebrew/cmd/doctor.rb | @@ -1143,11 +1143,9 @@ def doctor
EOS
end
- lines = out.to_s.split('\n')
puts
- opoo lines.shift
+ opoo out
Homebrew.failed = true
- puts lines
first_warning = false
end
end | false |
Other | Homebrew | brew | d2aeadb1cd087081c7631622e01d8522e63e27eb.json | Pass array to puts instead of iterating over it | Library/Homebrew/cmd/doctor.rb | @@ -1118,7 +1118,7 @@ def doctor
checks = Checks.new
if ARGV.include? '--list-checks'
- checks.methods.grep(/^check_/).sort.each { |m| puts m }
+ puts checks.methods.grep(/^check_/).sort
exit
end
| false |
Other | Homebrew | brew | 74ad97ce7f3325fc0a16c5ec3262e191a92667cd.json | Remove intermediate method | Library/Homebrew/cmd/config.rb | @@ -117,10 +117,6 @@ def dump_build_config(f)
f.puts "X11: #{describe_x11}"
end
- def write_build_config(f)
- Homebrew.dump_build_config(f)
- end
-
def dump_verbose_config(f)
f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
f.puts "ORIGIN: #{origin}" | true |
Other | Homebrew | brew | 74ad97ce7f3325fc0a16c5ec3262e191a92667cd.json | Remove intermediate method | Library/Homebrew/formula.rb | @@ -556,7 +556,7 @@ def system cmd, *args
Kernel.system "/usr/bin/tail", "-n", "5", logfn unless ARGV.verbose?
f.puts
require 'cmd/config'
- Homebrew.write_build_config(f)
+ Homebrew.dump_build_config(f)
raise BuildError.new(self, cmd, args)
end
end | true |
Other | Homebrew | brew | a150403eb9878045696e5860a1a7488838a7a0d2.json | brew-gist-logs: dump config directly | Library/Contributions/cmd/brew-gist-logs.rb | @@ -1,6 +1,8 @@
require 'formula'
+require 'cmd/config'
require 'net/http'
require 'net/https'
+require 'stringio'
def gist_logs f
if ARGV.include? '--new-issue'
@@ -37,7 +39,9 @@ def load_logs name
end
def append_config files
- files['config.out'] = {:content => `brew config 2>&1`}
+ s = StringIO.new
+ Homebrew.dump_verbose_config(s)
+ files["config.out"] = { :content => s.string }
end
def append_doctor files | false |
Other | Homebrew | brew | d706bcf153ca09932b9166a4d664a33aed77d693.json | Remove the patch from the cache after applying it | Library/Contributions/cmd/brew-pull.rb | @@ -79,6 +79,8 @@ def tap arg
rescue ErrorDuringExecution
system 'git', 'am', '--abort'
odie 'Patch failed to apply: aborted.'
+ ensure
+ patchpath.unlink
end
changed_formulae = [] | false |
Other | Homebrew | brew | 6f02314cba77825db1fbcc186e96ff9ec49f7f58.json | Add a factory method that accepts a formula object | Library/Homebrew/cmd/bottle.rb | @@ -125,7 +125,7 @@ def bottle_formula f
bottle_revision = max ? max + 1 : 0
end
- filename = Bottle::Filename.new(f.name, f.pkg_version, bottle_tag, bottle_revision)
+ filename = Bottle::Filename.create(f, bottle_tag, bottle_revision)
if bottle_filename_formula_name(filename).empty?
return ofail "Add a new regex to bottle_version.rb to parse #{f.version} from #{filename}" | true |
Other | Homebrew | brew | 6f02314cba77825db1fbcc186e96ff9ec49f7f58.json | Add a factory method that accepts a formula object | Library/Homebrew/software_spec.rb | @@ -116,6 +116,10 @@ class Bottle
class Filename
attr_reader :name, :version, :tag, :revision
+ def self.create(formula, tag, revision)
+ new(formula.name, formula.pkg_version, tag, revision)
+ end
+
def initialize(name, version, tag, revision)
@name = name
@version = version
@@ -152,7 +156,7 @@ def initialize(formula, spec)
checksum, tag = spec.checksum_for(bottle_tag)
- filename = Filename.new(formula.name, formula.pkg_version, tag, spec.revision)
+ filename = Filename.create(formula, tag, spec.revision)
@resource.url = build_url(spec.root_url, filename)
@resource.download_strategy = CurlBottleDownloadStrategy
@resource.version = formula.pkg_version | true |
Other | Homebrew | brew | 6f02314cba77825db1fbcc186e96ff9ec49f7f58.json | Add a factory method that accepts a formula object | Library/Homebrew/test/test_bottle_filename.rb | @@ -1,4 +1,5 @@
require "testing_env"
+require "formula"
require "software_spec"
class BottleFilenameTests < Homebrew::TestCase
@@ -17,4 +18,14 @@ def test_to_str
assert_equal expected, fn(0).to_s
assert_equal expected, fn(0).to_str
end
+
+ def test_create
+ f = formula {
+ url "https://example.com/foo.tar.gz"
+ version "1.0"
+ }
+
+ expected = "formula_name-1.0.tag.bottle.tar.gz"
+ assert_equal expected, Bottle::Filename.create(f, :tag, 0).to_s
+ end
end | true |
Other | Homebrew | brew | 49a97c280a35fe07bce036467da85ace0c006fa7.json | Ask the filename object for the prefix | Library/Homebrew/bottles.rb | @@ -19,11 +19,6 @@ def bottle_file_outdated? f, file
bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext
end
-def bottle_suffix revision
- revision = revision > 0 ? ".#{revision}" : ""
- ".bottle#{revision}.tar.gz"
-end
-
def bottle_native_regex
/(\.#{bottle_tag}\.bottle\.(\d+\.)?tar\.gz)$/o
end | true |
Other | Homebrew | brew | 49a97c280a35fe07bce036467da85ace0c006fa7.json | Ask the filename object for the prefix | Library/Homebrew/cmd/bottle.rb | @@ -192,10 +192,7 @@ def bottle_formula f
puts output
if ARGV.include? '--rb'
- bottle_base = filename.to_s.gsub(bottle_suffix(bottle_revision), '')
- File.open "#{bottle_base}.bottle.rb", 'w' do |file|
- file.write output
- end
+ File.open("#{filename.prefix}.bottle.rb", "w") { |file| file.write(output) }
end
end
| true |
Other | Homebrew | brew | 49a97c280a35fe07bce036467da85ace0c006fa7.json | Ask the filename object for the prefix | Library/Homebrew/software_spec.rb | @@ -124,9 +124,18 @@ def initialize(name, version, tag, revision)
end
def to_s
- "#{name}-#{version}.#{tag}#{bottle_suffix(revision)}"
+ prefix + suffix
end
alias_method :to_str, :to_s
+
+ def prefix
+ "#{name}-#{version}.#{tag}"
+ end
+
+ def suffix
+ s = revision > 0 ? ".#{revision}" : ""
+ ".bottle#{s}.tar.gz"
+ end
end
extend Forwardable | true |
Other | Homebrew | brew | 49a97c280a35fe07bce036467da85ace0c006fa7.json | Ask the filename object for the prefix | Library/Homebrew/test/test_bottle_filename.rb | @@ -6,6 +6,12 @@ def fn(revision)
Bottle::Filename.new("foo", "1.0", :tag, revision)
end
+ def test_prefix_suffix
+ assert_equal "foo-1.0.tag", fn(0).prefix
+ assert_equal ".bottle.tar.gz", fn(0).suffix
+ assert_equal ".bottle.1.tar.gz", fn(1).suffix
+ end
+
def test_to_str
expected = "foo-1.0.tag.bottle.tar.gz"
assert_equal expected, fn(0).to_s | true |
Other | Homebrew | brew | 1cc37470947ed594dbb42a4138b34d33c74cb17d.json | Move bottle URL construction to the bottle object | Library/Homebrew/bottles.rb | @@ -28,11 +28,6 @@ def bottle_native_regex
/(\.#{bottle_tag}\.bottle\.(\d+\.)?tar\.gz)$/o
end
-def bottle_url(root_url, *filename_args)
- filename = Bottle::Filename.new(*filename_args)
- "#{root_url}/#{filename}"
-end
-
def bottle_tag
if MacOS.version >= :lion
MacOS.cat | true |
Other | Homebrew | brew | 1cc37470947ed594dbb42a4138b34d33c74cb17d.json | Move bottle URL construction to the bottle object | Library/Homebrew/software_spec.rb | @@ -143,7 +143,8 @@ def initialize(formula, spec)
checksum, tag = spec.checksum_for(bottle_tag)
- @resource.url = bottle_url(spec.root_url, formula.name, formula.pkg_version, tag, spec.revision)
+ filename = Filename.new(formula.name, formula.pkg_version, tag, spec.revision)
+ @resource.url = build_url(spec.root_url, filename)
@resource.download_strategy = CurlBottleDownloadStrategy
@resource.version = formula.pkg_version
@resource.checksum = checksum
@@ -155,6 +156,12 @@ def initialize(formula, spec)
def compatible_cellar?
cellar == :any || cellar == HOMEBREW_CELLAR.to_s
end
+
+ private
+
+ def build_url(root_url, filename)
+ "#{root_url}/#{filename}"
+ end
end
class BottleSpecification | true |
Other | Homebrew | brew | a5895ad1fe1ae4ae296c71483e7a77d87606cdd8.json | Check nil? || empty? instead of to_s.empty? | Library/Homebrew/extend/ENV/shared.rb | @@ -47,20 +47,22 @@ def remove_from_cflags val
def append keys, value, separator = ' '
value = value.to_s
Array(keys).each do |key|
- unless self[key].to_s.empty?
- self[key] = self[key] + separator + value
- else
+ old = self[key]
+ if old.nil? || old.empty?
self[key] = value
+ else
+ self[key] += separator + value
end
end
end
def prepend keys, value, separator = ' '
value = value.to_s
Array(keys).each do |key|
- unless self[key].to_s.empty?
- self[key] = value + separator + self[key]
- else
+ old = self[key]
+ if old.nil? || old.empty?
self[key] = value
+ else
+ self[key] = value + separator + old
end
end
end | false |
Other | Homebrew | brew | 598e7010f98c261df7c0a17c79dea554aebd1334.json | Remove dead code
This method is identical to the superclass implementation. | Library/Homebrew/download_strategy.rb | @@ -288,10 +288,6 @@ def initialize name, resource
@url = "#{@url}?use_mirror=#{mirror}" if mirror
end
- def tarball_path
- @tarball_path ||= HOMEBREW_CACHE/"#{name}-#{resource.version}#{ext}"
- end
-
def stage
ohai "Pouring #{tarball_path.basename}"
super | false |
Other | Homebrew | brew | 22038d5269d591ecc6646eba8b474d6320f7c476.json | Remove special case for now-deprecated GitHub URLs | Library/Homebrew/download_strategy.rb | @@ -203,18 +203,12 @@ def basename_without_params
end
def ext
- # GitHub uses odd URLs for zip files, so check for those
- rx=%r[https?://(www\.)?github\.com/.*/(zip|tar)ball/]
- if rx.match @url
- if $2 == 'zip'
- '.zip'
- else
- '.tgz'
- end
- else
- # Strip any ?thing=wad out of .c?thing=wad style extensions
- (Pathname.new(@url).extname)[/[^?]+/]
- end
+ # We need a Pathname because we've monkeypatched extname to support double
+ # extensions (e.g. tar.gz).
+ # We can't use basename_without_params, because given a URL like
+ # http://example.com/download.php?file=foo-1.0.tar.gz
+ # the extension we want is ".tar.gz", not ".php".
+ Pathname.new(@url).extname[/[^?]+/]
end
end
| false |
Other | Homebrew | brew | ecc9407fed2ab64c45c9499f896f0191a741c8ff.json | Remove deprecated options from brew-diy | Library/Homebrew/cmd/diy.rb | @@ -2,26 +2,10 @@
module Homebrew
def diy
- %w[name version].each do |opt|
- if ARGV.include? "--set-#{opt}"
- opoo "--set-#{opt} is deprecated, please use --#{opt}=<#{opt}> instead"
- end
- end
-
path = Pathname.getwd
- version = ARGV.value "version"
- version ||= if ARGV.include? "--set-version"
- ARGV.next
- elsif path.version.to_s.empty?
- raise "Couldn't determine version, set it with --version=<version>"
- else
- path.version
- end
-
- name = ARGV.value "name"
- name ||= ARGV.next if ARGV.include? "--set-name"
- name ||= detected_name(path, version)
+ version = ARGV.value("version") || detect_version(path)
+ name = ARGV.value("name") || detect_name(path, version)
prefix = HOMEBREW_CELLAR/name/version
@@ -34,7 +18,17 @@ def diy
end
end
- def detected_name(path, version)
+ def detect_version(path)
+ version = path.version.to_s
+
+ if version.empty?
+ raise "Couldn't determine version, set it with --version=<version>"
+ else
+ version
+ end
+ end
+
+ def detect_name(path, version)
basename = path.basename.to_s
detected_name = basename[/(.*?)-?#{Regexp.escape(version)}/, 1] || basename
canonical_name = Formulary.canonical_name(detected_name) | false |
Other | Homebrew | brew | 8df33f74467641de025cabbc3ace4433bb15be76.json | diy: use configure as the heuristic for autotools
Closes Homebrew/homebrew#30912. | Library/Homebrew/cmd/diy.rb | @@ -27,7 +27,7 @@ def diy
if File.file? "CMakeLists.txt"
puts "-DCMAKE_INSTALL_PREFIX=#{prefix}"
- elsif File.file? "Makefile.am"
+ elsif File.file? "configure"
puts "--prefix=#{prefix}"
else
raise "Couldn't determine build system" | false |
Other | Homebrew | brew | d4b6d8ec962f80b9bb121b808162c094b289ec9e.json | Remove commentary from error message
It might be best not to use the word "lame" here, as it's often considered to be an ableist slur.
Closes Homebrew/homebrew#30915.
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Homebrew/extend/ARGV.rb | @@ -42,7 +42,6 @@ def kegs
Multiple kegs installed to #{rack}
However we don't know which one you refer to.
Please delete (with rm -rf!) all but one and then try again.
- Sorry, we know this is lame.
EOS
end
end | false |
Other | Homebrew | brew | 3c366a56d7af3e51daac0c530a8b43ab005f31d1.json | Add key? to BottleCollector | Library/Homebrew/bottles.rb | @@ -69,7 +69,7 @@ def initialize
end
def fetch_checksum_for(tag)
- return [@bottles[tag], tag] if @bottles[tag]
+ return [@bottles[tag], tag] if key?(tag)
find_altivec_tag(tag) || find_or_later_tag(tag)
end
@@ -86,14 +86,18 @@ def []=(key, value)
@bottles[key] = value
end
+ def key?(key)
+ @bottles.key?(key)
+ end
+
# This allows generic Altivec PPC bottles to be supported in some
# formulae, while also allowing specific bottles in others; e.g.,
# sometimes a formula has just :tiger_altivec, other times it has
# :tiger_g4, :tiger_g5, etc.
def find_altivec_tag(tag)
if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/
- altitag = "#{$1}_altivec".to_sym
- return [@bottles[altitag], altitag] if @bottles[altitag]
+ altivec_tag = "#{$1}_altivec".to_sym
+ return [@bottles[altivec_tag], altivec_tag] if key?(altivec_tag)
end
end
| false |
Other | Homebrew | brew | 197dbe56011a656784e4c1dae734fabc3a3d512f.json | Remove dead code
Formula objects are always constructed with an explicit name, so we no
longer need to special case an empty name or the name "__UNKNOWN__". | Library/Homebrew/download_strategy.rb | @@ -1,5 +1,4 @@
require 'utils/json'
-require 'erb'
class AbstractDownloadStrategy
attr_reader :name, :resource
@@ -53,11 +52,7 @@ def extract_ref(specs)
end
def cache_filename(tag=cache_tag)
- if name.empty? || name == '__UNKNOWN__'
- "#{ERB::Util.url_encode(@url)}--#{tag}"
- else
- "#{name}--#{tag}"
- end
+ "#{name}--#{tag}"
end
def cache_tag
@@ -79,11 +74,7 @@ def mirrors
end
def tarball_path
- @tarball_path ||= if name.empty? || name == '__UNKNOWN__'
- Pathname.new("#{HOMEBREW_CACHE}/#{basename_without_params}")
- else
- Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}")
- end
+ @tarball_path ||= Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}")
end
def temporary_path | true |
Other | Homebrew | brew | 197dbe56011a656784e4c1dae734fabc3a3d512f.json | Remove dead code
Formula objects are always constructed with an explicit name, so we no
longer need to special case an empty name or the name "__UNKNOWN__". | Library/Homebrew/test/test_download_strategies.rb | @@ -50,16 +50,6 @@ def test_explicit_name
downloader = @strategy.new("baz", @resource)
assert_equal "baz--foo", downloader.cache_filename("foo")
end
-
- def test_empty_name
- downloader = @strategy.new("", @resource)
- assert_equal escaped("foo"), downloader.cache_filename("foo")
- end
-
- def test_unknown_name
- downloader = @strategy.new("__UNKNOWN__", @resource)
- assert_equal escaped("foo"), downloader.cache_filename("foo")
- end
end
class DownloadStrategyDetectorTests < Homebrew::TestCase | true |
Other | Homebrew | brew | a3dad588a855238b3576b59e90fd062b19cf55e0.json | Remove default tag value from bottle_filename
We always call this method with an explicit tag. | Library/Homebrew/bottles.rb | @@ -4,7 +4,6 @@
require 'bottle_version'
def bottle_filename options={}
- options = { :tag => bottle_tag }.merge(options)
suffix = ".#{options[:tag]}#{bottle_suffix(options[:revision])}"
"#{options[:name]}-#{options[:version]}#{suffix}"
end | false |
Other | Homebrew | brew | de42ad52a545e36b0225d5d7c4c1a96c491c642b.json | Move pjsip to the boneyard.
Will accept an updated pull request to update this to the current version.
Closes Homebrew/homebrew#27235. | Library/Homebrew/tap_migrations.rb | @@ -45,6 +45,7 @@
"octave" => "homebrew/science",
"opencv" => "homebrew/science",
"pan" => "homebrew/boneyard",
+ "pjsip" => "homebrew/boneyard",
"pocl" => "homebrew/science",
"qfits" => "homebrew/boneyard",
"qrupdate" => "homebrew/science", | false |
Other | Homebrew | brew | 1e184138489707dcbaef73dd23a600d63ab661cf.json | Fix reference to ISSUES_URL
Fixes Homebrew/homebrew#30848. | Library/brew.rb | @@ -165,7 +165,7 @@ def require? path
rescue Exception => e
onoe e
puts "#{Tty.white}Please report this bug:"
- puts " #{Tty.em}#{ISSUES_URL}#{Tty.reset}"
+ puts " #{Tty.em}#{OS::ISSUES_URL}#{Tty.reset}"
puts e.backtrace
exit 1
else | false |
Other | Homebrew | brew | 272cb4db26fb896ac175507c4698e8d715b9c93c.json | Remove default value from bottle_suffix parameter
We always call this method with an argument, so we can simplify it. | Library/Homebrew/bottles.rb | @@ -25,8 +25,8 @@ def bottle_file_outdated? f, file
bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext
end
-def bottle_suffix revision=nil
- revision = revision.to_i > 0 ? ".#{revision}" : ""
+def bottle_suffix revision
+ revision = revision > 0 ? ".#{revision}" : ""
".bottle#{revision}.tar.gz"
end
| false |
Other | Homebrew | brew | 74ae43c69098edda6b42ac29686b1ad054519132.json | Use accessor method in test | Library/Homebrew/test/test_software_spec.rb | @@ -117,8 +117,8 @@ def test_checksum_setters
end
checksums.each_pair do |cat, sha1|
- hsh, _ = @spec.collector.fetch_bottle_for(cat)
- assert_equal Checksum.new(:sha1, sha1), hsh
+ checksum, _ = @spec.checksum_for(cat)
+ assert_equal Checksum.new(:sha1, sha1), checksum
end
end
| false |
Other | Homebrew | brew | 237fa3164dcb56f6de3b875ed9fe9b47c7b0712b.json | Use a hash to cache compiler version lookups | Library/Homebrew/os/mac.rb | @@ -121,16 +121,12 @@ def clang_build_version
end
def non_apple_gcc_version(cc)
- path = HOMEBREW_PREFIX.join("opt/gcc/bin/#{cc}")
- path = nil unless path.exist?
-
- return unless path ||= locate(cc)
-
- ivar = "@#{cc.gsub(/(-|\.)/, '')}_version"
- return instance_variable_get(ivar) if instance_variable_defined?(ivar)
-
- `#{path} --version` =~ /gcc(-\d\.\d \(.+\))? (\d\.\d\.\d)/
- instance_variable_set(ivar, $2)
+ (@non_apple_gcc_version ||= {}).fetch(cc) do
+ path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc)
+ path = locate(cc) unless path.exist?
+ version = %x{#{path} --version}[/gcc(?:-\d\.\d \(.+\))? (\d\.\d\.\d)/, 1] if path
+ @non_apple_gcc_version[cc] = version
+ end
end
# See these issues for some history: | false |
Other | Homebrew | brew | 7b1ca1d152b732fad3fa74651da8c4baff273b15.json | Compare cellar and prefix against constants | Library/Homebrew/cmd/bottle.rb | @@ -12,12 +12,12 @@
<% if root_url != BottleSpecification::DEFAULT_ROOT_URL %>
root_url "<%= root_url %>"
<% end %>
- <% if prefix.to_s != "/usr/local" %>
+ <% if prefix != BottleSpecification::DEFAULT_PREFIX %>
prefix "<%= prefix %>"
<% end %>
<% if cellar.is_a? Symbol %>
cellar :<%= cellar %>
- <% elsif cellar.to_s != "/usr/local/Cellar" %>
+ <% elsif cellar != BottleSpecification::DEFAULT_CELLAR %>
cellar "<%= cellar %>"
<% end %>
<% if revision > 0 %>
@@ -186,8 +186,8 @@ def bottle_formula f
bottle = BottleSpecification.new
bottle.root_url(root_url) if root_url
- bottle.prefix HOMEBREW_PREFIX
- bottle.cellar relocatable ? :any : HOMEBREW_CELLAR
+ bottle.prefix HOMEBREW_PREFIX.to_s
+ bottle.cellar relocatable ? :any : HOMEBREW_CELLAR.to_s
bottle.revision bottle_revision
bottle.sha1 bottle_path.sha1 => bottle_tag
| false |
Other | Homebrew | brew | 58464287bc35282a5001a1f9a3f69cecc7c552c7.json | Use pkg_version accessor | Library/Homebrew/cmd/bottle.rb | @@ -244,12 +244,9 @@ def merge
end
end
- version = f.version.to_s
- version += "_#{f.revision}" if f.revision.to_i > 0
-
HOMEBREW_REPOSITORY.cd do
safe_system "git", "commit", "--no-edit", "--verbose",
- "--message=#{f.name}: #{update_or_add} #{version} bottle.",
+ "--message=#{f.name}: #{update_or_add} #{f.pkg_version} bottle.",
"--", f.path
end
end | false |
Other | Homebrew | brew | 1eafe3bc354626b3d54164c263a5c57313d8eeeb.json | Handle conflicts where links point at symlinks
Fixes Homebrew/homebrew#30664. | Library/Homebrew/keg.rb | @@ -322,11 +322,12 @@ def delete_pyc_files!
private
def resolve_any_conflicts dst, mode
- # if it isn't a directory then a severe conflict is about to happen. Let
- # it, and the exception that is generated will message to the user about
- # the situation
- if dst.symlink? and dst.directory?
- src = dst.resolved_path
+ src = dst.resolved_path
+ # src itself may be a symlink, so check lstat to ensure we are dealing with
+ # a directory, and not a symlink pointing at a directory (which needs to be
+ # treated as a file). In other words, we onlly want to resolve one symlink.
+ # If it isn't a directory, make_relative_symlink will raise an exception.
+ if dst.symlink? && src.lstat.directory?
keg = Keg.for(src)
dst.unlink unless mode.dry_run
keg.link_dir(src, mode) { :mkpath } | true |
Other | Homebrew | brew | 1eafe3bc354626b3d54164c263a5c57313d8eeeb.json | Handle conflicts where links point at symlinks
Fixes Homebrew/homebrew#30664. | Library/Homebrew/test/test_keg.rb | @@ -217,4 +217,20 @@ def test_symlinks_are_linked_directly
assert_predicate link.resolved_path, :symlink?
assert_predicate link.lstat, :symlink?
end
+
+ def test_links_to_symlinks_are_not_removed
+ a = HOMEBREW_CELLAR.join("a", "1.0")
+ b = HOMEBREW_CELLAR.join("b", "1.0")
+
+ a.join("lib", "example").mkpath
+ a.join("lib", "example2").make_symlink "example"
+ b.join("lib", "example2").mkpath
+
+ Keg.new(a).link
+
+ lib = HOMEBREW_PREFIX.join("lib")
+ assert_equal 2, lib.children.length
+ assert_raises(Keg::ConflictError) { Keg.new(b).link }
+ assert_equal 2, lib.children.length
+ end
end | true |
Other | Homebrew | brew | 1fb16775328d6022643856de146d54d4654e880e.json | Linuxbrew: Move ISSUES_URL to os from global
Closes Homebrew/linuxbrew#103
Closes Homebrew/homebrew#30830.
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Homebrew/exceptions.rb | @@ -177,7 +177,7 @@ def fetch_issues
def dump
if not ARGV.verbose?
puts
- puts "#{Tty.red}READ THIS#{Tty.reset}: #{Tty.em}#{ISSUES_URL}#{Tty.reset}"
+ puts "#{Tty.red}READ THIS#{Tty.reset}: #{Tty.em}#{OS::ISSUES_URL}#{Tty.reset}"
if formula.tap?
tap_issues_url = "https://github.com/#{formula.tap}/issues"
puts "If reporting this issue please do so at (not Homebrew/homebrew):" | true |
Other | Homebrew | brew | 1fb16775328d6022643856de146d54d4654e880e.json | Linuxbrew: Move ISSUES_URL to os from global
Closes Homebrew/linuxbrew#103
Closes Homebrew/homebrew#30830.
Signed-off-by: Jack Nagel <jacknagel@gmail.com> | Library/Homebrew/global.rb | @@ -98,7 +98,6 @@ module Homebrew
alias_method :failed?, :failed
end
-ISSUES_URL = "https://github.com/Homebrew/homebrew/wiki/troubleshooting"
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = 'https:\/\/github.com\/(\w+)\/homebrew(-\w+)?\/(pull\/(\d+)|commit\/\w{4,40})'
require 'compat' unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT'] | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.