Skip to content

Commit

Permalink
chore: Try more Homebrew stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
staticaland committed Nov 15, 2023
1 parent e4b4c7e commit 16b5b17
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions homebrew_private_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy
require "utils/formatter"
require "utils/github"

# fix issue: https://github.com/Homebrew/brew/issues/15169
# bypass a HEAD request that does NOT contains token, which will fail
def resolve_url_basename_time_file_size(url, timeout: nil)
url = download_url
super
end

# [2023-10-14] brew relies on this output to rename the downloaded file
# See: https://github.com/Homebrew/brew/blob/fbe50bf280bff033b968d439d5441d338afec98f/Library/Homebrew/download_strategy.rb#L305
# Not setting this will break formulas during install stage, symtoms: Errno::ENOENT: No such file or directory - path/to/file
def resolved_basename
@filename
end

def initialize(url, name, version, **meta)
super
parse_url_pattern
Expand All @@ -76,7 +62,7 @@ def download_url

private

def _fetch(url:, resolved_url:)
def _fetch(url:, resolved_url:, timeout:)
curl_download download_url, to: temporary_path
end

Expand Down Expand Up @@ -128,7 +114,7 @@ def download_url

private

def _fetch(url:, resolved_url:)
def _fetch(url:, resolved_url:, timeout:)
# HTTP request header `Accept: application/octet-stream` is required.
# Without this, the GitHub API will respond with metadata, not binary.
curl_download download_url, "--header", "Accept: application/octet-stream", to: temporary_path
Expand All @@ -147,7 +133,7 @@ def resolve_asset_id
end

def fetch_release_metadata
release_url = "https://api.github.com/repos/#{@owner}/#{@repo}/releases/tags/#{@tag}"
GitHub.open_api(release_url)
GitHub.get_release(@owner, @repo, @tag)
end
end

0 comments on commit 16b5b17

Please sign in to comment.