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
64bcb5a07f74384fbd66daba7d03f1d271d02b68.json
audit: catch insecure bitbucket
Library/Homebrew/cmd/audit.rb
@@ -438,7 +438,8 @@ def audit_homepage %r{^http://[^/.]+\.ietf\.org}, %r{^http://[^/.]+\.tools\.ietf\.org}, %r{^http://www\.gnu\.org/}, - %r{^http://code\.google\.com/} + %r{^http://code\.google\.com/}, + %r{^http://bitbucket\.org/} problem "Please use https:// for #{homepage}" end @@ -1059,7 +1060,8 @@ def audit_urls %r{^http://([^/]*\.|)bintray\.com/}, %r{^http://tools\.ietf\.org/}, %r{^http://www\.mirrorservice\.org/}, - %r{^http://launchpad\.net/} + %r{^http://launchpad\.net/}, + %r{^http://bitbucket\.org/} problem "Please use https:// for #{p}" when %r{^http://search\.mcpan\.org/CPAN/(.*)}i problem "#{p} should be `https://cpan.metacpan.org/#{$1}`"
false
Other
Homebrew
brew
12e154a418b28c80faa168dc8ba68599e2044a7a.json
man: remove unnecessary --all in brew upgrade
Library/Homebrew/manpages/brew.1.md
@@ -331,7 +331,7 @@ Note that these flags should only appear after a command. * `pin` <formulae>: Pin the specified <formulae>, preventing them from being upgraded when - issuing the `brew upgrade --all` command. See also `unpin`. + issuing the `brew upgrade` command. See also `unpin`. * `prune`: Remove dead symlinks from the Homebrew prefix. This is generally not @@ -445,7 +445,7 @@ Note that these flags should only appear after a command. source. This is useful for creating patches for the software. * `unpin` <formulae>: - Unpin <formulae>, allowing them to be upgraded by `brew upgrade --all`. See also + Unpin <formulae>, allowing them to be upgraded by `brew upgrade`. See also `pin`. * `untap` <tap>:
true
Other
Homebrew
brew
12e154a418b28c80faa168dc8ba68599e2044a7a.json
man: remove unnecessary --all in brew upgrade
share/man/man1/brew.1
@@ -323,7 +323,7 @@ If \fB\-\-verbose\fR is passed, display detailed version information\. If \fB\-\-json=<version>\fR is passed, the output will be in JSON format\. The only valid version is \fBv1\fR\. . .IP "\(bu" 4 -\fBpin\fR \fIformulae\fR: Pin the specified \fIformulae\fR, preventing them from being upgraded when issuing the \fBbrew upgrade \-\-all\fR command\. See also \fBunpin\fR\. +\fBpin\fR \fIformulae\fR: Pin the specified \fIformulae\fR, preventing them from being upgraded when issuing the \fBbrew upgrade\fR command\. See also \fBunpin\fR\. . .IP "\(bu" 4 \fBprune\fR: Remove dead symlinks from the Homebrew prefix\. This is generally not needed, but can be useful when doing DIY installations\. @@ -421,7 +421,7 @@ If \fB\-\-patch\fR is passed, patches for \fIformulae\fR will be applied to the If \fB\-\-git\fR is passed, a Git repository will be initalized in the unpacked source\. This is useful for creating patches for the software\. . .IP "\(bu" 4 -\fBunpin\fR \fIformulae\fR: Unpin \fIformulae\fR, allowing them to be upgraded by \fBbrew upgrade \-\-all\fR\. See also \fBpin\fR\. +\fBunpin\fR \fIformulae\fR: Unpin \fIformulae\fR, allowing them to be upgraded by \fBbrew upgrade\fR\. See also \fBpin\fR\. . .IP "\(bu" 4 \fBuntap\fR \fItap\fR: Remove a tapped repository\.
true
Other
Homebrew
brew
f88f2b7054ac3ff11a8b0581549776879738e868.json
update tabs only if core formula installed Closes Homebrew/homebrew#42745. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/update.rb
@@ -55,6 +55,7 @@ def update install_tap tap_user, tap_repo # update tap for each Tab tabs = dir.subdirs.each.map { |d| Tab.for_keg(Keg.new(d)) } + next if tabs.first.source["tap"] != "Homebrew/homebrew" tabs.each { |tab| tab.source["tap"] = "#{tap_user}/homebrew-#{tap_repo}" } tabs.each(&:write) end if load_tap_migrations
true
Other
Homebrew
brew
f88f2b7054ac3ff11a8b0581549776879738e868.json
update tabs only if core formula installed Closes Homebrew/homebrew#42745. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/migrator.rb
@@ -90,7 +90,7 @@ def from_same_taps? # 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 TAP_MIGRATIONS && (rec = TAP_MIGRATIONS[formula.oldname]) \ - && rec == formula.tap.sub("homebrew-", "") + && rec == formula.tap.sub("homebrew-", "") && old_tap == "Homebrew/homebrew" fix_tabs true elsif formula.tap
true
Other
Homebrew
brew
431f23db32e29827252d1bbdc809ec72039b3749.json
PythonRequirement: fix variable in PYTHONPATH
Library/Homebrew/requirements/python_requirement.rb
@@ -29,7 +29,7 @@ def pour_bottle? end if python_binary == "python" - ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{version}/site-packages" + ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages" end end
false
Other
Homebrew
brew
fac17e8459c193e40144c5e7875f5b634d8af9a0.json
to_rack: simplify the logic Closes Homebrew/homebrew#42743. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formulary.rb
@@ -196,21 +196,14 @@ def self.from_rack(rack, spec = nil) end def self.to_rack(ref) - name = canonical_name(ref) - rack = HOMEBREW_CELLAR/name - - # Handle the case when ref is an old name and the installation - # hasn't been migrated or when it's a package installed from - # path but same name formula was renamed. - unless rack.directory? - if ref =~ HOMEBREW_TAP_FORMULA_REGEX - rack = HOMEBREW_CELLAR/$3 - elsif !ref.include?("/") - rack = HOMEBREW_CELLAR/ref - end + # First, check whether the rack with the given name exists. + if (rack = HOMEBREW_CELLAR/File.basename(ref, ".rb")).directory? + return rack end - rack + # Second, use canonical name to locate rack. + name = canonical_name(ref) + HOMEBREW_CELLAR/name end def self.canonical_name(ref)
false
Other
Homebrew
brew
4b31fcd07296bbe33bc309f147a4e27bd39c7af8.json
add documentation for formula renames
share/doc/homebrew/Rename-A-Formula.md
@@ -0,0 +1,26 @@ +# Renaming a Formula + +Sometimes software and formulae need to be renamed. To rename core formula +you need: + +1. Rename formula file and its class to new formula. New name must meet all the rules of naming. Fix any test failures that may occur due to the stricter requirements for new formula than existing formula (e.g. brew audit --strict must pass for that formula). + +2. Create a pull request to the main repository deleting the formula file, adding new formula file and also add it to `Library/Homebrew/formula_renames.rb` with a commit message like `rename: ack -> newack` + +To rename tap formula you need to follow the same steps, but add formula to `formula_renames.json` in the root of your tap. You don't need to change `Library/Homebrew/formula_renames.rb`, because that file is for core formulae only. Use canonical name (e.g. `ack` instead of `user/repo/ack`). + +`Library/Homebrew/formula_renames.rb` example for core formula renames: + +```ruby +FORMULA_RENAMES = { + "ack" => "newack" +} +``` + +`formula_renames.json` example for tap: + +```json +{ + "ack": "newack" +} +```
false
Other
Homebrew
brew
6b0927944aca1b11eec90659b11390a1575c7ff1.json
update: handle renames on update
Library/Homebrew/cmd/update.rb
@@ -1,5 +1,7 @@ require "cmd/tap" require "formula_versions" +require "migrator" +require "formulary" module Homebrew def update @@ -46,13 +48,47 @@ def update # automatically tap any migrated formulae's new tap report.select_formula(:D).each do |f| - next unless (HOMEBREW_CELLAR/f).exist? + next unless (dir = HOMEBREW_CELLAR/f).exist? migration = TAP_MIGRATIONS[f] next unless migration tap_user, tap_repo = migration.split "/" install_tap tap_user, tap_repo + # update tap for each Tab + tabs = dir.subdirs.each.map { |d| Tab.for_keg(Keg.new(d)) } + tabs.each { |tab| tab.source["tap"] = "#{tap_user}/homebrew-#{tap_repo}" } + tabs.each(&:write) end if load_tap_migrations + # Migrate installed renamed formulae from main Homebrew repository. + if load_formula_renames + report.select_formula(:D).each do |oldname| + newname = FORMULA_RENAMES[oldname] + next unless newname + next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty? + + begin + migrator = Migrator.new(Formulary.factory("homebrew/homebrew/#{newname}")) + migrator.migrate + rescue Migrator::MigratorDifferentTapsError + end + end + end + + # Migrate installed renamed formulae from taps + report.select_formula(:D).each do |oldname| + user, repo, oldname = oldname.split("/", 3) + next unless user && repo && oldname + tap = Tap.new(user, repo) + next unless newname = tap.formula_renames[oldname] + next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty? + + begin + migrator = Migrator.new(Formulary.factory("#{user}/#{repo}/#{newname}")) + migrator.migrate + rescue Migrator::MigratorDifferentTapsError + end + end + if report.empty? puts "Already up-to-date." else @@ -112,7 +148,13 @@ def rename_taps_dir_if_necessary end def load_tap_migrations - require "tap_migrations" + load "tap_migrations" + rescue LoadError + false + end + + def load_formula_renames + load "formula_renames.rb" rescue LoadError false end
false
Other
Homebrew
brew
abf6b6f6cf31277ec1350fc7f7d16a7d23de882a.json
add migrate command for migrating renamed
Library/Homebrew/cmd/migrate.rb
@@ -0,0 +1,20 @@ +require "migrator" +require "formula_renames" + +module Homebrew + def migrate + raise FormulaUnspecifiedError if ARGV.named.empty? + + ARGV.resolved_formulae.each do |f| + if f.oldname + unless (rack = HOMEBREW_CELLAR/f.oldname).exist? && !rack.subdirs.empty? + raise NoSuchKegError, f.oldname + end + raise "#{rack} is a symlink" if rack.symlink? + end + + migrator = Migrator.new(f) + migrator.migrate + end + end +end
false
Other
Homebrew
brew
fa8b702c0d1d910ea8ee39f61a31bb1bee66aeef.json
uninstall: change logic to handle renames
Library/Homebrew/cmd/uninstall.rb
@@ -1,30 +1,66 @@ require "keg" require "formula" +require "migrator" module Homebrew def uninstall raise KegUnspecifiedError if ARGV.named.empty? + # Find symlinks that can point to keg.rack + links = HOMEBREW_CELLAR.subdirs.select(&:symlink?) + if !ARGV.force? ARGV.kegs.each do |keg| keg.lock do puts "Uninstalling #{keg}... (#{keg.abv})" + + old_cellars = [] + # Remove every symlink that links to keg, because it can + # be left by migrator + links.each do |link| + old_opt = HOMEBREW_PREFIX/"opt/#{link.basename}" + if link.exist? && link.realpath == keg.rack.realpath + old_cellars << link + end + + if old_opt.symlink? && old_opt.realpath.to_s == keg.to_s + old_opt.unlink + old_opt.parent.rmdir_if_possible + end + end + keg.unlink keg.uninstall rack = keg.rack rm_pin rack + if rack.directory? versions = rack.subdirs.map(&:basename) verb = versions.length == 1 ? "is" : "are" puts "#{keg.name} #{versions.join(", ")} #{verb} still installed." puts "Remove them all with `brew uninstall --force #{keg.name}`." + else + # If we delete Cellar/newname, then Cellar/oldname symlink + # can become broken and we have to remove it. + old_cellars.each(&:unlink) end end end else ARGV.named.each do |name| - name = Formulary.canonical_name(name) - rack = HOMEBREW_CELLAR/name + rack = Formulary.to_rack(name) + name = rack.basename + + links.each do |link| + old_opt = HOMEBREW_PREFIX/"opt/#{link.basename}" + if old_opt.symlink? && old_opt.exist? \ + && old_opt.realpath.parent == rack.realpath + old_opt.unlink + old_opt.parent.rmdir_if_possible + end + + lnk.unlink if lnk.exist? && lnk.realpath == rack.realpath + end if rack.directory? puts "Uninstalling #{name}... (#{rack.abv})"
false
Other
Homebrew
brew
2cc6b9032965fed9e937da7b1c723e4b2cfd60a0.json
formulary: change logic for renamed formulae
Library/Homebrew/formulary.rb
@@ -1,4 +1,5 @@ require "digest/md5" +require "formula_renames" # The Formulary is responsible for creating instances of Formula. # It is not meant to be used directy from formulae. @@ -141,6 +142,7 @@ class TapLoader < FormulaLoader def initialize(tapped_name) user, repo, name = tapped_name.split("/", 3).map(&:downcase) @tap = Tap.new user, repo.sub(/^homebrew-/, "") + name = @tap.formula_renames.fetch(name, name) path = @tap.formula_files.detect { |file| file.basename(".rb").to_s == name } path ||= @tap.path/"#{name}.rb" @@ -212,7 +214,13 @@ def self.loader_for(ref) when Pathname::BOTTLE_EXTNAME_RX return BottleLoader.new(ref) when HOMEBREW_CORE_FORMULA_REGEX - return FormulaLoader.new($1, core_path($1)) + name = $1 + formula_with_that_name = core_path(name) + if (newname = FORMULA_RENAMES[name]) && !formula_with_that_name.file? + return FormulaLoader.new(newname, core_path(newname)) + else + return FormulaLoader.new(name, formula_with_that_name) + end when HOMEBREW_TAP_FORMULA_REGEX return TapLoader.new(ref) end @@ -231,13 +239,33 @@ def self.loader_for(ref) return AliasLoader.new(possible_alias) end - possible_tap_formulae = tap_paths(ref) + possible_tap_formulae = tap_paths(ref) if possible_tap_formulae.size > 1 raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) elsif possible_tap_formulae.size == 1 return FormulaLoader.new(ref, possible_tap_formulae.first) end + if newref = FORMULA_RENAMES[ref] + formula_with_that_oldname = core_path(newref) + if formula_with_that_oldname.file? + return FormulaLoader.new(newref, formula_with_that_oldname) + end + end + + possible_tap_newname_formulae = [] + Tap.each do |tap| + if newref = tap.formula_renames[ref] + possible_tap_newname_formulae << "#{tap.name}/#{newref}" + end + end + + if possible_tap_newname_formulae.size > 1 + raise TapFormulaWithOldnameAmbiguityError.new(ref, possible_tap_newname_formulae) + elsif !possible_tap_newname_formulae.empty? + return TapLoader.new(possible_tap_newname_formulae.first) + end + possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb") if possible_cached_formula.file? return FormulaLoader.new(ref, possible_cached_formula)
false
Other
Homebrew
brew
832c5875b01bf86652f53be1543742907da1febb.json
add migrator class for migrating renamed formulae
Library/Homebrew/migrator.rb
@@ -0,0 +1,303 @@ +require "formula" +require "keg" +require "tab" +require "tap_migrations" + +class Migrator + class MigratorNoOldnameError < RuntimeError + def initialize(formula) + super "#{formula.name} doesn't replace any formula." + end + end + + class MigratorNoOldpathError < RuntimeError + def initialize(formula) + super "#{HOMEBREW_CELLAR/formula.oldname} doesn't exist." + end + end + + class MigratorDifferentTapsError < RuntimeError + def initialize(formula, tap) + if tap.nil? + super <<-EOS.undent + #{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} wasn't installed from taps or core formulae + + You can try `brew migrate --force #{formula.oldname}`. + EOS + else + user, repo = tap.split("/") + repo.sub!("homebrew-", "") + name = "fully-qualified #{user}/#{repo}/#{formula.oldname}" + name = formula.oldname if tap == "Homebrew/homebrew" + super <<-EOS.undent + #{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap} + + Please try to use #{name} to refer the formula + EOS + end + end + end + + attr_reader :formula + attr_reader :oldname, :oldpath, :old_pin_record, :old_opt_record + attr_reader :old_linked_keg_record, :oldkeg, :old_tabs, :old_tap + attr_reader :newname, :newpath, :new_pin_record + attr_reader :old_pin_link_record + + def initialize(formula) + @oldname = formula.oldname + @newname = formula.name + raise MigratorNoOldnameError.new(formula) unless oldname + + @formula = formula + @oldpath = HOMEBREW_CELLAR/formula.oldname + raise MigratorNoOldpathError.new(formula) unless oldpath.exist? + + @old_tabs = oldpath.subdirs.each.map { |d| Tab.for_keg(Keg.new(d)) } + @old_tap = old_tabs.first.tap + raise MigratorDifferentTapsError.new(formula, old_tap) unless from_same_taps? + + @newpath = HOMEBREW_CELLAR/formula.name + + if @oldkeg = get_linked_oldkeg + @old_linked_keg_record = oldkeg.linked_keg_record if oldkeg.linked? + @old_opt_record = oldkeg.opt_record if oldkeg.optlinked? + end + + @old_pin_record = HOMEBREW_LIBRARY/"PinnedKegs"/oldname + @new_pin_record = HOMEBREW_LIBRARY/"PinnedKegs"/newname + @pinned = old_pin_record.symlink? + @old_pin_link_record = old_pin_record.readlink if @pinned + end + + # Fix INSTALL_RECEIPTS for tap-migrated formula. + def fix_tabs + old_tabs.each do |tab| + tab.source["tap"] = formula.tap + tab.write + end + end + + def from_same_taps? + if old_tap == nil && formula.core_formula? && ARGV.force? + true + elsif 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 (tap is Homebrew/homebrew if installed formula migrates to a 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 TAP_MIGRATIONS && (rec = TAP_MIGRATIONS[formula.oldname]) \ + && rec == formula.tap.sub("homebrew-", "") + fix_tabs + true + elsif formula.tap + false + end + end + + def get_linked_oldkeg + kegs = oldpath.subdirs.map { |d| Keg.new(d) } + kegs.detect(&:linked?) || kegs.detect(&:optlinked?) + end + + def pinned? + @pinned + end + + def oldkeg_linked? + !!oldkeg + end + + def migrate + if newpath.exist? + onoe "#{newpath} already exists; remove it manually and run brew migrate #{oldname}." + return + end + + begin + oh1 "Migrating #{Tty.green}#{oldname}#{Tty.white} to #{Tty.green}#{newname}#{Tty.reset}" + unlink_oldname + move_to_new_directory + repin + link_newname + link_oldname_opt + link_oldname_cellar + update_tabs + rescue Interrupt + ignore_interrupts { backup_oldname } + rescue Exception => e + onoe "error occured while migrating." + puts e if ARGV.debug? + puts "Backuping..." + ignore_interrupts { backup_oldname } + end + end + + # move everything from Cellar/oldname to Cellar/newname + def move_to_new_directory + puts "Moving to: #{newpath}" + FileUtils.mv(oldpath, newpath) + end + + def repin + if pinned? + # old_pin_record is a relative symlink and when we try to to read it + # from <dir> we actually try to find file + # <dir>/../<...>/../Cellar/name/version. + # To repin formula we need to update the link thus that it points to + # the right directory. + # NOTE: old_pin_record.realpath.sub(oldname, newname) is unacceptable + # here, because it resolves every symlink for old_pin_record and then + # substitutes oldname with newname. It breaks things like + # Pathname#make_relative_symlink, where Pathname#relative_path_from + # is used to find relative path from source to destination parent and + # it assumes no symlinks. + src_oldname = old_pin_record.dirname.join(old_pin_link_record).expand_path + new_pin_record.make_relative_symlink(src_oldname.sub(oldname, newname)) + old_pin_record.delete + end + end + + def unlink_oldname + oh1 "Unlinking #{Tty.green}#{oldname}#{Tty.reset}" + oldpath.subdirs.each do |d| + keg = Keg.new(d) + keg.unlink + end + end + + def link_newname + oh1 "Linking #{Tty.green}#{newname}#{Tty.reset}" + keg = Keg.new(formula.installed_prefix) + + if formula.keg_only? + begin + keg.optlink + rescue Keg::LinkError => e + onoe "Failed to create #{formula.opt_prefix}" + puts e + raise + end + return + end + + keg.remove_linked_keg_record if keg.linked? + + begin + keg.link + rescue Keg::ConflictError => e + onoe "Error while executing `brew link` step on #{newname}" + puts e + puts + puts "Possible conflicting files are:" + mode = OpenStruct.new(:dry_run => true, :overwrite => true) + keg.link(mode) + raise + rescue Keg::LinkError => e + onoe "Error while linking" + puts e + puts + puts "You can try again using:" + puts " brew link #{formula.name}" + rescue Exception => e + onoe "An unexpected error occurred during linking" + puts e + puts e.backtrace + ignore_interrupts { keg.unlink } + raise e + end + end + + # Link keg to opt if it was linked before migrating. + def link_oldname_opt + if old_opt_record + old_opt_record.delete if old_opt_record.symlink? || old_opt_record.exist? + old_opt_record.make_relative_symlink(formula.installed_prefix) + end + end + + # After migtaion every INSTALL_RECEIPT.json has wrong path to the formula + # so we must update INSTALL_RECEIPTs + def update_tabs + new_tabs = newpath.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } + new_tabs.each do |tab| + tab.source["path"] = formula.path.to_s if tab.source["path"] + tab.write + end + end + + # Remove opt/oldname link if it belongs to newname. + def unlink_oldname_opt + return unless old_opt_record + if old_opt_record.symlink? && formula.installed_prefix.exist? \ + && formula.installed_prefix.realpath == old_opt_record.realpath + old_opt_record.unlink + old_opt_record.parent.rmdir_if_possible + end + end + + # Remove oldpath if it exists + def link_oldname_cellar + oldpath.delete if oldpath.symlink? || oldpath.exist? + oldpath.make_relative_symlink(formula.rack) + end + + # Remove Cellar/oldname link if it belongs to newname. + def unlink_oldname_cellar + if (oldpath.symlink? && !oldpath.exist?) || (oldpath.symlink? \ + && formula.rack.exist? && formula.rack.realpath == oldpath.realpath) + oldpath.unlink + end + end + + # Backup everything if errors occured while migrating. + def backup_oldname + unlink_oldname_opt + unlink_oldname_cellar + backup_oldname_cellar + backup_old_tabs + + if pinned? && !old_pin_record.symlink? + src_oldname = old_pin_record.dirname.join(old_pin_link_record).expand_path + old_pin_record.make_relative_symlink(src_oldname) + new_pin_record.delete + end + + if newpath.exist? + newpath.subdirs.each do |d| + newname_keg = Keg.new(d) + newname_keg.unlink + newname_keg.uninstall + end + end + + if oldkeg_linked? + begin + # The keg used to be linked and when we backup everything we restore + # Cellar/oldname, the target also gets restored, so we are able to + # create a keg using its old path + keg = Keg.new(Pathname.new(oldkeg.to_s)) + keg.link + rescue Keg::LinkError + keg.unlink + raise + rescue Keg::AlreadyLinkedError + keg.unlink + retry + end + end + end + + def backup_oldname_cellar + unless oldpath.exist? + FileUtils.mv(newpath, oldpath) + end + end + + def backup_old_tabs + old_tabs.each(&:write) + end +end
false
Other
Homebrew
brew
556ab3bcd6125e22506bb8845576c73a4330f14f.json
audit: add rules for naming - restrict old names as names of new formulae - warn about dependencies on old names
Library/Homebrew/cmd/audit.rb
@@ -6,6 +6,7 @@ require "tap_migrations" require "cmd/search" require "date" +require "formula_renames" module Homebrew def audit @@ -229,6 +230,11 @@ def audit_formula_name return end + if FORMULA_RENAMES.key? name + problem "'#{name}' is reserved as the old name of #{FORMULA_RENAMES[name]}" + return + end + if !formula.core_formula? && Formula.core_names.include?(name) problem "Formula name conflicts with existing core formula." return @@ -270,6 +276,10 @@ def audit_deps next end + if FORMULA_RENAMES[dep.name] == dep_f.name + problem "Dependency '#{dep.name}' was renamed; use newname '#{dep_f.name}'." + end + if @@aliases.include?(dep.name) problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'." end
false
Other
Homebrew
brew
ae9bf4aaaa83f53ed767294632db15a74e425c59.json
formula: add oldname method - add Formula#oldname to get oldname for formula - add formula_renames.rb to store information about formula renames
Library/Homebrew/formula.rb
@@ -10,6 +10,7 @@ require "install_renamed" require "pkg_version" require "tap" +require "formula_renames" # A formula provides instructions and metadata for Homebrew to install a piece # of software. Every Homebrew formula is a {Formula}. @@ -223,6 +224,21 @@ def resource(name) active_spec.resource(name) end + # An old name for the formula + def oldname + @oldname ||= if core_formula? + if FORMULA_RENAMES && FORMULA_RENAMES.value?(name) + FORMULA_RENAMES.to_a.rassoc(name).first + end + elsif tap? + user, repo = tap.split("/") + formula_renames = Tap.new(user, repo.sub("homebrew-", "")).formula_renames + if formula_renames.value?(name) + formula_renames.to_a.rassoc(name).first + end + end + end + # The {Resource}s for the currently active {SoftwareSpec}. def resources active_spec.resources.values @@ -864,6 +880,7 @@ def to_hash "full_name" => full_name, "desc" => desc, "homepage" => homepage, + "oldname" => oldname, "versions" => { "stable" => (stable.version.to_s if stable), "bottle" => bottle ? true : false,
true
Other
Homebrew
brew
ae9bf4aaaa83f53ed767294632db15a74e425c59.json
formula: add oldname method - add Formula#oldname to get oldname for formula - add formula_renames.rb to store information about formula renames
Library/Homebrew/formula_renames.rb
@@ -0,0 +1,2 @@ +FORMULA_RENAMES = { +}
true
Other
Homebrew
brew
77ee9bd4465c6b334f3cc547ecdfb6680abb3f83.json
update man page Closes Homebrew/homebrew#41736. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/manpages/brew.1.md
@@ -395,6 +395,13 @@ Note that these flags should only appear after a command. See the docs for examples of using the JSON: <https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Querying-Brew.md> + * `tap-pin` <tap>: + Pin <tap>, prioritizing its formulae over core when formula names are supplied + by the user. See also `tap-unpin`. + + * `tap-unpin` <tap>: + Unpin <tap> so its formulae are no longer prioritized. See also `tap-pin`. + * `test` [--devel|--HEAD] [--debug] <formula>: A few formulae provide a test method. `brew test <formula>` runs this test method. There is no standard output or return code, but it should
true
Other
Homebrew
brew
77ee9bd4465c6b334f3cc547ecdfb6680abb3f83.json
update man page Closes Homebrew/homebrew#41736. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
share/man/man1/brew.1
@@ -379,6 +379,12 @@ Pass \fB\-\-installed\fR to get information on installed taps\. See the docs for examples of using the JSON: \fIhttps://github\.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Querying\-Brew\.md\fR . .IP "\(bu" 4 +\fBtap\-pin\fR \fItap\fR: Pin \fItap\fR, prioritizing its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. +. +.IP "\(bu" 4 +\fBtap\-unpin\fR \fItap\fR: Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. +. +.IP "\(bu" 4 \fBtest\fR [\-\-devel|\-\-HEAD] [\-\-debug] \fIformula\fR: A few formulae provide a test method\. \fBbrew test <formula>\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. . .IP
true
Other
Homebrew
brew
4165b34ddeb99e67f9ad3ad856a28f28092aa779.json
add pinned taps count to brew tap-info
Library/Homebrew/cmd/tap-info.rb
@@ -24,12 +24,15 @@ def print_tap_info(taps) tap_count = 0 formula_count = 0 command_count = 0 + pinned_count = 0 Tap.each do |tap| tap_count += 1 formula_count += tap.formula_files.size command_count += tap.command_files.size + pinned_count += 1 if tap.pinned? end info = "#{tap_count} tap#{plural(tap_count)}" + info += ", #{pinned_count} pinned" info += ", #{formula_count} formula#{plural(formula_count, "e")}" info += ", #{command_count} command#{plural(command_count)}" info += ", #{Tap::TAP_DIRECTORY.abv}" if Tap::TAP_DIRECTORY.directory?
false
Other
Homebrew
brew
f3f8ca953fde402f39feab57b5809a28594b690a.json
add pin info to tap-info
Library/Homebrew/cmd/tap-info.rb
@@ -39,6 +39,7 @@ def print_tap_info(taps) puts unless i == 0 info = "#{tap}: " if tap.installed? + info += tap.pinned? ? "pinned, " : "unpinned, " formula_count = tap.formula_files.size info += "#{formula_count} formula#{plural(formula_count, "e")} " if formula_count > 0 command_count = tap.command_files.size
false
Other
Homebrew
brew
1a82b2133eed0599df2375b870bfe4cbf28a02aa.json
implement pinning of taps
Library/Homebrew/cmd/tap-pin.rb
@@ -0,0 +1,13 @@ +require "cmd/tap" + +module Homebrew + def tap_pin + taps = ARGV.named.map do |name| + Tap.new(*tap_args(name)) + end + taps.each do |tap| + tap.pin + ohai "Pinned #{tap.name}" + end + end +end
true
Other
Homebrew
brew
1a82b2133eed0599df2375b870bfe4cbf28a02aa.json
implement pinning of taps
Library/Homebrew/cmd/tap-unpin.rb
@@ -0,0 +1,13 @@ +require "cmd/tap" + +module Homebrew + def tap_unpin + taps = ARGV.named.map do |name| + Tap.new(*tap_args(name)) + end + taps.each do |tap| + tap.unpin + ohai "Unpinned #{tap.name}" + end + end +end
true
Other
Homebrew
brew
1a82b2133eed0599df2375b870bfe4cbf28a02aa.json
implement pinning of taps
Library/Homebrew/cmd/untap.rb
@@ -10,6 +10,8 @@ def untap raise TapUnavailableError, tap.name unless tap.installed? puts "Untapping #{tap}... (#{tap.path.abv})" + tap.unpin if tap.pinned? + formula_count = tap.formula_files.size tap.path.rmtree tap.path.dirname.rmdir_if_possible
true
Other
Homebrew
brew
1a82b2133eed0599df2375b870bfe4cbf28a02aa.json
implement pinning of taps
Library/Homebrew/exceptions.rb
@@ -98,6 +98,17 @@ def initialize(name) end end +class TapPinStatusError < RuntimeError + attr_reader :name, :pinned + + def initialize name, pinned + @name = name + @pinned = pinned + + super pinned ? "#{name} is already pinned." : "#{name} is already unpinned." + end +end + class OperationInProgressError < RuntimeError def initialize(name) message = <<-EOS.undent
true
Other
Homebrew
brew
1a82b2133eed0599df2375b870bfe4cbf28a02aa.json
implement pinning of taps
Library/Homebrew/tap.rb
@@ -99,6 +99,27 @@ def command_files Pathname.glob("#{path}/cmd/brew-*").select(&:executable?) end + def pinned_symlink_path + HOMEBREW_LIBRARY/"PinnedTaps/#{@name}" + end + + def pinned? + @pinned ||= pinned_symlink_path.directory? + end + + def pin + raise TapUnavailableError, name unless installed? + raise TapPinStatusError.new(name, true) if pinned? + pinned_symlink_path.make_relative_symlink(@path) + end + + def unpin + raise TapUnavailableError, name unless installed? + raise TapPinStatusError.new(name, false) unless pinned? + pinned_symlink_path.delete + pinned_symlink_path.dirname.rmdir_if_possible + end + def to_hash { "name" => @name, @@ -111,7 +132,8 @@ def to_hash "custom_remote" => custom_remote?, "formula_names" => formula_names, "formula_files" => formula_files.map(&:to_s), - "command_files" => command_files.map(&:to_s) + "command_files" => command_files.map(&:to_s), + "pinned" => pinned? } end
true
Other
Homebrew
brew
fda82b0b6411a0b88ff149b42a6b78e60ca8d096.json
add /Library/PinnedTaps to .gitignore
.gitignore
@@ -22,3 +22,4 @@ /Library/LinkedKegs /Library/PinnedKegs /Library/Taps +/Library/PinnedTaps
false
Other
Homebrew
brew
df999067d69b660a978e52263eace80dc1786993.json
ARGV#resolved_formulae: use canonical_name to locate rack Closes Homebrew/homebrew#42537. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/extend/ARGV.rb
@@ -27,7 +27,8 @@ def resolved_formulae end f else - Formulary.from_rack(HOMEBREW_CELLAR/name, spec(default=nil)) + canonical_name = Formulary.canonical_name(name) + Formulary.from_rack(HOMEBREW_CELLAR/canonical_name, spec(default=nil)) end end end
false
Other
Homebrew
brew
3518cda7928d1603af130823854aaa3ed7af4118.json
audit: allow assert `!.*.include?`. Came up on Homebrew/homebrew#34573.
Library/Homebrew/cmd/audit.rb
@@ -795,7 +795,7 @@ def audit_line(line, lineno) problem "Use the `#{method}` Ruby method instead of `system #{system}`" end - if line =~ /assert .*\.include?/ + if line =~ /assert [^!]+\.include?/ problem "Use `assert_match` instead of `assert ...include?`" end
false
Other
Homebrew
brew
8fecd4c198948dc1d86240b1a3ee4648da49ffe0.json
help: remove obsoleted argument
Library/Homebrew/cmd/help.rb
@@ -6,7 +6,7 @@ brew search [foo] brew list [FORMULA...] brew update - brew upgrade [--all | FORMULA...] + brew upgrade [FORMULA...] brew pin/unpin [FORMULA...] Troubleshooting:
false
Other
Homebrew
brew
3c8a19777db461a17f15c2271b41043e006b60eb.json
update: handle more exceptions Closes Homebrew/homebrew#42558. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/update.rb
@@ -206,7 +206,7 @@ def report new_version = formula.pkg_version old_version = FormulaVersions.new(formula).formula_at_revision(@initial_revision, &:pkg_version) next if new_version == old_version - rescue LoadError, FormulaUnavailableError => e + rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS => e onoe e if ARGV.homebrew_developer? end map[:M] << file
false
Other
Homebrew
brew
3369c55dc69815c4a4992e131645576950d5f559.json
languages: support both luas
Library/Homebrew/requirements/language_module_requirement.rb
@@ -23,7 +23,8 @@ def the_test case @language when :chicken then %W[/usr/bin/env csi -e (use\ #{@import_name})] when :jruby then %W[/usr/bin/env jruby -rubygems -e require\ '#{@import_name}'] - when :lua then %W[/usr/bin/env luarocks show #{@import_name}] + when :lua then %W[/usr/bin/env luarocks-5.2 show #{@import_name}] + when :lua51 then %W[/usr/bin/env luarocks-5.1 show #{@import_name}] when :node then %W[/usr/bin/env node -e require('#{@import_name}');] when :ocaml then %W[/usr/bin/env opam list --installed #{@import_name}] when :perl then %W[/usr/bin/env perl -e use\ #{@import_name}] @@ -38,7 +39,8 @@ def command_line case @language when :chicken then "chicken-install" when :jruby then "jruby -S gem install" - when :lua then "luarocks install" + when :lua then "luarocks-5.2 install" + when :lua51 then "luarocks-5.1 install" when :node then "npm install" when :ocaml then "opam install" when :perl then "cpan -i"
false
Other
Homebrew
brew
f78a63984bbe9eb9fbf2c6929cb527f8211951a3.json
audit: add check for indefinite article at the beginning of desc. Closes Homebrew/homebrew#42404. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/cmd/audit.rb
@@ -363,6 +363,10 @@ def audit_desc if desc =~ /([Cc]ommand ?line)/ problem "Description should use \"command-line\" instead of \"#{$1}\"" end + + if desc =~ %r[^([Aa]n?)\s] + problem "Please remove the indefinite article \"#{$1}\" from the beginning of the description" + end end def audit_homepage
false
Other
Homebrew
brew
3f8ce5f1a95307a2a836afbbf51565d890ff676f.json
update rubocop to 0.33.0
Library/Homebrew/cmd/style.rb
@@ -8,7 +8,7 @@ def style ARGV.formulae.map(&:path) end - Homebrew.install_gem_setup_path! "rubocop", "0.32.1" + Homebrew.install_gem_setup_path! "rubocop", "0.33.0" args = [ "--format", "simple", "--force-exclusion", "--config",
false
Other
Homebrew
brew
1bb9c56e9c19206404e5cfcf1ff9535a13848c95.json
test-bot: run postinstall on dependencies Closes Homebrew/homebrew#36027. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Library/Homebrew/cmd/test-bot.rb
@@ -475,9 +475,15 @@ def formula(formula_name) end test "brew", "fetch", "--retry", *unchanged_dependencies unless unchanged_dependencies.empty? - test "brew", "fetch", "--retry", "--build-bottle", *changed_dependences unless changed_dependences.empty? - # Install changed dependencies as new bottles so we don't have checksum problems. - test "brew", "install", "--build-bottle", *changed_dependences unless changed_dependences.empty? + + unless changed_dependences.empty? + test "brew", "fetch", "--retry", "--build-bottle", *changed_dependences + # Install changed dependencies as new bottles so we don't have checksum problems. + test "brew", "install", "--build-bottle", *changed_dependences + # Run postinstall on them because the tested formula might depend on + # this step + test "brew", "postinstall", *changed_dependences + end formula_fetch_options = [] formula_fetch_options << "--build-bottle" unless ARGV.include? "--no-bottle" formula_fetch_options << "--force" if ARGV.include? "--cleanup"
false
Other
Homebrew
brew
ea5840ed6192a2c2602223faf53dfcd5f32a26d7.json
keg_relocate: fix syntax error. Closes Homebrew/homebrew#42408.
Library/Homebrew/keg_relocate.rb
@@ -9,7 +9,7 @@ def fix_install_names(options = {}) each_install_name_for(file) do |bad_name| # Don't fix absolute paths unless they are rooted in the build directory - next if bad_name.start_with? "/" && !bad_name.start_with?(HOMEBREW_TEMP.to_s) + next if bad_name.start_with?("/") && !bad_name.start_with?(HOMEBREW_TEMP.to_s) new_name = fixed_name(file, bad_name) change_install_name(bad_name, new_name, file) unless new_name == bad_name
false
Other
Homebrew
brew
3b68215be793774fafd9ce124a2065f5968f50e5.json
rubocop: remove conflicted rules Since trailing commas in method argument lists are a syntax error in 1.8, let's enforce the default rule of `TrailingComma`(i.e. `no_comma`) Closes Homebrew/homebrew#42398. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/.rubocop.yml
@@ -74,10 +74,6 @@ Style/PercentLiteralDelimiters: '%W': '[]' '%x': '()' -# comma on last element is editor friendly -Style/TrailingComma: - EnforcedStyleForMultiline: comma - # conflicts with DSL-style path concatenation with `/` Style/SpaceAroundOperators: Enabled: false @@ -123,10 +119,6 @@ Style/TrailingBlankLines: Style/SignalException: EnforcedStyle: only_raise -# trailing commas in method argument lists are a syntax error in 1.8 -Style/TrailingComma: - Enabled: false - # we prefer compact if-else-end/case-when-end alignment Lint/EndAlignment: AlignWith: variable
false
Other
Homebrew
brew
670ca78eaa139f6a12db91c90208238edb8f9ad2.json
Add Rubocop 1.8 tweaks.
Library/.rubocop.yml
@@ -127,12 +127,16 @@ Style/SignalException: Style/TrailingComma: Enabled: false -# We prefer compact if-else-end/case-when-end alignment +# we prefer compact if-else-end/case-when-end alignment Lint/EndAlignment: AlignWith: variable Style/CaseIndentation: IndentWhenRelativeTo: end -# We prefer Perl-style regex back references +# we prefer Perl-style regex back references Style/PerlBackrefs: Enabled: false + +# this is required for Ruby 1.8 +Style/DotPosition: + EnforcedStyle: trailing
false
Other
Homebrew
brew
b22d899d3aa3d72c06c946001e1370ef23ca78c8.json
Add Alex Dunn as a maintainer. Closes Homebrew/homebrew#42347. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/manpages/brew.1.md
@@ -679,7 +679,7 @@ Homebrew Documentation: <https://github.com/Homebrew/homebrew/blob/master/share/ ## AUTHORS -Homebrew's current maintainers are Misty De Meo, Adam Vandenberg, Xu Cheng, Mike McQuaid, Baptiste Fontaine, Brett Koonce, Dominyk Tiller and Tim Smith. +Homebrew's current maintainers are Misty De Meo, Adam Vandenberg, Xu Cheng, Mike McQuaid, Baptiste Fontaine, Brett Koonce, Dominyk Tiller, Tim Smith and Alex Dunn. Homebrew was originally created by Max Howell.
true
Other
Homebrew
brew
b22d899d3aa3d72c06c946001e1370ef23ca78c8.json
Add Alex Dunn as a maintainer. Closes Homebrew/homebrew#42347. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
README.md
@@ -25,7 +25,7 @@ This is our PGP key which is valid until June 17, 2016. * Full key: https://keybase.io/homebrew/key.asc ## Who Are You? -Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Adam Vandenberg](https://github.com/adamv), [Xu Cheng](https://github.com/xu-cheng), [Mike McQuaid](https://github.com/mikemcquaid), [Baptiste Fontaine](https://github.com/bfontaine), [Brett Koonce](https://github.com/asparagui), [Dominyk Tiller](https://github.com/DomT4) and [Tim Smith](https://github.com/tdsmith). +Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Adam Vandenberg](https://github.com/adamv), [Xu Cheng](https://github.com/xu-cheng), [Mike McQuaid](https://github.com/mikemcquaid), [Baptiste Fontaine](https://github.com/bfontaine), [Brett Koonce](https://github.com/asparagui), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn). Homebrew was originally created by [Max Howell](https://github.com/mxcl).
true
Other
Homebrew
brew
b22d899d3aa3d72c06c946001e1370ef23ca78c8.json
Add Alex Dunn as a maintainer. Closes Homebrew/homebrew#42347. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
share/man/man1/brew.1
@@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "July 2015" "Homebrew" "brew" +.TH "BREW" "1" "August 2015" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for OS X @@ -659,7 +659,7 @@ Homebrew Documentation: \fIhttps://github\.com/Homebrew/homebrew/blob/master/sha \fBgit\fR(1), \fBgit\-log\fR(1) . .SH "AUTHORS" -Homebrew\'s current maintainers are Misty De Meo, Adam Vandenberg, Xu Cheng, Mike McQuaid, Baptiste Fontaine, Brett Koonce, Dominyk Tiller and Tim Smith\. +Homebrew\'s current maintainers are Misty De Meo, Adam Vandenberg, Xu Cheng, Mike McQuaid, Baptiste Fontaine, Brett Koonce, Dominyk Tiller, Tim Smith and Alex Dunn\. . .P Homebrew was originally created by Max Howell\.
true
Other
Homebrew
brew
68a13b240f765b9976dc45bfe97633534544e657.json
formula: define opt_pkgshare helper method. Closes Homebrew/homebrew#42023. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/formula.rb
@@ -500,6 +500,7 @@ def opt_lib; opt_prefix+'lib' end def opt_libexec; opt_prefix+'libexec' end def opt_sbin; opt_prefix+'sbin' end def opt_share; opt_prefix+'share' end + def opt_pkgshare; opt_prefix+'share'+name end def opt_frameworks; opt_prefix+'Frameworks' end # Can be overridden to selectively disable bottles from formulae.
false
Other
Homebrew
brew
8054161153b598d392b0be25a882ae87a5455726.json
test_tab: add test for Tab#spec Fixes Homebrew/homebrew#42147. Closes Homebrew/homebrew#42205. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/fixtures/receipt.json
@@ -9,9 +9,13 @@ ], "built_as_bottle": false, "poured_from_bottle": true, - "tapped_from": "Homebrew/homebrew", "time": 1403827774, "HEAD": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", "stdlib": "libcxx", - "compiler": "clang" + "compiler": "clang", + "source": { + "path": "/usr/local/Library/Formula/foo.rb", + "tap": "Homebrew/homebrew", + "spec": "stable" + } }
true
Other
Homebrew
brew
8054161153b598d392b0be25a882ae87a5455726.json
test_tab: add test for Tab#spec Fixes Homebrew/homebrew#42147. Closes Homebrew/homebrew#42205. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/fixtures/receipt_old.json
@@ -0,0 +1,17 @@ +{ + "used_options": [ + "--with-foo", + "--without-bar" + ], + "unused_options": [ + "--with-baz", + "--without-qux" + ], + "built_as_bottle": false, + "poured_from_bottle": true, + "tapped_from": "Homebrew/homebrew", + "time": 1403827774, + "HEAD": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", + "stdlib": "libcxx", + "compiler": "clang" +}
true
Other
Homebrew
brew
8054161153b598d392b0be25a882ae87a5455726.json
test_tab: add test for Tab#spec Fixes Homebrew/homebrew#42147. Closes Homebrew/homebrew#42205. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/test_tab.rb
@@ -19,6 +19,7 @@ def setup "source" => { "tap" => "Homebrew/homebrew", "path" => nil, + "spec" => "stable", }, }) end @@ -66,6 +67,22 @@ def test_other_attributes assert_predicate @tab, :poured_from_bottle end + def test_from_old_version_file + path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt_old.json") + tab = Tab.from_file(path) + + assert_equal @used.sort, tab.used_options.sort + assert_equal @unused.sort, tab.unused_options.sort + refute_predicate tab, :built_as_bottle + assert_predicate tab, :poured_from_bottle + assert_equal "Homebrew/homebrew", tab.tap + assert_equal :stable, tab.spec + refute_nil tab.time + assert_equal TEST_SHA1, tab.HEAD + assert_equal :clang, tab.cxxstdlib.compiler + assert_equal :libcxx, tab.cxxstdlib.type + end + def test_from_file path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json") tab = Tab.from_file(path) @@ -75,6 +92,7 @@ def test_from_file refute_predicate tab, :built_as_bottle assert_predicate tab, :poured_from_bottle assert_equal "Homebrew/homebrew", tab.tap + assert_equal :stable, tab.spec refute_nil tab.time assert_equal TEST_SHA1, tab.HEAD assert_equal :clang, tab.cxxstdlib.compiler @@ -88,6 +106,7 @@ def test_to_json assert_equal @tab.built_as_bottle, tab.built_as_bottle assert_equal @tab.poured_from_bottle, tab.poured_from_bottle assert_equal @tab.tap, tab.tap + assert_equal @tab.spec, tab.spec assert_equal @tab.time, tab.time assert_equal @tab.HEAD, tab.HEAD assert_equal @tab.compiler, tab.compiler
true
Other
Homebrew
brew
a9e71ca9057798880fb6885e6de9db2b2b7cac34.json
test_formula: add more test
Library/Homebrew/test/test_formula.rb
@@ -25,6 +25,20 @@ def test_revised_prefix assert_equal HOMEBREW_CELLAR/f.name/'0.1_1', f.prefix end + def test_any_version_installed? + f = formula do + url 'foo' + version '1.0' + end + refute_predicate f, :any_version_installed? + prefix = HOMEBREW_CELLAR+f.name+"0.1" + prefix.mkpath + FileUtils.touch (prefix+Tab::FILENAME) + assert_predicate f, :any_version_installed? + ensure + f.rack.rmtree + end + def test_installed? f = Testball.new f.stubs(:installed_prefix).returns(stub(:directory? => false)) @@ -172,6 +186,27 @@ def test_formula_spec_integration assert_version_equal "HEAD", f.head.version end + def test_formula_set_active_spec + f = formula do + url 'foo' + version '1.0' + revision 1 + + devel do + url 'foo' + version '1.0beta' + end + end + assert_equal :stable, f.active_spec_sym + assert_equal f.stable, f.send(:active_spec) + assert_equal "1.0_1", f.pkg_version.to_s + f.set_active_spec(:devel) + assert_equal :devel, f.active_spec_sym + assert_equal f.devel, f.send(:active_spec) + assert_equal "1.0beta_1", f.pkg_version.to_s + assert_raises(FormulaSpecificationError) { f.set_active_spec(:head) } + end + def test_path name = 'foo-bar' assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb"), Formulary.core_path(name)
false
Other
Homebrew
brew
21eecbf1d6cfa162b50bf0fc2dd4aed259c5d3c2.json
Formula: add set_acitve_spec method
Library/Homebrew/formula.rb
@@ -119,6 +119,16 @@ def initialize(name, path, spec) @pin = FormulaPin.new(self) end + # @private + def set_active_spec(spec_sym) + spec = send(spec_sym) + raise FormulaSpecificationError, "#{spec_sym} spec is not available for #{full_name}" unless spec + @active_spec = spec + @active_spec_sym = spec_sym + validate_attributes! + @build = active_spec.build + end + private def set_spec(name)
false
Other
Homebrew
brew
5aa6b5c5faa605d3dfd39ce86803c3d967093d06.json
Formula#pkg_version: return the result based on current active_spec
Library/Homebrew/formula.rb
@@ -67,9 +67,6 @@ class Formula # @see #active_spec attr_reader :active_spec_sym - # The {PkgVersion} for this formula with version and {#revision} information. - attr_reader :pkg_version - # Used for creating new Homebrew versions of software without new upstream # versions. # @see .revision @@ -118,7 +115,6 @@ def initialize(name, path, spec) :stable end validate_attributes! - @pkg_version = PkgVersion.new(version, revision) @build = active_spec.build @pin = FormulaPin.new(self) end @@ -207,6 +203,11 @@ def version active_spec.version end + # The {PkgVersion} for this formula with {version} and {#revision} information. + def pkg_version + PkgVersion.new(version, revision) + end + # A named Resource for the currently active {SoftwareSpec}. def resource(name) active_spec.resource(name)
false
Other
Homebrew
brew
46d45677cc06a479c39fc7a59d9077de9d84d842.json
xcode: update clang expectation for 10.11
Library/Homebrew/os/mac/xcode.rb
@@ -163,7 +163,7 @@ def installed? def latest_version case MacOS.version - when "10.11" then "700.0.57.2" + when "10.11" then "700.0.59.1" when "10.10" then "602.0.53" when "10.9" then "600.0.57" when "10.8" then "503.0.40"
false
Other
Homebrew
brew
a9b9c5ade798ca8378f9e8bf3d82f6f2b01d8312.json
Tap: allow enumerate non-git taps Also add a `Tap#git?` method to indicate whether the tap is a git repository. Closes Homebrew/homebrew#42264. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/update.rb
@@ -27,7 +27,7 @@ def update # this procedure will be removed in the future if it seems unnecessasry rename_taps_dir_if_necessary - Tap.each do |tap| + Tap.select(&:git?).each do |tap| tap.path.cd do updater = Updater.new(tap.path)
true
Other
Homebrew
brew
a9b9c5ade798ca8378f9e8bf3d82f6f2b01d8312.json
Tap: allow enumerate non-git taps Also add a `Tap#git?` method to indicate whether the tap is a git repository. Closes Homebrew/homebrew#42264. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/tap.rb
@@ -37,7 +37,7 @@ def initialize(user, repo) # e.g. `https://github.com/user/homebrew-repo` def remote @remote ||= if installed? - if (@path/".git").exist? + if git? @path.cd do Utils.popen_read("git", "config", "--get", "remote.origin.url").chomp end @@ -49,6 +49,11 @@ def remote end end + # True if this {Tap} is a git repository. + def git? + (@path/".git").exist? + end + def to_s name end @@ -117,9 +122,7 @@ def self.each TAP_DIRECTORY.subdirs.each do |user| user.subdirs.each do |repo| - if (repo/".git").directory? - yield new(user.basename.to_s, repo.basename.to_s.sub("homebrew-", "")) - end + yield new(user.basename.to_s, repo.basename.to_s.sub("homebrew-", "")) end end end
true
Other
Homebrew
brew
8c7b6291491ec0a6d50c7b0dfcc4912d12253418.json
formula_installer: relocate bottle immediately after it's poured Closes Homebrew/homebrew#42268. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formula_installer.rb
@@ -398,7 +398,7 @@ def finish keg = Keg.new(formula.prefix) link(keg) - fix_install_names(keg) if OS.mac? + fix_install_names(keg) if build_bottle? && formula.post_install_defined? ohai "Not running post_install as we're building a bottle" @@ -580,11 +580,6 @@ def install_plist def fix_install_names(keg) keg.fix_install_names(:keg_only => formula.keg_only?) - - if @poured_bottle - keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s, - Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only? - end rescue Exception => e onoe "Failed to fix install names" puts "The formula built, but you may encounter issues using it or linking other" @@ -630,6 +625,10 @@ def pour downloader.stage end + keg = Keg.new(formula.prefix) + keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s, + Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only? + Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path| path.extend(InstallRenamed) path.cp_path_sub(formula.bottle_prefix, HOMEBREW_PREFIX)
false
Other
Homebrew
brew
3e8be58cdf2df38e57dcd8451925a075b8836958.json
yardopts: stop documenting compat codes Closes Homebrew/homebrew#42243. Signed-off-by: Xu Cheng <xucheng@me.com>
.yardopts
@@ -4,6 +4,7 @@ --no-private --exclude Library/Homebrew/test/ --exclude Library/Homebrew/vendor/ +--exclude Library/Homebrew/compat/ Library/Homebrew/**/*.rb - Library/Homebrew/*.md
false
Other
Homebrew
brew
70025458f36c12768c603a3c9cc0f0faf32ccd98.json
interactive_shell: create .zshrc when necessary Closes Homebrew/homebrew#42190. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/utils.rb
@@ -88,6 +88,10 @@ def interactive_shell f=nil ENV['HOMEBREW_DEBUG_INSTALL'] = f.full_name end + if ENV["SHELL"].include?("zsh") && ENV["HOME"].start_with?(HOMEBREW_TEMP.resolved_path.to_s) + FileUtils.touch "#{ENV["HOME"]}/.zshrc" + end + Process.wait fork { exec ENV['SHELL'] } if $?.success?
false
Other
Homebrew
brew
274f21388e3db056069fc176b24e543d666854c6.json
Revert "formula: create empty zshrc when zsh is shell" This reverts commit be55c800d0bf2750902df71d092906b49b49ffce.
Library/Homebrew/formula.rb
@@ -928,7 +928,6 @@ def stage @buildpath = Pathname.pwd env_home = buildpath/".brew_home" mkdir_p env_home - touch env_home/".zshrc" if ENV["SHELL"].include? "zsh" old_home, ENV["HOME"] = ENV["HOME"], env_home
false
Other
Homebrew
brew
09acae83a685bfdcf228cf0177851eeec2799372.json
.simplecov: use lower root directory.
Library/Homebrew/test/.simplecov
@@ -5,12 +5,13 @@ SimpleCov.start do minimum_coverage 50 coverage_dir File.expand_path("#{tests_path}/coverage") - root File.expand_path("#{tests_path}/..") + root File.expand_path("#{tests_path}/../../") - add_filter "Homebrew/test/" add_filter "vendor/bundle/" - add_filter "Homebrew/vendor/" + add_filter "Formula/" add_filter "Homebrew/compat/" + add_filter "Homebrew/test/" + add_filter "Homebrew/vendor/" end if name = ENV["HOMEBREW_INTEGRATION_TEST"]
false
Other
Homebrew
brew
95658a5beb4b2d4cff8947a711661cb8a4645358.json
Move simplecov configuration to dotfile.
Library/Homebrew/test/.simplecov
@@ -0,0 +1,24 @@ +# vim: filetype=ruby + +SimpleCov.start do + tests_path = File.dirname(__FILE__) + + minimum_coverage 50 + coverage_dir File.expand_path("#{tests_path}/coverage") + root File.expand_path("#{tests_path}/..") + + add_filter "Homebrew/test/" + add_filter "vendor/bundle/" + add_filter "Homebrew/vendor/" + add_filter "Homebrew/compat/" +end + +if name = ENV["HOMEBREW_INTEGRATION_TEST"] + SimpleCov.command_name "brew #{name}" + SimpleCov.at_exit do + exit_code = $!.nil? ? 0 : $!.status + $stdout.reopen("/dev/null") + SimpleCov.result.format! + exit! exit_code + end +end
true
Other
Homebrew
brew
95658a5beb4b2d4cff8947a711661cb8a4645358.json
Move simplecov configuration to dotfile.
Library/Homebrew/test/testing_env.rb
@@ -1,23 +1,7 @@ $:.unshift File.expand_path("../..", __FILE__) $:.unshift File.expand_path("../lib", __FILE__) -# This must be at the top -if ENV["HOMEBREW_TESTS_COVERAGE"] - require "simplecov" - SimpleCov.start do - tests_path = File.dirname(__FILE__) - - minimum_coverage 50 - coverage_dir File.expand_path("#{tests_path}/coverage") - root File.expand_path("#{tests_path}/..") - - add_filter "Homebrew/test/" - add_filter "vendor/bundle/" - add_filter "Homebrew/vendor/" - add_filter "Homebrew/compat/" - end -end - +require "simplecov" if ENV["HOMEBREW_TESTS_COVERAGE"] require "global" # Test environment setup
true
Other
Homebrew
brew
cc91273f8bceea64f086677f76aeeca31c7548c7.json
caveats: fix extra empty line
Library/Homebrew/caveats.rb
@@ -32,7 +32,7 @@ def keg end def keg_only_text - return "" unless f.keg_only? + return unless f.keg_only? s = "This formula is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX}." s << "\n\n#{f.keg_only_reason.to_s}"
false
Other
Homebrew
brew
a675aae553949706c54c8868a941373d73909260.json
pull: stop printing warning on test-bot Closes Homebrew/homebrew#42097. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/cmd/pull.rb
@@ -99,7 +99,7 @@ def pull branch = `git symbolic-ref --short HEAD`.strip unless branch == "master" - opoo "Current branch is #{branch}: do you need to pull inside master?" + opoo "Current branch is #{branch}: do you need to pull inside master?" unless ARGV.include? "--clean" end pull_url url @@ -189,10 +189,11 @@ def pull "-u#{bintray_user}:#{bintray_key}", "-X", "POST", "-d", '{"publish_wait_for_secs": -1}', "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish" + sleep 5 success = system "brew", "fetch", "--retry", "--force-bottle", f.full_name unless success - ohai "That didn't work; waiting for 15 seconds and trying again..." - sleep 15 + ohai "That didn't work; sleeping another 10 and trying again..." + sleep 10 system "brew", "fetch", "--retry", "--force-bottle", f.full_name end end
false
Other
Homebrew
brew
4625fd335c62e0bc6bcad2d4de482174bc353ee3.json
formula: create empty zshrc when zsh is shell One minor consequence of our seizing of the HOME variable during builds for sandboxing purposes is that if you're doing an interactive or git installation zsh flags up that it hasn't found any config files and throws you into the `zsh-newuser-install` area. Not really a problem, just a nuisance. Since the check is just for existence rather than content, we can work around this by creating an empty config file when the `SHELL` environmental variable includes zsh.
Library/Homebrew/formula.rb
@@ -928,6 +928,7 @@ def stage @buildpath = Pathname.pwd env_home = buildpath/".brew_home" mkdir_p env_home + touch env_home/".zshrc" if ENV["SHELL"].include? "zsh" old_home, ENV["HOME"] = ENV["HOME"], env_home
false
Other
Homebrew
brew
b1fff3205584e1e42ae750b2af7ca17963929aa9.json
BottleLoader: check version mismatch Closes Homebrew/homebrew#42049. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/exceptions.rb
@@ -301,3 +301,13 @@ def initialize(resource) super "Resource #{resource.inspect} is defined more than once" end end + +class BottleVersionMismatchError < RuntimeError + def initialize bottle_file, bottle_version, formula, formula_version + super <<-EOS.undent + Bottle version mismatch + Bottle: #{bottle_file} (#{bottle_version}) + Formula: #{formula.full_name} (#{formula_version}) + EOS + end +end
true
Other
Homebrew
brew
b1fff3205584e1e42ae750b2af7ca17963929aa9.json
BottleLoader: check version mismatch Closes Homebrew/homebrew#42049. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formulary.rb
@@ -90,6 +90,11 @@ def initialize bottle_name def get_formula(spec) formula = super formula.local_bottle_path = @bottle_filename + formula_version = formula.pkg_version + bottle_version = bottle_resolve_version(@bottle_filename) + unless formula_version == bottle_version + raise BottleVersionMismatchError.new(@bottle_filename, bottle_version, formula, formula_version) + end formula end end
true
Other
Homebrew
brew
81e4f810c1be24eefbf0657410990bd8e167a024.json
caveats: use two spaces instead of 4
Library/Homebrew/caveats.rb
@@ -155,43 +155,43 @@ def plist_caveats if !plist_path.file? || !plist_path.symlink? if f.plist_startup s << "To have launchd start #{f.full_name} at startup:" - s << " sudo mkdir -p #{destination}" unless destination_path.directory? - s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}" - s << " sudo chown root #{plist_link}" + s << " sudo mkdir -p #{destination}" unless destination_path.directory? + s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}" + s << " sudo chown root #{plist_link}" else s << "To have launchd start #{f.full_name} at login:" - s << " mkdir -p #{destination}" unless destination_path.directory? - s << " ln -sfv #{f.opt_prefix}/*.plist #{destination}" + s << " mkdir -p #{destination}" unless destination_path.directory? + s << " ln -sfv #{f.opt_prefix}/*.plist #{destination}" end s << "Then to load #{f.full_name} now:" if f.plist_startup - s << " sudo launchctl load #{plist_link}" + s << " sudo launchctl load #{plist_link}" else - s << " launchctl load #{plist_link}" + s << " launchctl load #{plist_link}" end # For startup plists, we cannot tell whether it's running on launchd, # as it requires for `sudo launchctl list` to get real result. elsif f.plist_startup - s << "To reload #{f.full_name} after an upgrade:" - s << " sudo launchctl unload #{plist_link}" - s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}" - s << " sudo chown root #{plist_link}" - s << " sudo launchctl load #{plist_link}" + s << "To reload #{f.full_name} after an upgrade:" + s << " sudo launchctl unload #{plist_link}" + s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}" + s << " sudo chown root #{plist_link}" + s << " sudo launchctl load #{plist_link}" elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" - s << "To reload #{f.full_name} after an upgrade:" - s << " launchctl unload #{plist_link}" - s << " launchctl load #{plist_link}" + s << "To reload #{f.full_name} after an upgrade:" + s << " launchctl unload #{plist_link}" + s << " launchctl load #{plist_link}" else - s << "To load #{f.full_name}:" - s << " launchctl load #{plist_link}" + s << "To load #{f.full_name}:" + s << " launchctl load #{plist_link}" end if f.plist_manual s << "Or, if you don't want/need launchctl, you can just run:" - s << " #{f.plist_manual}" + s << " #{f.plist_manual}" end - s << "" << "WARNING: launchctl will fail when run under tmux." if ENV['TMUX'] + s << "" << "WARNING: launchctl will fail when run under tmux." if ENV["TMUX"] end s.join("\n") unless s.empty? end
false
Other
Homebrew
brew
de6a9ff055f9f691f132b03d297268590a42a541.json
keg_relocate: relocate libtool files
Library/Homebrew/keg_relocate.rb
@@ -38,7 +38,9 @@ def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, optio end end - text_files.group_by { |f| f.stat.ino }.each_value do |first, *rest| + files = text_files | libtool_files + + files.group_by { |f| f.stat.ino }.each_value do |first, *rest| s = first.open("rb", &:read) changed = s.gsub!(old_cellar, new_cellar) changed = s.gsub!(old_prefix, new_prefix) || changed @@ -171,4 +173,15 @@ def text_files text_files end + + def libtool_files + libtool_files = [] + + # find .la files, which are stored in lib/ + lib.find do |pn| + next if pn.symlink? or pn.directory? or pn.extname != '.la' + libtool_files << pn + end if lib.directory? + libtool_files + end end
false
Other
Homebrew
brew
fd7f3b949659cedef62ac58258c652bea58ef1a7.json
Pathname#abv: handle the case `du` returns empty string This can happen when read permission is denied. Fixes Homebrew/homebrew#41925. Closes Homebrew/homebrew#42011. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/extend/pathname.rb
@@ -393,7 +393,9 @@ def abv out = "" n = Utils.popen_read("find", expand_path.to_s, "-type", "f", "!", "-name", ".DS_Store").split("\n").size out << "#{n} files, " if n > 1 - out << Utils.popen_read("/usr/bin/du", "-hs", expand_path.to_s).split("\t")[0].strip + size = Utils.popen_read("/usr/bin/du", "-hs", expand_path.to_s).split("\t")[0] + size ||= "0B" + out << size.strip out end
false
Other
Homebrew
brew
ebd0f345619b6fd76751275b43a97d5ac5e11b76.json
tests: show fs leak result Closes Homebrew/homebrew#41956. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/tests.rb
@@ -9,6 +9,14 @@ def tests system("bundle", "install", "--path", "vendor/bundle") system "bundle", "exec", "rake", "test" Homebrew.failed = !$?.success? + if (fs_leak_log = HOMEBREW_LIBRARY/"Homebrew/test/fs_leak_log").file? + fs_leak_log_content = fs_leak_log.read + unless fs_leak_log_content.empty? + opoo "File leak is detected" + puts fs_leak_log_content + Homebrew.failed = true + end + end end end end
false
Other
Homebrew
brew
33befcf312e12496fc1a6b0df531f03d97dfe954.json
tests: fix patching test for no-compat mode Closes Homebrew/homebrew#41977. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formula.rb
@@ -941,7 +941,7 @@ def stage end def prepare_patches - active_spec.add_legacy_patches(patches) + active_spec.add_legacy_patches(patches) if respond_to?(:patches) patchlist.grep(DATAPatch) { |p| p.path = path }
true
Other
Homebrew
brew
33befcf312e12496fc1a6b0df531f03d97dfe954.json
tests: fix patching test for no-compat mode Closes Homebrew/homebrew#41977. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/test_patching.rb
@@ -106,7 +106,7 @@ def test_patch_string_with_strip def test_patch_DATA_constant assert_patched formula("test", Pathname.new(__FILE__).expand_path) { def patches - Formula::DATA + :DATA end } end
true
Other
Homebrew
brew
60600c824cb07b36bc74b7a7f363069f8c29a8ca.json
test-bot: build bottle with verbose It will print out what stops bottle being relocatable. Closes Homebrew/homebrew#41958. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/test-bot.rb
@@ -508,7 +508,7 @@ def formula formula_name test "brew", "audit", *audit_args if install_passed if formula.stable? && !ARGV.include?('--no-bottle') - bottle_args = ["--rb", canonical_formula_name] + bottle_args = ["--verbose", "--rb", canonical_formula_name] bottle_args << { :puts_output_on_success => true } test "brew", "bottle", *bottle_args bottle_step = steps.last
false
Other
Homebrew
brew
bc650a4f0d3689cab306a66f2a874aea1cdc7c24.json
test_formula_installer: remove ScriptFileFormula test It's deprecated and breaks `brew tests` in no-compat mode.
Library/Homebrew/test/test_formula_installer.rb
@@ -49,22 +49,4 @@ def test_a_basic_install assert_equal 3, bin.children.length end end - - def test_script_install - mktmpdir do |dir| - name = "test_script_formula" - path = Pathname.new(dir)+"#{name}.rb" - - path.write <<-EOS.undent - class #{Formulary.class_s(name)} < ScriptFileFormula - url "file://#{File.expand_path(__FILE__)}" - version "1" - end - EOS - - f = Formulary.factory(path.to_s) - - temporary_install(f) { assert_equal 1, f.bin.children.length } - end - end end
false
Other
Homebrew
brew
1ead0d4fe556cd7a671ea2f66f72354f4a40fc8c.json
tests: use ARGV.include? instead of ARGV.flag?
Library/Homebrew/cmd/tests.rb
@@ -2,7 +2,7 @@ module Homebrew def tests (HOMEBREW_LIBRARY/"Homebrew/test").cd do ENV["TESTOPTS"] = "-v" if ARGV.verbose? - ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.flag? "--coverage" + ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.include? "--coverage" Homebrew.install_gem_setup_path! "bundler" quiet_system("bundle", "check") || \ system("bundle", "install", "--path", "vendor/bundle")
false
Other
Homebrew
brew
9877b1e7b8e62e8285b459cabe70556c37abfe75.json
doctor: update xcode links
Library/Homebrew/cmd/doctor.rb
@@ -277,7 +277,7 @@ def check_xcode_up_to_date Your Xcode (#{MacOS::Xcode.version}) is outdated Please update to Xcode #{MacOS::Xcode.latest_version}. Xcode can be updated from - https://developer.apple.com/downloads + https://developer.apple.com/xcode/downloads/ EOS end end @@ -317,7 +317,7 @@ def check_xcode_up_to_date Your Xcode (#{MacOS::Xcode.version}) is outdated Please update to Xcode #{MacOS::Xcode.latest_version}. Xcode can be updated from - https://developer.apple.com/downloads + https://developer.apple.com/xcode/downloads/ EOS end end @@ -336,7 +336,7 @@ def check_for_installed_developer_tools unless MacOS::Xcode.installed? then <<-EOS.undent Xcode is not installed. Most formulae need Xcode to build. It can be installed from - https://developer.apple.com/downloads + https://developer.apple.com/xcode/downloads/ EOS end end @@ -346,7 +346,7 @@ def check_xcode_up_to_date Your Xcode (#{MacOS::Xcode.version}) is outdated Please update to Xcode #{MacOS::Xcode.latest_version}. Xcode can be updated from - https://developer.apple.com/downloads + https://developer.apple.com/xcode/downloads/ EOS end end
false
Other
Homebrew
brew
7fc6caf41ef15af4214da1d2b07bb118333410d3.json
requirements: update xcode url Closes Homebrew/homebrew#41722. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/requirements.rb
@@ -42,7 +42,7 @@ def message EOS else message += <<-EOS.undent - Xcode can be installed from https://developer.apple.com/downloads/ + Xcode can be installed from https://developer.apple.com/xcode/downloads/ EOS end end
false
Other
Homebrew
brew
842c0227bc7f69211a1feaa6f34c8a85c925c139.json
TapFormulaUnavailableError: add back user and repo method Fixes Homebrew/homebrew#41888.
Library/Homebrew/exceptions.rb
@@ -51,10 +51,12 @@ def to_s end class TapFormulaUnavailableError < FormulaUnavailableError - attr_reader :tap + attr_reader :tap, :user, :repo def initialize tap, name @tap = tap + @user = tap.user + @repo = tap.repo super "#{tap}/#{name}" end
false
Other
Homebrew
brew
140f8e3df780cee9d69c7d314d62ca0abe4a42de.json
improve TapLoader and TapFormulaUnavailableError * Restore the ability to load formula by `user/homebrew-repo/foo`. * Only suggest to install tap when tap isn't installed. Closes Homebrew/homebrew#41705. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/exceptions.rb
@@ -51,17 +51,17 @@ def to_s end class TapFormulaUnavailableError < FormulaUnavailableError - attr_reader :user, :repo, :shortname + attr_reader :tap - def initialize name - super - @user, @repo, @shortname = name.split("/", 3) + def initialize tap, name + @tap = tap + super "#{tap}/#{name}" end - def to_s; <<-EOS.undent - No available formula for #{shortname} #{dependent_s} - Please tap it and then try again: brew tap #{user}/#{repo} - EOS + def to_s + s = super + s += "\nPlease tap it and then try again: brew tap #{tap}" unless tap.installed? + s end end
true
Other
Homebrew
brew
140f8e3df780cee9d69c7d314d62ca0abe4a42de.json
improve TapLoader and TapFormulaUnavailableError * Restore the ability to load formula by `user/homebrew-repo/foo`. * Only suggest to install tap when tap isn't installed. Closes Homebrew/homebrew#41705. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formulary.rb
@@ -131,22 +131,21 @@ def load_file # Loads tapped formulae. class TapLoader < FormulaLoader - attr_reader :tapped_name + attr_reader :tap def initialize tapped_name - @tapped_name = tapped_name user, repo, name = tapped_name.split("/", 3).map(&:downcase) - tap = Tap.new user, repo - path = tap.formula_files.detect { |file| file.basename(".rb").to_s == name } - path ||= tap.path/"#{name}.rb" + @tap = Tap.new user, repo.sub(/^homebrew-/, "") + path = @tap.formula_files.detect { |file| file.basename(".rb").to_s == name } + path ||= @tap.path/"#{name}.rb" super name, path end def get_formula(spec) super rescue FormulaUnavailableError => e - raise TapFormulaUnavailableError, tapped_name, e.backtrace + raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace end end
true
Other
Homebrew
brew
b9cdfe21fc7c1dbfa2f6ce7a087a47556dfff5df.json
keg_relocate: relocate all text files. Work out what's text and what's not using `file`. Also, rename `keg_fix_install_names` to `keg_relocate` because that's a more accurate description of what it does now. Closes Homebrew/homebrew#41663. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/keg.rb
@@ -1,5 +1,5 @@ require "extend/pathname" -require "keg_fix_install_names" +require "keg_relocate" require "formula_lock" require "ostruct"
true
Other
Homebrew
brew
b9cdfe21fc7c1dbfa2f6ce7a087a47556dfff5df.json
keg_relocate: relocate all text files. Work out what's text and what's not using `file`. Also, rename `keg_fix_install_names` to `keg_relocate` because that's a more accurate description of what it does now. Closes Homebrew/homebrew#41663. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/keg_relocate.rb
@@ -38,10 +38,7 @@ def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, optio end end - files = pkgconfig_files | libtool_files | script_files | plist_files - files << tab_file if tab_file.file? - - files.group_by { |f| f.stat.ino }.each_value do |first, *rest| + text_files.group_by { |f| f.stat.ino }.each_value do |first, *rest| s = first.open("rb", &:read) changed = s.gsub!(old_cellar, new_cellar) changed = s.gsub!(old_prefix, new_prefix) || changed @@ -161,55 +158,14 @@ def mach_o_files mach_o_files end - def script_files - script_files = [] - - # find all files with shebangs - find do |pn| + def text_files + text_files = [] + path.find do |pn| next if pn.symlink? or pn.directory? - script_files << pn if pn.text_executable? - end - - script_files - end - - def pkgconfig_files - pkgconfig_files = [] - - %w[lib share].each do |dir| - pcdir = path.join(dir, "pkgconfig") - - pcdir.find do |pn| - next if pn.symlink? or pn.directory? or pn.extname != '.pc' - pkgconfig_files << pn - end if pcdir.directory? + next if Metafiles::EXTENSIONS.include? pn.extname + text_files << pn if Utils.popen_read("/usr/bin/file", pn).include?("text") end - pkgconfig_files - end - - def libtool_files - libtool_files = [] - - # find .la files, which are stored in lib/ - lib.find do |pn| - next if pn.symlink? or pn.directory? or pn.extname != '.la' - libtool_files << pn - end if lib.directory? - libtool_files - end - - def plist_files - plist_files = [] - - self.find do |pn| - next if pn.symlink? or pn.directory? or pn.extname != '.plist' - plist_files << pn - end - plist_files - end - - def tab_file - join(Tab::FILENAME) + text_files end end
true
Other
Homebrew
brew
c7e986d65e21e81a27c01ee4393ef6b897b91c03.json
use ohai headers at the top of search results Closes Homebrew/homebrew#41832.
Library/Homebrew/cmd/install.rb
@@ -87,9 +87,9 @@ def install else ofail e.message query = query_regexp(e.name) - puts "Searching formulae..." + ohai "Searching formulae..." puts_columns(search_formulae(query)) - puts "Searching taps..." + ohai "Searching taps..." puts_columns(search_taps(query)) # If they haven't updated in 48 hours (172800 seconds), that
true
Other
Homebrew
brew
c7e986d65e21e81a27c01ee4393ef6b897b91c03.json
use ohai headers at the top of search results Closes Homebrew/homebrew#41832.
Library/Homebrew/utils.rb
@@ -433,7 +433,7 @@ def issues_for_formula name def print_pull_requests_matching(query) return [] if ENV['HOMEBREW_NO_GITHUB_API'] - puts "Searching pull requests..." + ohai "Searching pull requests..." open_or_closed_prs = issues_matching(query, :type => "pr")
true
Other
Homebrew
brew
24b0639e27b69335ce10a1adb745e7025b3195c9.json
audit: recommend use of assert_match. It produces significantly easier output to debug than doing `assert` and `.include?` (which just shows if it passed or failed). Closes Homebrew/homebrew#41662. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/audit.rb
@@ -794,6 +794,10 @@ def audit_line(line, lineno) problem "Use the `#{method}` Ruby method instead of `system #{system}`" end + if line =~ /assert .*\.include?/ + problem "Use `assert_match` instead of `assert ...include?`" + end + if @strict if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/ bad_system = $1
false
Other
Homebrew
brew
b554c8bcca3042f7e3664f7a892c285201cfbd39.json
audit: clarify desc calculation
Library/Homebrew/cmd/audit.rb
@@ -354,7 +354,10 @@ def audit_desc # Make sure the formula name plus description is no longer than 80 characters linelength = formula.full_name.length + ": ".length + desc.length if linelength > 80 - problem "Description is too long. \"name: desc\" should be less than 80 characters (currently #{linelength})." + problem <<-EOS.undent + Description is too long. \"name: desc\" should be less than 80 characters. + Length is calculated as #{formula.full_name} + desc. (currently #{linelength}) + EOS end if desc =~ %r[[Cc]ommandline]
false
Other
Homebrew
brew
b1caa4c44bc60dc0c7f928aa62d215a2d8626551.json
formula_cellar_checks: remove openssl expectation
Library/Homebrew/formula_cellar_checks.rb
@@ -104,7 +104,7 @@ def check_generic_executables bin end def check_shadowed_headers - ["libtool", "subversion", "berkeley-db", "openssl"].each do |formula_name| + ["libtool", "subversion", "berkeley-db"].each do |formula_name| return if formula.name.start_with?(formula_name) end
false
Other
Homebrew
brew
52de5aa9847d700b63c70ec75c1a98dc848c43e4.json
doctor: remove redundant EOS Closes Homebrew/homebrew#41667
Library/Homebrew/cmd/doctor.rb
@@ -279,7 +279,6 @@ def check_xcode_up_to_date Xcode can be updated from https://developer.apple.com/downloads EOS - EOS end end else
false
Other
Homebrew
brew
3ba3ecba9dec22a0f12533792fdfb6a9910cc81b.json
audit --online: check homepage reachability Closes Homebrew/homebrew#41607. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Library/Homebrew/cmd/audit.rb
@@ -428,6 +428,13 @@ def audit_homepage %r[^http://code\.google\.com/] problem "Please use https:// for #{homepage}" end + + return unless @online + begin + nostdout { curl "--connect-timeout", "15", "-IL", "-o", "/dev/null", homepage } + rescue ErrorDuringExecution + problem "The homepage is not reachable (curl exit code #{$?.exitstatus})" + end end def audit_github_repository
false
Other
Homebrew
brew
dfbc2df09fc46c239fa099ef18507a498379c820.json
download_strategy: kill special ssl3 support Closes Homebrew/homebrew#41536. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/download_strategy.rb
@@ -397,12 +397,8 @@ def _fetch end end -# Download from an SSL3-only host. -class CurlSSL3DownloadStrategy < CurlDownloadStrategy - def _curl_opts - super << '-3' - end -end +# @deprecated +CurlSSL3DownloadStrategy = CurlDownloadStrategy # Use this strategy to download but not unzip a file. # Useful for installing jars.
false
Other
Homebrew
brew
ca458a8ed1de8250d22cf6c48f90ab34cb47bea9.json
shell completion: support external commands Closes Homebrew/homebrew#41519. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Contributions/brew_bash_completion.sh
@@ -580,62 +580,7 @@ _brew () done if [[ $i -eq $COMP_CWORD ]]; then - __brewcomp " - --cache --cellar - --env --prefix --repository - aspell-dictionaries - audit - bottle - cat - cleanup - commands - config --config - create - deps - diy configure - doctor - edit - fetch - gist-logs - help - home - info abv - install - irb - leaves - linkapps - link ln - list ls - log - man - missing - options - outdated - prune - pin - postinstall - pull - readall - search - reinstall - sh - style - switch - tap - tap-readme - test - test-bot - tests - uninstall remove rm - unlink - unlinkapps - unpack - unpin - untap - update - upgrade - uses - " + __brewcomp "$(brew commands --quiet --include-aliases)" return fi @@ -677,7 +622,7 @@ _brew () uninstall|remove|rm) _brew_uninstall ;; unpack) _brew_unpack ;; unpin) __brew_complete_formulae ;; - untap) __brew_complete_tapped ;; + untap|tap-info) __brew_complete_tapped ;; update) _brew_update ;; upgrade) _brew_upgrade ;; uses) _brew_uses ;;
true
Other
Homebrew
brew
ca458a8ed1de8250d22cf6c48f90ab34cb47bea9.json
shell completion: support external commands Closes Homebrew/homebrew#41519. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Contributions/brew_zsh_completion.zsh
@@ -25,7 +25,6 @@ _brew_outdated_formulae() { local -a _1st_arguments _1st_arguments=( 'audit:check formulae for Homebrew coding style' - 'bundle:look for a Brewfile and run each line as a brew command' 'cat:display formula file for a formula' 'cleanup:uninstall unused and old versions of packages' 'commands:show a list of commands' @@ -55,6 +54,7 @@ _1st_arguments=( 'update:freshen up links' 'upgrade:upgrade outdated formulae' 'uses:show formulae which depend on a formula' + `brew commands --quiet --include-aliases` ) local expl @@ -97,7 +97,7 @@ case "$words[1]" in _arguments \ '(--macports)--macports[search the macports repository]' \ '(--fink)--fink[search the fink repository]' ;; - untap) + untap|tap-info) _brew_installed_taps _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;; upgrade)
true
Other
Homebrew
brew
0b740f51abcd9ae2704e10d74d62d839ea9a8ff0.json
README: use long key ID Closes Homebrew/homebrew#41493. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
README.md
@@ -20,7 +20,7 @@ Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/homebre Please report security issues to security@brew.sh. This is our PGP key which is valid until June 17, 2016. -* Key ID: `CE59E297` +* Key ID: `0xE33A3D3CCE59E297` * Fingerprint: `C657 8F76 2E23 441E C879 EC5C E33A 3D3C CE59 E297` * Full key: https://keybase.io/homebrew/key.asc
false
Other
Homebrew
brew
6a534f569d617e6323c736be4e1753fa6ad597a9.json
xcode: update clang for 10.11
Library/Homebrew/os/mac/xcode.rb
@@ -163,7 +163,7 @@ def installed? def latest_version case MacOS.version - when "10.11" then "700.0.53.3" + when "10.11" then "700.0.57.2" when "10.10" then "602.0.53" when "10.9" then "600.0.57" when "10.8" then "503.0.40"
false
Other
Homebrew
brew
ec4bfee3e72f6fe438455ace35ca2126a7134ba1.json
doc: add xcode 6.4 Closes Homebrew/homebrew#41486. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
share/doc/homebrew/Xcode.md
@@ -9,7 +9,7 @@ Tools available for your platform: 10.7 | 4.6.3 | April 2013 10.8 | 5.1.1 | April 2014 10.9 | 6.2 | 6.2 - 10.10 | 6.3.2 | 6.3.2 + 10.10 | 6.4 | 6.4 ## Compiler Version Database @@ -54,6 +54,7 @@ Tools available for your platform: 6.3 | β€” | β€” | β€” | β€” | 6.1 (602.0.49) | 3.6 6.3.1 | β€” | β€” | β€” | β€” | 6.1 (602.0.49) | 3.6 6.3.2 | β€” | β€” | β€” | β€” | 6.1 (602.0.53) | 3.6 + 6.4 | β€” | β€” | β€” | β€” | 6.1 (602.0.53) | 3.6 ## References to Xcode and compiler versions in code When a new Xcode release is made, the following things need to be
false
Other
Homebrew
brew
754c950e3eaa1f89c1030ec93d73b8e5a16fdb7d.json
xcode: add 6.4 expectation
Library/Homebrew/os/mac/xcode.rb
@@ -14,7 +14,7 @@ def latest_version when "10.7" then "4.6.3" when "10.8" then "5.1.1" when "10.9" then "6.2" - when "10.10" then "6.3.2" + when "10.10" then "6.4" when "10.11" then "7.0" else # Default to newest known version of Xcode for unreleased OSX versions.
false
Other
Homebrew
brew
0d12e4e601c90a9e100aa6fd9d2ea9f8e1fdc2ab.json
mac: add xcode 6.4 expectation
Library/Homebrew/os/mac.rb
@@ -210,6 +210,7 @@ def preferred_arch "6.3" => { :clang => "6.1", :clang_build => 602 }, "6.3.1" => { :clang => "6.1", :clang_build => 602 }, "6.3.2" => { :clang => "6.1", :clang_build => 602 }, + "6.4" => { :clang => "6.1", :clang_build => 602 }, "7.0" => { :clang => "7.0", :clang_build => 700 }, }
false
Other
Homebrew
brew
c0c68b2b3fc258f7d1cbc7284fda1c99d51f6052.json
audit: handle some GitHub repo audit edge cases.
Library/Homebrew/cmd/audit.rb
@@ -430,7 +430,14 @@ def audit_github_repository _, user, repo = *regex.match(formula.homepage) unless user return if !user || !repo - metadata = GitHub.repository(user, repo) + repo.gsub!(/.git$/, "") + + begin + metadata = GitHub.repository(user, repo) + rescue GitHub::HTTPNotFoundError => e + return + end + problem "GitHub fork (not canonical repository)" if metadata["fork"] if (metadata["forks_count"] < 5) || (metadata["watchers_count"] < 5) || (metadata["stargazers_count"] < 10)
false
Other
Homebrew
brew
10495fb1fa29a4229d9f1edbc3ab5a90f84c3fd0.json
add Formula#pkgshare path Formalizes the (share/"foo").install idiom. Closes Homebrew/homebrew#41333.
Library/Homebrew/formula.rb
@@ -387,6 +387,12 @@ def sbin; prefix+'sbin' end # `brew link` for formulae that are not keg-only. def share; prefix+'share' end + # The directory where the formula's shared files should be installed, + # with the name of the formula appended to avoid linking conflicts. + # This is symlinked into `HOMEBREW_PREFIX` after installation or with + # `brew link` for formulae that are not keg-only. + def pkgshare; prefix+'share'+name end + # The directory where the formula's Frameworks should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with # `brew link` for formulae that are not keg-only.
false
Other
Homebrew
brew
b78cbb731421847cb4d172934f8a56a9749d69e6.json
fix error message in test_updater Closes Homebrew/homebrew#41372. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/test_updater.rb
@@ -1,5 +1,6 @@ require 'testing_env' require 'cmd/update' +require "formula_versions" require 'yaml' class UpdaterTests < Homebrew::TestCase @@ -56,6 +57,8 @@ def teardown end def perform_update(fixture_name="") + Formulary.stubs(:factory).returns(stub(:pkg_version => "1.0")) + FormulaVersions.stubs(:new).returns(stub(:formula_at_revision => "2.0")) @updater.diff = fixture(fixture_name) @updater.in_repo_expect("git checkout -q master") @updater.in_repo_expect("git rev-parse -q --verify HEAD", "1234abcd")
false
Other
Homebrew
brew
690bf9b8b98594cd5a73e55f1c6c52ebf5624f93.json
Remove myself from the maintainers list It's been fun.
Library/Homebrew/manpages/brew.1.md
@@ -667,7 +667,7 @@ Homebrew Documentation: <https://github.com/Homebrew/homebrew/blob/master/share/ ## AUTHORS -Homebrew's current maintainers are Misty De Meo, Adam Vandenberg, Jack Nagel, Mike McQuaid, Brett Koonce and Tim Smith. +Homebrew's current maintainers are Misty De Meo, Adam Vandenberg, Mike McQuaid, Brett Koonce and Tim Smith. Homebrew was originally created by Max Howell.
true
Other
Homebrew
brew
690bf9b8b98594cd5a73e55f1c6c52ebf5624f93.json
Remove myself from the maintainers list It's been fun.
README.md
@@ -25,7 +25,7 @@ This is our PGP key which is valid until June 17, 2016. * Full key: https://keybase.io/homebrew/key.asc ## Who Are You? -Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Adam Vandenberg](https://github.com/adamv), [Jack Nagel](https://github.com/jacknagel), [Xu Cheng](https://github.com/xu-cheng), [Mike McQuaid](https://github.com/mikemcquaid), [Baptiste Fontaine](https://github.com/bfontaine), [Brett Koonce](https://github.com/asparagui), [Dominyk Tiller](https://github.com/DomT4) and [Tim Smith](https://github.com/tdsmith). +Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Adam Vandenberg](https://github.com/adamv), [Xu Cheng](https://github.com/xu-cheng), [Mike McQuaid](https://github.com/mikemcquaid), [Baptiste Fontaine](https://github.com/bfontaine), [Brett Koonce](https://github.com/asparagui), [Dominyk Tiller](https://github.com/DomT4) and [Tim Smith](https://github.com/tdsmith). Homebrew was originally created by [Max Howell](https://github.com/mxcl).
true
Other
Homebrew
brew
690bf9b8b98594cd5a73e55f1c6c52ebf5624f93.json
Remove myself from the maintainers list It's been fun.
share/man/man1/brew.1
@@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "June 2015" "Homebrew" "brew" +.TH "BREW" "1" "July 2015" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for OS X @@ -646,7 +646,7 @@ Homebrew Documentation: \fIhttps://github\.com/Homebrew/homebrew/blob/master/sha \fBgit\fR(1), \fBgit\-log\fR(1) . .SH "AUTHORS" -Homebrew\'s current maintainers are Misty De Meo, Adam Vandenberg, Jack Nagel, Mike McQuaid, Brett Koonce and Tim Smith\. +Homebrew\'s current maintainers are Misty De Meo, Adam Vandenberg, Mike McQuaid, Brett Koonce and Tim Smith\. . .P Homebrew was originally created by Max Howell\.
true
Other
Homebrew
brew
689d741e168cec8fde4adcc844f4152815be0d99.json
download_strategy: remove exclamation point Closes Homebrew/homebrew#41171. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/download_strategy.rb
@@ -129,7 +129,7 @@ def fetch unless current_revision == @revision raise <<-EOS.undent #{@ref} tag should be #{@revision} - but is actually #{current_revision}! + but is actually #{current_revision} EOS end end
false