aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-09-13 09:20:06 +0100
committerGitHub2016-09-13 09:20:06 +0100
commite10234f61a990d9bf5dab26e64f3a27310dea67b (patch)
treea708089d745119c1e664acb7d1e02c1e6fd530ff /Library
parent5a264cf59733fa8e0f69f8e6567e069a8cfd8bde (diff)
parent0316830d4fbd9467a0c0f82867ffcc91b9385cb2 (diff)
downloadbrew-e10234f61a990d9bf5dab26e64f3a27310dea67b.tar.bz2
Merge pull request #949 from MikeMcQuaid/testbottest
test-bot: default to building testbottest.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/dev-cmd/bottle.rb18
-rw-r--r--Library/Homebrew/dev-cmd/test-bot.rb34
-rw-r--r--Library/Homebrew/test/tarballs/testbottest-0.1.tbzbin0 -> 548 bytes
-rw-r--r--Library/Homebrew/test/testbottest.rb14
4 files changed, 51 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
diff --git a/Library/Homebrew/test/tarballs/testbottest-0.1.tbz b/Library/Homebrew/test/tarballs/testbottest-0.1.tbz
new file mode 100644
index 000000000..83f7ab1dd
--- /dev/null
+++ b/Library/Homebrew/test/tarballs/testbottest-0.1.tbz
Binary files differ
diff --git a/Library/Homebrew/test/testbottest.rb b/Library/Homebrew/test/testbottest.rb
new file mode 100644
index 000000000..f7695cab5
--- /dev/null
+++ b/Library/Homebrew/test/testbottest.rb
@@ -0,0 +1,14 @@
+class Testbottest < Formula
+ desc "Minimal C program and Makefile used for testing Homebrew."
+ homepage "https://github.com/Homebrew/brew"
+ url "file://#{File.expand_path("..", __FILE__)}/tarballs/testbottest-0.1.tbz"
+ sha256 "78b54d8f31585c9773bed12b4aa4ab2ce458ebd044b9406cb24d40aa5107f082"
+
+ def install
+ system "make", "install", "PREFIX=#{prefix}"
+ end
+
+ test do
+ assert_equal "testbottest\n", shell_output("#{bin}/testbottest")
+ end
+end