Merge pull request #7552 from MikeMcQuaid/fetch-resources-from-source
Fetch (all) resources when building from source
This commit is contained in:
commit
10c9d96566
@ -114,7 +114,9 @@ class Build
|
|||||||
with_env(new_env) do
|
with_env(new_env) do
|
||||||
formula.extend(Debrew::Formula) if ARGV.debug?
|
formula.extend(Debrew::Formula) if ARGV.debug?
|
||||||
|
|
||||||
formula.brew do |_formula, staging|
|
formula.update_head_version
|
||||||
|
|
||||||
|
formula.brew(fetch: false) do |_formula, staging|
|
||||||
# For head builds, HOMEBREW_FORMULA_PREFIX should include the commit,
|
# For head builds, HOMEBREW_FORMULA_PREFIX should include the commit,
|
||||||
# which is not known until after the formula has been staged.
|
# which is not known until after the formula has been staged.
|
||||||
ENV["HOMEBREW_FORMULA_PREFIX"] = formula.prefix
|
ENV["HOMEBREW_FORMULA_PREFIX"] = formula.prefix
|
||||||
|
@ -1012,11 +1012,11 @@ class Formula
|
|||||||
self.build = Tab.for_formula(self)
|
self.build = Tab.for_formula(self)
|
||||||
|
|
||||||
new_env = {
|
new_env = {
|
||||||
"TMPDIR" => HOMEBREW_TEMP,
|
TMPDIR: HOMEBREW_TEMP,
|
||||||
"TEMP" => HOMEBREW_TEMP,
|
TEMP: HOMEBREW_TEMP,
|
||||||
"TMP" => HOMEBREW_TEMP,
|
TMP: HOMEBREW_TEMP,
|
||||||
"HOMEBREW_PATH" => nil,
|
HOMEBREW_PATH: nil,
|
||||||
"PATH" => ENV["HOMEBREW_PATH"],
|
PATH: ENV["HOMEBREW_PATH"],
|
||||||
}
|
}
|
||||||
|
|
||||||
with_env(new_env) do
|
with_env(new_env) do
|
||||||
@ -1160,11 +1160,12 @@ class Formula
|
|||||||
# yields |self,staging| with current working directory set to the uncompressed tarball
|
# yields |self,staging| with current working directory set to the uncompressed tarball
|
||||||
# where staging is a Mktemp staging context
|
# where staging is a Mktemp staging context
|
||||||
# @private
|
# @private
|
||||||
def brew
|
def brew(fetch: true)
|
||||||
@prefix_returns_versioned_prefix = true
|
@prefix_returns_versioned_prefix = true
|
||||||
|
active_spec.fetch if fetch
|
||||||
stage do |staging|
|
stage do |staging|
|
||||||
staging.retain! if Homebrew.args.keep_tmp?
|
staging.retain! if Homebrew.args.keep_tmp?
|
||||||
prepare_patches
|
fetch_patches if fetch
|
||||||
|
|
||||||
begin
|
begin
|
||||||
yield self, staging
|
yield self, staging
|
||||||
@ -2078,6 +2079,13 @@ class Formula
|
|||||||
ENV.update(removed)
|
ENV.update(removed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fetch_patches
|
||||||
|
active_spec.add_legacy_patches(patches) if respond_to?(:patches)
|
||||||
|
|
||||||
|
patchlist.grep(DATAPatch) { |p| p.path = path }
|
||||||
|
patchlist.select(&:external?).each(&:fetch)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Returns the prefix for a given formula version number.
|
# Returns the prefix for a given formula version number.
|
||||||
@ -2147,13 +2155,6 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_patches
|
|
||||||
active_spec.add_legacy_patches(patches) if respond_to?(:patches)
|
|
||||||
|
|
||||||
patchlist.grep(DATAPatch) { |p| p.path = path }
|
|
||||||
patchlist.select(&:external?).each(&:fetch)
|
|
||||||
end
|
|
||||||
|
|
||||||
# The methods below define the formula DSL.
|
# The methods below define the formula DSL.
|
||||||
class << self
|
class << self
|
||||||
include BuildEnvironment::DSL
|
include BuildEnvironment::DSL
|
||||||
|
@ -977,6 +977,11 @@ class FormulaInstaller
|
|||||||
|
|
||||||
return if only_deps?
|
return if only_deps?
|
||||||
|
|
||||||
|
unless pour_bottle?
|
||||||
|
formula.fetch_patches
|
||||||
|
formula.resources.each(&:fetch)
|
||||||
|
end
|
||||||
|
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -986,7 +991,7 @@ class FormulaInstaller
|
|||||||
elsif pour_bottle?
|
elsif pour_bottle?
|
||||||
formula.bottle
|
formula.bottle
|
||||||
else
|
else
|
||||||
formula.downloader
|
formula
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ class ExternalPatch
|
|||||||
attr_reader :resource, :strip
|
attr_reader :resource, :strip
|
||||||
|
|
||||||
def_delegators :resource,
|
def_delegators :resource,
|
||||||
:url, :fetch, :patch_files, :verify_download_integrity, :cached_download,
|
:url, :fetch, :patch_files, :verify_download_integrity,
|
||||||
:clear_cache
|
:cached_download, :downloaded?, :clear_cache
|
||||||
|
|
||||||
def initialize(strip, &block)
|
def initialize(strip, &block)
|
||||||
@strip = strip
|
@strip = strip
|
||||||
|
@ -55,6 +55,10 @@ class Resource
|
|||||||
"#{owner.name}--#{escaped_name}"
|
"#{owner.name}--#{escaped_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def downloaded?
|
||||||
|
cached_download.exist?
|
||||||
|
end
|
||||||
|
|
||||||
def cached_download
|
def cached_download
|
||||||
downloader.cached_location
|
downloader.cached_location
|
||||||
end
|
end
|
||||||
@ -68,17 +72,19 @@ class Resource
|
|||||||
# directory. Subclasses that override stage should implement the tmp
|
# directory. Subclasses that override stage should implement the tmp
|
||||||
# dir using {Mktemp} so that works with all subtypes.
|
# dir using {Mktemp} so that works with all subtypes.
|
||||||
def stage(target = nil, &block)
|
def stage(target = nil, &block)
|
||||||
raise ArgumentError, "target directory or block is required" unless target || block
|
raise ArgumentError, "target directory or block is required" if target.blank? && block.blank?
|
||||||
|
|
||||||
fetch
|
fetch_patches(skip_downloaded: true)
|
||||||
prepare_patches
|
fetch unless downloaded?
|
||||||
|
|
||||||
unpack(target, &block)
|
unpack(target, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_patches
|
def fetch_patches(skip_downloaded: false)
|
||||||
patches.grep(DATAPatch) { |p| p.path = owner.owner.path }
|
patches.grep(DATAPatch) { |p| p.path = owner.owner.path }
|
||||||
patches.select(&:external?).each(&:fetch)
|
patches.select!(&:external?)
|
||||||
|
patches.reject!(&:downloaded?) if skip_downloaded
|
||||||
|
patches.each(&:fetch)
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_patches
|
def apply_patches
|
||||||
@ -115,6 +121,8 @@ class Resource
|
|||||||
def fetch(verify_download_integrity: true)
|
def fetch(verify_download_integrity: true)
|
||||||
HOMEBREW_CACHE.mkpath
|
HOMEBREW_CACHE.mkpath
|
||||||
|
|
||||||
|
fetch_patches
|
||||||
|
|
||||||
begin
|
begin
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
rescue ErrorDuringExecution, CurlDownloadStrategyError => e
|
rescue ErrorDuringExecution, CurlDownloadStrategyError => e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user