-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
bzip2 and zip dependencies_if_needed #3813
Changes from 12 commits
444b292
5a92976
a53171d
5cfcd2a
1b74f21
3dabebb
b084a25
73a3592
d25fc5c
306c190
c6dac68
14d7a7a
c83dd0d
f887400
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,14 @@ def xz_dep_if_needed(tags) | |
Dependency.new("xz", tags) | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put these below |
||
|
||
def ld64_dep_if_needed(*); end | ||
|
||
def self.tar_needs_xz_dependency? | ||
|
@@ -158,6 +166,8 @@ def resource_dep(spec, tags) | |
def parse_url_spec(url, tags) | ||
case File.extname(url) | ||
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 ".lz" then Dependency.new("lzip", tags) | ||
when ".rar" then Dependency.new("unrar", tags) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
require "dependency_collector" | ||
require "extend/os/mac/dependency_collector" if OS.mac? | ||
require "extend/os/linux/dependency_collector" if OS.linux? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. had to add it back to override |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class DependencyCollector | ||
def xz_dep_if_needed(tags) | ||
Dependency.new("xz", tags) unless which("xz") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm 👍 on changing the default implementation in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from looking at the
|
||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: had to add it back to override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Mike agrees, change this to…