Sometimes there may be intermittent failures with hosts that work if
immediately retried. Let's allow a single retry in this case with the
--retry flag. This also behaves nicely with the --force flag.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
It doesn't really make logical sense that this method returns both the
fetched path (or sometimes nil!) and the downloader, so just return the
path (again, or nil!) and callers that want the downloader can ask for
it separately.
The download strategy will print the cached location if we've already
fetched it, so avoid printing redundant information.
Also just "puts" it instead of using a second `ohai` line.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Mirrors can now be declared using the `mirror` method which works similar to
`depends_on` and takes the same arguments as `url`.
The formula class now has a public `fetch` method that cycles through the
mirror list if the downloader for the primary URL throws a `DownloadError`.
Other brew commands, like brew-fetch, also benefit from mirror support by using
this method.
ClosesHomebrew/homebrew#7574.
`brew fetch --force` was a no-op for formula pathnames when that formula
did not exist in Library/Formula, because `brew --cache #{f.name}`
results in an error for that case.
Fix it by always using f.cached_download.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>