Merge pull request #7688 from MikeMcQuaid/deprecate-devel

formula: deprecate devel blocks.
This commit is contained in:
Mike McQuaid 2020-06-05 09:43:35 +01:00 committed by GitHub
commit 6409fe78b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 104 deletions

View File

@ -2387,6 +2387,7 @@ class Formula
@devel ||= SoftwareSpec.new
return @devel unless block_given?
odeprecated "'devel' blocks in formulae", "'head' blocks or @-versioned formulae"
@devel.instance_eval(&block)
end

View File

@ -303,18 +303,11 @@ describe Formula do
formula do
url "foo"
version "1.9"
head "foo"
devel do
url "foo"
version "2.1-devel"
end
end
end
let(:stable_prefix) { HOMEBREW_CELLAR/f.name/f.version }
let(:devel_prefix) { HOMEBREW_CELLAR/f.name/f.devel.version }
let(:head_prefix) { HOMEBREW_CELLAR/f.name/f.head.version }
it "is the same as #prefix by default" do
@ -326,11 +319,6 @@ describe Formula do
expect(f.installed_prefix).to eq(stable_prefix)
end
it "returns the devel prefix if it is installed" do
devel_prefix.mkpath
expect(f.installed_prefix).to eq(devel_prefix)
end
it "returns the head prefix if it is installed" do
head_prefix.mkpath
expect(f.installed_prefix).to eq(head_prefix)
@ -347,22 +335,6 @@ describe Formula do
expect(f.installed_prefix).to eq(stable_prefix)
end
it "returns the stable prefix if head and devel are outdated" do
head_prefix.mkpath
tab = Tab.empty
tab.tabfile = head_prefix/Tab::FILENAME
tab.source["versions"] = { "stable" => "1.9", "devel" => "2.0" }
tab.write
expect(f.installed_prefix).to eq(stable_prefix)
end
it "returns the devel prefix if the active specification is :devel" do
f.active_spec = :devel
expect(f.installed_prefix).to eq(devel_prefix)
end
it "returns the head prefix if the active specification is :head" do
f.active_spec = :head
expect(f.installed_prefix).to eq(head_prefix)
@ -519,19 +491,12 @@ describe Formula do
sha256 TEST_SHA256
head "https://brew.sh/test.git", tag: "foo"
devel do
url "https://brew.sh/test-0.2.tbz"
mirror "https://example.org/test-0.2.tbz"
sha256 TEST_SHA256
end
end
expect(f.homepage).to eq("https://brew.sh")
expect(f.version).to eq(Version.create("0.1"))
expect(f).to be_stable
expect(f.stable.version).to eq(Version.create("0.1"))
expect(f.devel.version).to eq(Version.create("0.2"))
expect(f.head.version).to eq(Version.create("HEAD"))
end
@ -540,22 +505,12 @@ describe Formula do
url "foo"
version "1.0"
revision 1
devel do
url "foo"
version "1.0beta"
end
end
expect(f.active_spec_sym).to eq(:stable)
expect(f.send(:active_spec)).to eq(f.stable)
expect(f.pkg_version.to_s).to eq("1.0_1")
f.active_spec = :devel
expect(f.active_spec_sym).to eq(:devel)
expect(f.send(:active_spec)).to eq(f.devel)
expect(f.pkg_version.to_s).to eq("1.0beta_1")
expect { f.active_spec = :head }.to raise_error(FormulaSpecificationError)
end
@ -565,7 +520,6 @@ describe Formula do
end
expect(f.class.stable).to be_kind_of(SoftwareSpec)
expect(f.class.devel).to be_kind_of(SoftwareSpec)
expect(f.class.head).to be_kind_of(SoftwareSpec)
end
@ -574,7 +528,6 @@ describe Formula do
url "foo-1.0"
end
expect(f.devel).to be nil
expect(f.head).to be nil
end
@ -583,14 +536,9 @@ describe Formula do
url "foo-1.0"
depends_on "foo"
devel do
url "foo-1.1"
end
end
expect(f.class.stable.deps.first.name).to eq("foo")
expect(f.class.devel.deps.first.name).to eq("foo")
expect(f.class.head.deps.first.name).to eq("foo")
end

View File

@ -7,7 +7,6 @@ describe Formula do
it "selects stable by default" do
f = formula do
url "foo-1.0"
devel { url "foo-1.1a" }
head "foo"
end
@ -19,20 +18,6 @@ describe Formula do
expect(f).to be_stable
end
it "selects devel before HEAD" do
f = formula do
devel { url "foo-1.1a" }
head "foo"
end
expect(f).to be_devel
end
it "selects devel when exclusive" do
f = formula { devel { url "foo-1.1a" } }
expect(f).to be_devel
end
it "selects HEAD when exclusive" do
f = formula { head "foo" }
expect(f).to be_head
@ -51,49 +36,25 @@ describe Formula do
it "does not set an incomplete stable spec" do
f = formula do
sha256 TEST_SHA256
devel { url "foo-1.1a" }
head "foo"
end
expect(f.stable).to be nil
expect(f).to be_devel
expect(f).to be_head
end
it "selects HEAD when requested" do
f = formula("test", spec: :head) do
url "foo-1.0"
devel { url "foo-1.1a" }
head "foo"
end
expect(f).to be_head
end
it "selects devel when requested" do
f = formula("test", spec: :devel) do
url "foo-1.0"
devel { url "foo-1.1a" }
head "foo"
end
expect(f).to be_devel
end
it "does not set an incomplete devel spec" do
f = formula do
url "foo-1.0"
devel { version "1.1a" }
head "foo"
end
expect(f.devel).to be nil
expect(f).to be_stable
end
it "does not raise an error for a missing spec" do
f = formula("test", spec: :devel) do
f = formula("test", spec: :head) do
url "foo-1.0"
head "foo"
end
expect(f).to be_stable

View File

@ -70,17 +70,6 @@ describe Formula do
}.to fail_with_invalid :version
end
specify "devel-only is valid" do
f = formula do
devel do
url "foo"
version "1.0"
end
end
expect(f).to be_devel
end
specify "head-only is valid" do
f = formula do
head "foo"