Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formula: deprecate devel blocks. #7688

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,7 @@ def devel(&block)
@devel ||= SoftwareSpec.new
return @devel unless block_given?

odeprecated "'devel' blocks in formulae", "'head' blocks or @-versioned formulae"
@devel.instance_eval(&block)
end

Expand Down
52 changes: 0 additions & 52 deletions Library/Homebrew/test/formula_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,11 @@
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
Expand All @@ -326,11 +319,6 @@
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)
Expand All @@ -347,22 +335,6 @@
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)
Expand Down Expand Up @@ -519,19 +491,12 @@
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

Expand All @@ -540,22 +505,12 @@
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

Expand All @@ -565,7 +520,6 @@
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

Expand All @@ -574,7 +528,6 @@
url "foo-1.0"
end

expect(f.devel).to be nil
expect(f.head).to be nil
end

Expand All @@ -583,14 +536,9 @@
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

Expand Down
43 changes: 2 additions & 41 deletions Library/Homebrew/test/formula_spec_selection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
it "selects stable by default" do
f = formula do
url "foo-1.0"
devel { url "foo-1.1a" }
head "foo"
end

Expand All @@ -19,20 +18,6 @@
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
Expand All @@ -51,49 +36,25 @@
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
Expand Down
11 changes: 0 additions & 11 deletions Library/Homebrew/test/formula_validation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,6 @@ def brew; end
}.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"
Expand Down