diff options
| author | Xu Cheng | 2016-03-06 15:11:34 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-04-02 21:51:36 +0800 |
| commit | 5bb8e8985d8b26531767be500a59f9761aac1c38 (patch) | |
| tree | f327007840b3bb8d031174843d167fec99d4fd89 /Library/Homebrew/cmd | |
| parent | e9886cac6cd7cffbd39f812d02e9f4c5f308e470 (diff) | |
| download | brew-5bb8e8985d8b26531767be500a59f9761aac1c38.tar.bz2 | |
audit/test-bot/pull: fix for core/formula separation
All formulae are in taps now.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/pull.rb | 49 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/test-bot.rb | 6 |
3 files changed, 29 insertions, 30 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 76702a967..4076b8188 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -904,8 +904,8 @@ class FormulaAuditor if formula.tap.tap_migrations.key?(formula.name) problem <<-EOS.undent - #{formula.name} seems to be listed in tap_migrations.rb! - Please remove #{formula.name} from present tap & tap_migrations.rb + #{formula.name} seems to be listed in tap_migrations.json! + Please remove #{formula.name} from present tap & tap_migrations.json before submitting it to Homebrew/homebrew. EOS end diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb index 26c8cf522..a4bd1ddc0 100644 --- a/Library/Homebrew/cmd/pull.rb +++ b/Library/Homebrew/cmd/pull.rb @@ -35,24 +35,25 @@ module Homebrew do_bump = ARGV.include?("--bump") && !ARGV.include?("--clean") bintray_fetch_formulae = [] + tap = nil ARGV.named.each do |arg| if arg.to_i > 0 issue = arg - url = "https://github.com/Homebrew/homebrew/pull/#{arg}" + url = "https://github.com/Homebrew/homebrew-core/pull/#{arg}" tap = CoreTap.instance elsif (testing_match = arg.match %r{brew.sh/job/Homebrew.*Testing/(\d+)/}) _, testing_job = *testing_match - url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}" + url = "https://github.com/Homebrew/homebrew-core/compare/master...BrewTestBot:testing-#{testing_job}" tap = CoreTap.instance odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle") elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX) _, user, repo, issue = *api_match - url = "https://github.com/#{user}/homebrew#{repo}/pull/#{issue}" - tap = Tap.fetch(user, "homebrew#{repo}") + url = "https://github.com/#{user}/#{repo}/pull/#{issue}" + tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-") elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX) url, user, repo, issue = *url_match - tap = Tap.fetch(user, "homebrew#{repo}") + tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-") else odie "Not a GitHub pull request or commit: #{arg}" end @@ -61,8 +62,12 @@ module Homebrew raise "No pull request detected!" end - tap.install unless tap.installed? - Dir.chdir tap.path + if tap + tap.install unless tap.installed? + Dir.chdir tap.path + else + Dir.chdir HOMEBREW_REPOSITORY + end # The cache directory seems like a good place to put patches. HOMEBREW_CACHE.mkpath @@ -93,16 +98,18 @@ module Homebrew changed_formulae = [] - Utils.popen_read( - "git", "diff-tree", "-r", "--name-only", - "--diff-filter=AM", revision, "HEAD", "--", tap.formula_dir.to_s - ).each_line do |line| - name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}" - begin - changed_formulae << Formula[name] - # Make sure we catch syntax errors. - rescue Exception - next + if tap + Utils.popen_read( + "git", "diff-tree", "-r", "--name-only", + "--diff-filter=AM", revision, "HEAD", "--", tap.formula_dir.to_s + ).each_line do |line| + name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}" + begin + changed_formulae << Formula[name] + # Make sure we catch syntax errors. + rescue Exception + next + end end end @@ -166,11 +173,7 @@ module Homebrew url else bottle_branch = "pull-bottle-#{issue}" - if tap.core_tap? - "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}" - else - "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" - end + "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" end curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url @@ -305,7 +308,7 @@ module Homebrew files << $1 if line =~ %r{^\+\+\+ b/(.*)} end files.each do |file| - if tap.formula_file?(file) + if tap && tap.formula_file?(file) formula_name = File.basename(file, ".rb") formulae << formula_name unless formulae.include?(formula_name) else diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 38779531d..4ded71e71 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -767,11 +767,7 @@ module Homebrew safe_system "brew", "update" if pr - pull_pr = if tap.core_tap? - pr - else - "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}" - end + pull_pr = "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}" safe_system "brew", "pull", "--clean", pull_pr end |
