Conversation
resource 'contrib' do | ||
url 'ftp://ftp.figlet.org:21//pub/figlet/fonts/contributed.tar.gz' | ||
sha1 'a23ecfdb54301e93b6578c3c465ba84c8f861d4f' | ||
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.
When formulae gain revisions, we may want that for resources too; these resources are unversioned tarballs.
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.
What are revisions? Is there a roadmap or anything where these future changes are documented?
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.
Nice! I had a similar idea when working on the Wine formula a while ago, but I assumed you'd reject such a change to the DSL. I would suggest two changes, though:
|
(1) I'd love to unify these; Jack has some thoughts on this, but involve rewriting the download strategies (if I remember correctly.) (2) this is a great idea and solves a design problem I was having; we should allow overrides in head and devel, though it's possible that a --devel build might download stable resources it no longer needs (and them not use them), but I'm OK with that at a first draft. |
My hope is to move all download and checksum logic into Resource and make SoftwareSpec more Formula-like, so that dependencies can be scoped to stable, devel, or head without using conditionals. Basically, I want to be able to do most things that are possible in the formula DSL inside of a stable, devel, or head block. Things like It seems natural that the same semantics would apply to resources. |
Ready for some review. |
Code looks good to me. I would, in an ideal world, like something where multiple formulae can share a cached resource's download. |
I was trying (not very well) to articulate something like that in #21716. |
I'd like for instance to be able to do |
Although for fetch to work, we'd need to be able to declare the resource up-front as a copy from the other formula. Will think about this. |
Something like in Python3:
or
|
@adamv I haven't had time to look at the code; regarding the points 1 and 2 that we were in agreement upon, are they going to be in this PR already, or are they future work? |
Future work. |
Do we want sharable resources to be part of this check-in, or are we OK pushing as-is and adding syntax for that later? |
Later seems fine. |
Can anyone think of a better method name than I kind of want to call it It should be named with the idea that downloadables will be defined in terms of resources in the future. |
Some more random API thoughts. Not sold on any of these since none of them happen too often. Allow
becomes
Or, add an extension to Pathname that takes resources:
Though perhaps |
Or Pathname.install can learn to handle Resource-like objects too |
Not enough cases for the |
Definitely prefer: |
Is it also possible to use the resource to just get a file. In homebrew/science, for one formula I need to download lapack.zip and point the install script to that download. How would that look with the resource?
|
@adamv Is |
I like @samueljohn's idea. In fact, there is probably no need for |
We can't download on top of the existing tmp folder, that will overwrite README files or anything with the same name. So the block form is needed. |
But if we change the main formula download to be an implicit resource, then we can have a single tmp folder with resource downloads inside - and resource names cannot conflict. Basically instead of |
I taught |
(libexec+"lib").install Dir['*.jar'] | ||
end | ||
end | ||
(libexec/'lib').stage(resource('bdb-je')) unless build.include? "no-bdb" |
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.
would (libexec/'lib').install resource('bdb-je')
work now, given your latest commit?
I like resource.stage
but I don't like libexec.stage resource('foo')
Making a real pull request for #20212.