From 14236c3950ffb621bc6e3795e8d8526241589b88 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 4 Sep 2016 11:26:38 +0100 Subject: [PATCH] test-bot: cleanup all repositories. The test bot currently only focuses on doing cleanup on the current tap and the HOMEBREW_REPOSITORY. This should be extended to cover all repositories as e.g. a syntax error in homebrew/core can break the CI for all the other taps. --- Library/Homebrew/dev-cmd/test-bot.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb index d481f2a2d9..099823a5f2 100644 --- a/Library/Homebrew/dev-cmd/test-bot.rb +++ b/Library/Homebrew/dev-cmd/test-bot.rb @@ -688,13 +688,16 @@ module Homebrew git "reset", "--hard", "origin/master" end git "clean", "-ffdx" - unless @repository == HOMEBREW_REPOSITORY - HOMEBREW_REPOSITORY.cd do + + Pathname.glob("{#{HOMEBREW_REPOSITORY},#{HOMEBREW_LIBRARY}/Taps/*/*}").each do |git_repo| + next if @repository == git_repo + git_repo.cd do safe_system "git", "checkout", "-f", "master" safe_system "git", "reset", "--hard", "origin/master" safe_system "git", "clean", "-ffdx", "--exclude=/Library/Taps/" end end + pr_locks = "#{@repository}/.git/refs/remotes/*/pr/*/*.lock" Dir.glob(pr_locks) { |lock| FileUtils.rm_rf lock } end @@ -715,13 +718,17 @@ module Homebrew test "brew", "cleanup", "--prune=7" git "gc", "--auto" test "git", "clean", "-ffdx" - unless @repository == HOMEBREW_REPOSITORY - HOMEBREW_REPOSITORY.cd do - safe_system "git", "reset", "--hard" + + Tap.names.each { |s| safe_system "brew", "untap", s if s != "homebrew/core" } + + Pathname.glob("{#{HOMEBREW_REPOSITORY},#{HOMEBREW_LIBRARY}/Taps/*/*}").each do |git_repo| + next if @repository == git_repo + git_repo.cd do + safe_system "git", "checkout", "-f", "master" + safe_system "git", "reset", "--hard", "origin/master" safe_system "git", "clean", "-ffdx", "--exclude=/Library/Taps/" end end - Tap.names.each { |s| safe_system "brew", "untap", s if s != "homebrew/core" } if ARGV.include? "--local" FileUtils.rm_rf ENV["HOMEBREW_HOME"]