Merge pull request #3879 from sjackman/unzip_dep_if_needed

unzip_dep_if_needed: Needs unzip not zip [Linux] (#632)
This commit is contained in:
Mike McQuaid 2018-03-06 08:34:48 +00:00 committed by GitHub
commit dedda60bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -70,8 +70,8 @@ class DependencyCollector
Dependency.new("xz", tags) unless which("xz") Dependency.new("xz", tags) unless which("xz")
end end
def zip_dep_if_needed(tags) def unzip_dep_if_needed(tags)
Dependency.new("zip", tags) unless which("zip") Dependency.new("unzip", tags) unless which("unzip")
end end
def bzip2_dep_if_needed(tags) def bzip2_dep_if_needed(tags)
@ -166,7 +166,7 @@ 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 ".zip" then unzip_dep_if_needed(tags)
when ".bz2" then bzip2_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)

View File

@ -10,7 +10,7 @@ describe DependencyCollector do
describe "#add" do describe "#add" do
resource = Resource.new resource = Resource.new
context "when xz, zip, and bzip2 are not available" do context "when xz, unzip, and bzip2 are not available" do
it "creates a resource dependency from a '.xz' URL" do it "creates a resource dependency from a '.xz' URL" do
resource.url("http://example.com/foo.xz") resource.url("http://example.com/foo.xz")
allow_any_instance_of(Object).to receive(:which).with("xz") allow_any_instance_of(Object).to receive(:which).with("xz")
@ -19,8 +19,8 @@ describe DependencyCollector do
it "creates a resource dependency from a '.zip' URL" do it "creates a resource dependency from a '.zip' URL" do
resource.url("http://example.com/foo.zip") resource.url("http://example.com/foo.zip")
allow_any_instance_of(Object).to receive(:which).with("zip") allow_any_instance_of(Object).to receive(:which).with("unzip")
expect(subject.add(resource)).to eq(Dependency.new("zip", [:build])) expect(subject.add(resource)).to eq(Dependency.new("unzip", [:build]))
end end
it "creates a resource dependency from a '.bz2' URL" do it "creates a resource dependency from a '.bz2' URL" do
@ -39,7 +39,7 @@ describe DependencyCollector do
it "does not create a resource dependency from a '.zip' URL" do it "does not create a resource dependency from a '.zip' URL" do
resource.url("http://example.com/foo.zip") resource.url("http://example.com/foo.zip")
allow_any_instance_of(Object).to receive(:which).with("zip").and_return(Pathname.new("foo")) allow_any_instance_of(Object).to receive(:which).with("unzip").and_return(Pathname.new("foo"))
expect(subject.add(resource)).to be nil expect(subject.add(resource)).to be nil
end end