diff options
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/bottle.rb | 18 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/test-bot.rb | 34 |
2 files changed, 37 insertions, 15 deletions
diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 4b25b3842..1a7da8eb9 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -1,4 +1,4 @@ -#: * `bottle` [`--verbose`] [`--no-rebuild`] [`--keep-old`] [`--skip-relocation`] [`--root-url=<root_url>`]: +#: * `bottle` [`--verbose`] [`--no-rebuild`] [`--keep-old`] [`--skip-relocation`] [`--root-url=<root_url>`] [`--force-core-tap`]: #: * `bottle` `--merge` [`--no-commit`] [`--keep-old`] [`--write`]: #: #: Generate a bottle (binary package) from a formula installed with @@ -134,8 +134,14 @@ module Homebrew return ofail "Formula not installed or up-to-date: #{f.full_name}" end - unless f.tap - return ofail "Formula not from core or any taps: #{f.full_name}" + tap = f.tap + + unless tap + if ARGV.include?("--force-core-tap") + tap = CoreTap.instance + else + return ofail "Formula not from core or any taps: #{f.full_name}" + end end if f.bottle_disabled? @@ -152,7 +158,7 @@ module Homebrew return ofail "Formula has no stable version: #{f.full_name}" end - if ARGV.include? "--no-rebuild" + if ARGV.include?("--no-rebuild") || !f.tap rebuild = 0 elsif ARGV.include? "--keep-old" rebuild = f.bottle_specification.rebuild @@ -270,7 +276,7 @@ module Homebrew root_url ||= ARGV.value("root_url") bottle = BottleSpecification.new - bottle.tap = f.tap + bottle.tap = tap bottle.root_url(root_url) if root_url if relocatable if skip_relocation @@ -334,7 +340,7 @@ module Homebrew }, "bintray" => { "package" => Utils::Bottles::Bintray.package(f.name), - "repository" => Utils::Bottles::Bintray.repository(f.tap), + "repository" => Utils::Bottles::Bintray.repository(tap), }, }, } diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb index 2d8500d9b..2704aa670 100644 --- a/Library/Homebrew/dev-cmd/test-bot.rb +++ b/Library/Homebrew/dev-cmd/test-bot.rb @@ -62,6 +62,9 @@ #: If `--coverage` is passed, generate coverage report and send it to #: Coveralls. #: +#: If `--test-default-formula` is passed, use a default testing formula if +#: no formulae are otherwise found. +#: #: If `--ci-master` is passed, use the Homebrew master branch CI #: options. #: @@ -268,11 +271,14 @@ module Homebrew @tap = options[:tap] @repository = @tap ? @tap.path : HOMEBREW_REPOSITORY @skip_homebrew = options.fetch(:skip_homebrew, false) + @test_default_formula = options.fetch(:test_default_formula, false) if quiet_system "git", "-C", @repository.to_s, "rev-parse", "--verify", "-q", argument @hash = argument elsif url_match = argument.match(HOMEBREW_PULL_OR_COMMIT_URL_REGEX) @url = url_match[0] + elsif @test_default_formula + @formulae = [argument] elsif canonical_formula_name = safe_formula_canonical_name(argument) @formulae = [canonical_formula_name] else @@ -627,6 +633,7 @@ module Homebrew bottle_args = ["--verbose", "--json", formula_name] bottle_args << "--keep-old" if ARGV.include? "--keep-old" bottle_args << "--skip-relocation" if ARGV.include? "--skip-relocation" + bottle_args << "--force-core-tap" if @test_default_formula test "brew", "bottle", *bottle_args bottle_step = steps.last if bottle_step.passed? && bottle_step.output? @@ -695,7 +702,7 @@ module Homebrew @category = __method__ return if @skip_homebrew - if @tap.nil? && Array(@formulae).empty? + if @tap.nil? && (@test_default_formula || Array(@formulae).empty?) tests_args = ["--official-cmd-taps"] tests_args_no_compat = [] tests_args_no_compat << "--coverage" if ARGV.include?("--coverage") @@ -1006,8 +1013,9 @@ module Homebrew if ARGV.include?("--ci-master") || ARGV.include?("--ci-pr") \ || ARGV.include?("--ci-testing") ARGV << "--cleanup" if ENV["JENKINS_HOME"] - ARGV << "--junit" << "--local" + ARGV << "--junit" << "--local" << "--test-default-formula" end + if ARGV.include? "--ci-master" ARGV << "--fast" end @@ -1039,22 +1047,30 @@ module Homebrew any_errors = false skip_homebrew = ARGV.include?("--skip-homebrew") if ARGV.named.empty? - # With no arguments just build the most recent commit. - head_test = Test.new("HEAD", :tap => tap, :skip_homebrew => skip_homebrew) - any_errors = !head_test.run - tests << head_test + current_test = if ARGV.include?("--test-default-formula") + # Build the default test formula. + HOMEBREW_CACHE_FORMULA.mkpath + FileUtils.cp "#{HOMEBREW_LIBRARY}/Homebrew/test/testbottest.rb", HOMEBREW_CACHE_FORMULA + Test.new("#{HOMEBREW_LIBRARY}/Homebrew/test/testbottest.rb", + :test_default_formula => true, :skip_homebrew => skip_homebrew) + else + # Otherwise just build the most recent commit. + Test.new("HEAD", :tap => tap, :skip_homebrew => skip_homebrew) + end + any_errors = !current_test.run + tests << current_test else ARGV.named.each do |argument| test_error = false begin - test = Test.new(argument, :tap => tap, :skip_homebrew => skip_homebrew) + current_test = Test.new(argument, :tap => tap, :skip_homebrew => skip_homebrew) skip_homebrew = true rescue ArgumentError => e test_error = true ofail e.message else - test_error = !test.run - tests << test + test_error = !current_test.run + tests << current_test end any_errors ||= test_error end |
