diff options
| author | Xu Cheng | 2015-09-18 20:33:50 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-09-18 21:54:02 +0800 |
| commit | 4114a75039395e51fdfaa074a98a52fe0c623f37 (patch) | |
| tree | 18627efab90a43370c1529ad7f970b0c64d85bf6 /Library/Homebrew/cmd | |
| parent | 82289936247b97855878fb4ce2841b35d13d466f (diff) | |
| download | brew-4114a75039395e51fdfaa074a98a52fe0c623f37.tar.bz2 | |
test-bot: add sanitize_ARGV_and_ENV
Closes Homebrew/homebrew#44102.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/test-bot.rb | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index b426b3662..d98b4bbdc 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -735,9 +735,7 @@ module Homebrew exec "brew", "update" end - def test_ci_upload - tap = resolve_test_tap - + def test_ci_upload(tap) jenkins = ENV["JENKINS_HOME"] job = ENV["UPSTREAM_JOB_NAME"] id = ENV["UPSTREAM_BUILD_ID"] @@ -836,26 +834,11 @@ module Homebrew safe_system "git", "push", "--force", remote, "refs/tags/#{tag}" end - def test_bot - tap = resolve_test_tap - # Tap repository if required, this is done before everything else - # because Formula parsing and/or git commit hash lookup depends on it. - if tap && !tap.installed? - safe_system "brew", "tap", tap.name - end - + def sanitize_ARGV_and_ENV if Pathname.pwd == HOMEBREW_PREFIX && ARGV.include?("--cleanup") odie "cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output." end - if ARGV.include? "--email" - File.open EMAIL_SUBJECT_FILE, "w" do |file| - # The file should be written at the end but in case we don't get to that - # point ensure that we have something valid. - file.write "#{MacOS.version}: internal error." - end - end - ENV["HOMEBREW_DEVELOPER"] = "1" ENV["HOMEBREW_SANDBOX"] = "1" ENV["HOMEBREW_NO_EMOJI"] = "1" @@ -876,10 +859,29 @@ module Homebrew ENV["HOMEBREW_LOGS"] = "#{Dir.pwd}/logs" end + if ARGV.include? "--email" + File.open EMAIL_SUBJECT_FILE, "w" do |file| + # The file should be written at the end but in case we don't get to that + # point ensure that we have something valid. + file.write "#{MacOS.version}: internal error." + end + end + end + + def test_bot + sanitize_ARGV_and_ENV + + tap = resolve_test_tap + # Tap repository if required, this is done before everything else + # because Formula parsing and/or git commit hash lookup depends on it. + if tap && !tap.installed? + safe_system "brew", "tap", tap.name + end + if ARGV.include? "--ci-reset-and-update" return test_bot_ci_reset_and_update elsif ARGV.include? "--ci-upload" - return test_ci_upload + return test_ci_upload(tap) end tests = [] |
