Merge pull request #3813 from maxim-belkin/brew-unix-2
bzip2 and zip dependencies_if_needed
This commit is contained in:
commit
1811c77ec6
@ -63,11 +63,19 @@ class DependencyCollector
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cvs_dep_if_needed(tags)
|
def cvs_dep_if_needed(tags)
|
||||||
Dependency.new("cvs", tags)
|
Dependency.new("cvs", tags) unless which("cvs")
|
||||||
end
|
end
|
||||||
|
|
||||||
def xz_dep_if_needed(tags)
|
def xz_dep_if_needed(tags)
|
||||||
Dependency.new("xz", tags)
|
Dependency.new("xz", tags) unless which("xz")
|
||||||
|
end
|
||||||
|
|
||||||
|
def zip_dep_if_needed(tags)
|
||||||
|
Dependency.new("zip", tags) unless which("zip")
|
||||||
|
end
|
||||||
|
|
||||||
|
def bzip2_dep_if_needed(tags)
|
||||||
|
Dependency.new("bzip2", tags) unless which("bzip2")
|
||||||
end
|
end
|
||||||
|
|
||||||
def ld64_dep_if_needed(*); end
|
def ld64_dep_if_needed(*); end
|
||||||
@ -158,6 +166,8 @@ class DependencyCollector
|
|||||||
def parse_url_spec(url, tags)
|
def parse_url_spec(url, tags)
|
||||||
case File.extname(url)
|
case File.extname(url)
|
||||||
when ".xz" then xz_dep_if_needed(tags)
|
when ".xz" then xz_dep_if_needed(tags)
|
||||||
|
when ".zip" then zip_dep_if_needed(tags)
|
||||||
|
when ".bz2" then bzip2_dep_if_needed(tags)
|
||||||
when ".lha", ".lzh" then Dependency.new("lha", tags)
|
when ".lha", ".lzh" then Dependency.new("lha", tags)
|
||||||
when ".lz" then Dependency.new("lzip", tags)
|
when ".lz" then Dependency.new("lzip", tags)
|
||||||
when ".rar" then Dependency.new("unrar", tags)
|
when ".rar" then Dependency.new("unrar", tags)
|
||||||
|
@ -18,6 +18,10 @@ class DependencyCollector
|
|||||||
Dependency.new("xz", tags)
|
Dependency.new("xz", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def zip_dep_if_needed(tags); end
|
||||||
|
|
||||||
|
def bzip2_dep_if_needed(tags); end
|
||||||
|
|
||||||
def ld64_dep_if_needed(*)
|
def ld64_dep_if_needed(*)
|
||||||
# Tiger's ld is too old to properly link some software
|
# Tiger's ld is too old to properly link some software
|
||||||
return if MacOS.version > :tiger
|
return if MacOS.version > :tiger
|
||||||
|
53
Library/Homebrew/test/os/linux/dependency_collector_spec.rb
Normal file
53
Library/Homebrew/test/os/linux/dependency_collector_spec.rb
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
require "dependency_collector"
|
||||||
|
|
||||||
|
describe DependencyCollector do
|
||||||
|
alias_matcher :be_a_build_requirement, :be_build
|
||||||
|
|
||||||
|
after(:each) do
|
||||||
|
described_class.clear_cache
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#add" do
|
||||||
|
resource = Resource.new
|
||||||
|
|
||||||
|
context "when xz, zip, and bzip2 are not available" do
|
||||||
|
it "creates a resource dependency from a '.xz' URL" do
|
||||||
|
resource.url("http://example.com/foo.xz")
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("xz")
|
||||||
|
expect(subject.add(resource)).to eq(Dependency.new("xz", [:build]))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "creates a resource dependency from a '.zip' URL" do
|
||||||
|
resource.url("http://example.com/foo.zip")
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("zip")
|
||||||
|
expect(subject.add(resource)).to eq(Dependency.new("zip", [:build]))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "creates a resource dependency from a '.bz2' URL" do
|
||||||
|
resource.url("http://example.com/foo.tar.bz2")
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("bzip2")
|
||||||
|
expect(subject.add(resource)).to eq(Dependency.new("bzip2", [:build]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when xz, zip, and bzip2 are available" do
|
||||||
|
it "does not create a resource dependency from a '.xz' URL" do
|
||||||
|
resource.url("http://example.com/foo.xz")
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("xz").and_return(Pathname.new("foo"))
|
||||||
|
expect(subject.add(resource)).to be nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not create a resource dependency from a '.zip' URL" do
|
||||||
|
resource.url("http://example.com/foo.zip")
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("zip").and_return(Pathname.new("foo"))
|
||||||
|
expect(subject.add(resource)).to be nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not create a resource dependency from a '.bz2' URL" do
|
||||||
|
resource.url("http://example.com/foo.tar.bz2")
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("bzip2").and_return(Pathname.new("foo"))
|
||||||
|
expect(subject.add(resource)).to be nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -36,6 +36,18 @@ describe DependencyCollector do
|
|||||||
expect(subject.add(resource)).to be nil
|
expect(subject.add(resource)).to be nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
specify "Resource dependency from a '.zip' URL" do
|
||||||
|
resource = Resource.new
|
||||||
|
resource.url("http://example.com/foo.zip")
|
||||||
|
expect(subject.add(resource)).to be nil
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "Resource dependency from a '.bz2' URL" do
|
||||||
|
resource = Resource.new
|
||||||
|
resource.url("http://example.com/foo.tar.bz2")
|
||||||
|
expect(subject.add(resource)).to be nil
|
||||||
|
end
|
||||||
|
|
||||||
specify "Resource dependency from a '.git' URL" do
|
specify "Resource dependency from a '.git' URL" do
|
||||||
resource = Resource.new
|
resource = Resource.new
|
||||||
resource.url("git://example.com/foo/bar.git")
|
resource.url("git://example.com/foo/bar.git")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user