Fix wrong stage method being called.

This commit is contained in:
Markus Reiter 2024-09-04 23:12:58 +02:00
parent 231ac720d2
commit fb0bf3b7a2
No known key found for this signature in database
GPG Key ID: 245293B51702655B
4 changed files with 17 additions and 27 deletions

View File

@ -710,6 +710,17 @@ class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
end
end
# Strategy for extracting local binary packages.
class LocalBottleDownloadStrategy < AbstractFileDownloadStrategy
def initialize(path) # rubocop:disable Lint/MissingSuper
@cached_location = path
end
def clear_cache
# Path is used directly and not cached.
end
end
# Strategy for downloading a Subversion repository.
#
# @api public

View File

@ -1254,12 +1254,12 @@ on_request: installed_on_request?, options:)
formula.fetch_patches
formula.resources.each(&:fetch)
end
downloader.fetch
downloadable.downloader.fetch
self.class.fetched << formula
end
def downloader
def downloadable
if (bottle_path = formula.local_bottle_path)
Resource::Local.new(bottle_path)
elsif pour_bottle?
@ -1324,7 +1324,7 @@ on_request: installed_on_request?, options:)
end
HOMEBREW_CELLAR.cd do
downloader.stage
downloadable.downloader.stage
end
Tab.clear_cache

View File

@ -273,26 +273,7 @@ class Resource
class Local < Resource
def initialize(path)
super(File.basename(path))
@path = path
end
sig { override.returns(Pathname) }
def cached_download
@path
end
sig { override.void }
def clear_cache; end
sig {
override.params(
verify_download_integrity: T::Boolean,
timeout: T.nilable(T.any(Integer, Float)),
quiet: T::Boolean,
).returns(Pathname)
}
def fetch(verify_download_integrity: true, timeout: nil, quiet: false)
cached_download
@downloader = LocalBottleDownloadStrategy.new(path)
end
end

View File

@ -352,7 +352,7 @@ class Bottle
attr_reader :name, :resource, :tag, :cellar, :rebuild
def_delegators :resource, :url, :verify_download_integrity
def_delegators :resource, :cached_download
def_delegators :resource, :cached_download, :downloader
def initialize(formula, spec, tag = nil)
super()
@ -408,9 +408,7 @@ class Bottle
@spec.skip_relocation?(tag: @tag)
end
def stage
resource.downloader.stage
end
def stage = downloader.stage
def fetch_tab(timeout: nil, quiet: false)
return unless (resource = github_packages_manifest_resource)