fetch: add --bottle-tag flag
This commit is contained in:
parent
5659d74ff5
commit
793371a348
@ -20,6 +20,8 @@ module Homebrew
|
|||||||
Download a bottle (if available) or source packages for <formula>e
|
Download a bottle (if available) or source packages for <formula>e
|
||||||
and binaries for <cask>s. For files, also print SHA-256 checksums.
|
and binaries for <cask>s. For files, also print SHA-256 checksums.
|
||||||
EOS
|
EOS
|
||||||
|
flag "--bottle-tag",
|
||||||
|
description: "Download a bottle for given tag."
|
||||||
switch "--HEAD",
|
switch "--HEAD",
|
||||||
description: "Fetch HEAD version instead of stable version."
|
description: "Fetch HEAD version instead of stable version."
|
||||||
switch "-f", "--force",
|
switch "-f", "--force",
|
||||||
@ -47,12 +49,13 @@ module Homebrew
|
|||||||
switch "--cask", "--casks",
|
switch "--cask", "--casks",
|
||||||
description: "Treat all named arguments as casks."
|
description: "Treat all named arguments as casks."
|
||||||
|
|
||||||
conflicts "--build-from-source", "--build-bottle", "--force-bottle"
|
conflicts "--build-from-source", "--build-bottle", "--force-bottle", "--bottle-tag"
|
||||||
conflicts "--cask", "--HEAD"
|
conflicts "--cask", "--HEAD"
|
||||||
conflicts "--cask", "--deps"
|
conflicts "--cask", "--deps"
|
||||||
conflicts "--cask", "-s"
|
conflicts "--cask", "-s"
|
||||||
conflicts "--cask", "--build-bottle"
|
conflicts "--cask", "--build-bottle"
|
||||||
conflicts "--cask", "--force-bottle"
|
conflicts "--cask", "--force-bottle"
|
||||||
|
conflicts "--cask", "--bottle-tag"
|
||||||
conflicts "--formula", "--cask"
|
conflicts "--formula", "--cask"
|
||||||
|
|
||||||
named_args [:formula, :cask], min: 1
|
named_args [:formula, :cask], min: 1
|
||||||
@ -90,7 +93,7 @@ module Homebrew
|
|||||||
begin
|
begin
|
||||||
f.clear_cache if args.force?
|
f.clear_cache if args.force?
|
||||||
f.fetch_bottle_tab
|
f.fetch_bottle_tab
|
||||||
fetch_formula(f.bottle, args: args)
|
fetch_formula(f.bottle_for_tag(args.bottle_tag), args: args)
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
raise
|
raise
|
||||||
rescue => e
|
rescue => e
|
||||||
|
|||||||
@ -368,6 +368,13 @@ class Formula
|
|||||||
@bottle ||= Bottle.new(self, bottle_specification) if bottled?
|
@bottle ||= Bottle.new(self, bottle_specification) if bottled?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# The Bottle object for given tag.
|
||||||
|
# @private
|
||||||
|
sig { params(tag: T.nilable(String)).returns(T.nilable(Bottle)) }
|
||||||
|
def bottle_for_tag(tag = nil)
|
||||||
|
Bottle.new(self, bottle_specification, tag) if bottled?
|
||||||
|
end
|
||||||
|
|
||||||
# The description of the software.
|
# The description of the software.
|
||||||
# @!method desc
|
# @!method desc
|
||||||
# @see .desc=
|
# @see .desc=
|
||||||
|
|||||||
@ -299,14 +299,19 @@ class Bottle
|
|||||||
def_delegators :resource, :url, :verify_download_integrity
|
def_delegators :resource, :url, :verify_download_integrity
|
||||||
def_delegators :resource, :cached_download
|
def_delegators :resource, :cached_download
|
||||||
|
|
||||||
def initialize(formula, spec)
|
def initialize(formula, spec, tag = nil)
|
||||||
@name = formula.name
|
@name = formula.name
|
||||||
@resource = Resource.new
|
@resource = Resource.new
|
||||||
@resource.owner = formula
|
@resource.owner = formula
|
||||||
@resource.specs[:bottle] = true
|
@resource.specs[:bottle] = true
|
||||||
@spec = spec
|
@spec = spec
|
||||||
|
|
||||||
checksum, tag, cellar = spec.checksum_for(Utils::Bottles.tag)
|
bottle_tag = if tag.present?
|
||||||
|
Utils::Bottles::Tag.from_symbol(tag)
|
||||||
|
else
|
||||||
|
Utils::Bottles.tag
|
||||||
|
end
|
||||||
|
checksum, tag, cellar = spec.checksum_for(bottle_tag)
|
||||||
|
|
||||||
@prefix = spec.prefix
|
@prefix = spec.prefix
|
||||||
@tag = tag
|
@tag = tag
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user