brew-test-bot: further tweak cleanup handling.

This commit is contained in:
Mike McQuaid 2014-02-23 10:34:22 +00:00
parent 85feea33c0
commit 690060578c

View File

@ -5,6 +5,7 @@
# Options: # Options:
# --keep-logs: Write and keep log files under ./brewbot/ # --keep-logs: Write and keep log files under ./brewbot/
# --cleanup: Clean the Homebrew directory. Very dangerous. Use with care. # --cleanup: Clean the Homebrew directory. Very dangerous. Use with care.
# --clean-cache: Remove all cached downloads. Use with care.
# --skip-setup: Don't check the local system is setup correctly. # --skip-setup: Don't check the local system is setup correctly.
# --junit: Generate a JUnit XML test results file. # --junit: Generate a JUnit XML test results file.
# --email: Generate an email subject file. # --email: Generate an email subject file.
@ -329,7 +330,7 @@ class Test
git 'am --abort 2>/dev/null' git 'am --abort 2>/dev/null'
git 'rebase --abort 2>/dev/null' git 'rebase --abort 2>/dev/null'
git 'reset --hard' git 'reset --hard'
git 'checkout -f master' git 'checkout -f master 2>/dev/null'
git 'clean --force -dx' git 'clean --force -dx'
end end
@ -348,6 +349,7 @@ class Test
if ARGV.include? '--cleanup' if ARGV.include? '--cleanup'
test 'git reset --hard' test 'git reset --hard'
git 'stash pop 2>/dev/null' git 'stash pop 2>/dev/null'
test 'brew cleanup'
end end
FileUtils.rm_rf @brewbot_root unless ARGV.include? "--keep-logs" FileUtils.rm_rf @brewbot_root unless ARGV.include? "--keep-logs"
@ -525,9 +527,7 @@ if ARGV.include? "--email"
end end
end end
if ARGV.include? "--cleanup"
safe_system "brew cleanup -s" safe_system "rm -rf #{HOMEBREW_CACHE}/*" if ARGV.include? "--clean-cache"
safe_system "rm -vrf #{HOMEBREW_CACHE}/*"
end
exit any_errors ? 0 : 1 exit any_errors ? 0 : 1