Skip to content

Commit

Permalink
Fix wrong stage method being called.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Sep 4, 2024
1 parent 231ac72 commit eb5c035
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
11 changes: 11 additions & 0 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,17 @@ def stage
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
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1254,12 +1254,12 @@ def fetch
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?
Expand Down Expand Up @@ -1324,7 +1324,7 @@ def pour
end

HOMEBREW_CELLAR.cd do
downloader.stage
downloadable.downloader.stage
end

Tab.clear_cache
Expand Down
21 changes: 1 addition & 20 deletions Library/Homebrew/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,26 +273,7 @@ def determine_url_mirrors
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

Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/software_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ def skip_relocation?
@spec.skip_relocation?(tag: @tag)
end

def stage
resource.downloader.stage
end
def stage = resource.downloader.stage

def fetch_tab(timeout: nil, quiet: false)
return unless (resource = github_packages_manifest_resource)
Expand Down

0 comments on commit eb5c035

Please sign in to comment.