brew-test-bot: allow skipping bottle creation.

This commit is contained in:
Mike McQuaid 2013-09-10 22:10:58 +01:00
parent 6718ca119c
commit cf751fd013

View File

@ -8,6 +8,7 @@
# --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.
# --no-bottle: Run brew install without --build-bottle
# --HEAD: Run brew install with --HEAD # --HEAD: Run brew install with --HEAD
# --devel: Run brew install with --devel # --devel: Run brew install with --devel
@ -257,29 +258,33 @@ class Test
end end
test "brew fetch #{dependencies}" unless dependencies.empty? test "brew fetch #{dependencies}" unless dependencies.empty?
formula_fetch_options = "--build-bottle" formula_fetch_options = ""
formula_fetch_options << " --build-bottle" unless ARGV.include? '--no-bottle'
formula_fetch_options << " --force" if ARGV.include? '--cleanup' formula_fetch_options << " --force" if ARGV.include? '--cleanup'
test "brew fetch #{formula_fetch_options} #{formula}" test "brew fetch #{formula_fetch_options} #{formula}"
test "brew uninstall --force #{formula}" if formula_object.installed? test "brew uninstall --force #{formula}" if formula_object.installed?
install_args = '--verbose --build-bottle' install_args = '--verbose'
install_args << ' --build-bottle' unless ARGV.include? '--no-bottle'
install_args << ' --HEAD' if ARGV.include? '--HEAD' install_args << ' --HEAD' if ARGV.include? '--HEAD'
install_args << ' --devel' if ARGV.include? '--devel' install_args << ' --devel' if ARGV.include? '--devel'
test "brew install #{install_args} #{formula}" test "brew install #{install_args} #{formula}"
install_passed = steps.last.passed? install_passed = steps.last.passed?
test "brew audit #{formula}" test "brew audit #{formula}"
return unless install_passed return unless install_passed
test "brew bottle #{formula}", :puts_output_on_success => true unless ARGV.include? '--no-bottle'
bottle_step = steps.last test "brew bottle #{formula}", :puts_output_on_success => true
if bottle_step.passed? and bottle_step.has_output? bottle_step = steps.last
bottle_revision = bottle_new_revision(formula_object) if bottle_step.passed? and bottle_step.has_output?
bottle_filename = bottle_filename(formula_object, bottle_revision) bottle_revision = bottle_new_revision(formula_object)
bottle_base = bottle_filename.gsub(bottle_suffix(bottle_revision), '') bottle_filename = bottle_filename(formula_object, bottle_revision)
bottle_output = bottle_step.output.gsub /.*(bottle do.*end)/m, '\1' bottle_base = bottle_filename.gsub(bottle_suffix(bottle_revision), '')
File.open "#{bottle_base}.bottle.rb", 'w' do |file| bottle_output = bottle_step.output.gsub /.*(bottle do.*end)/m, '\1'
file.write bottle_output File.open "#{bottle_base}.bottle.rb", 'w' do |file|
file.write bottle_output
end
test "brew uninstall --force #{formula}"
test "brew install #{bottle_filename}"
end end
test "brew uninstall --force #{formula}"
test "brew install #{bottle_filename}"
end end
test "brew test #{formula}" if formula_object.test_defined? test "brew test #{formula}" if formula_object.test_defined?
test "brew uninstall --force #{formula}" test "brew uninstall --force #{formula}"