Allow fetching for different arch.

This commit is contained in:
Markus Reiter 2023-03-25 11:56:05 +01:00
parent c271a9ae75
commit 5e52d415a9
No known key found for this signature in database
GPG Key ID: 245293B51702655B
5 changed files with 55 additions and 40 deletions

View File

@ -322,6 +322,7 @@ module Cask
hash_keys_to_skip = %w[outdated installed versions] hash_keys_to_skip = %w[outdated installed versions]
begin
if @dsl.on_system_blocks_exist? if @dsl.on_system_blocks_exist?
[:arm, :intel].each do |arch| [:arm, :intel].each do |arch|
MacOSVersions::SYMBOLS.each_key do |os_name| MacOSVersions::SYMBOLS.each_key do |os_name|
@ -343,8 +344,10 @@ module Cask
end end
end end
end end
ensure
Homebrew::SimulateSystem.clear Homebrew::SimulateSystem.clear
end
refresh refresh
hash["variations"] = variations hash["variations"] = variations

View File

@ -20,6 +20,10 @@ 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
# This is needed for testing cask downloads on CI.
flag "--arch=",
description: "Download for the given arch.",
hidden: true
flag "--bottle-tag=", flag "--bottle-tag=",
description: "Download a bottle for given tag." description: "Download a bottle for given tag."
switch "--HEAD", switch "--HEAD",
@ -66,6 +70,10 @@ module Homebrew
def self.fetch def self.fetch
args = fetch_args.parse args = fetch_args.parse
if (arch = args.arch)
SimulateSystem.arch = arch.to_sym
end
bucket = if args.deps? bucket = if args.deps?
args.named.to_formulae_and_casks.flat_map do |formula_or_cask| args.named.to_formulae_and_casks.flat_map do |formula_or_cask|
case formula_or_cask case formula_or_cask

View File

@ -144,7 +144,7 @@ module Homebrew
replacement_pairs << [new_hash_cask.sha256.to_s, download.sha256] replacement_pairs << [new_hash_cask.sha256.to_s, download.sha256]
end end
ensure
Homebrew::SimulateSystem.clear Homebrew::SimulateSystem.clear
end end
elsif new_hash.present? elsif new_hash.present?

View File

@ -2219,6 +2219,7 @@ class Formula
os_versions = [*MacOSVersions::SYMBOLS.keys, :linux] os_versions = [*MacOSVersions::SYMBOLS.keys, :linux]
begin
if path.exist? && self.class.on_system_blocks_exist? if path.exist? && self.class.on_system_blocks_exist?
formula_contents = path.read formula_contents = path.read
[:arm, :intel].each do |arch| [:arm, :intel].each do |arch|
@ -2244,8 +2245,9 @@ class Formula
end end
end end
end end
ensure
Homebrew::SimulateSystem.clear Homebrew::SimulateSystem.clear
end
hash["variations"] = variations hash["variations"] = variations
hash hash

View File

@ -103,16 +103,18 @@ module Readall
bottle_tag = Utils::Bottles::Tag.new(system: os_name, arch: arch) bottle_tag = Utils::Bottles::Tag.new(system: os_name, arch: arch)
next unless bottle_tag.valid_combination? next unless bottle_tag.valid_combination?
begin
Homebrew::SimulateSystem.arch = arch Homebrew::SimulateSystem.arch = arch
Homebrew::SimulateSystem.os = os_name Homebrew::SimulateSystem.os = os_name
success = false unless valid_formulae?(tap.formula_files, bottle_tag: bottle_tag) success = false unless valid_formulae?(tap.formula_files, bottle_tag: bottle_tag)
success = false unless valid_casks?(tap.cask_files, bottle_tag: bottle_tag) success = false unless valid_casks?(tap.cask_files, bottle_tag: bottle_tag)
ensure
Homebrew::SimulateSystem.clear Homebrew::SimulateSystem.clear
end end
end end
end end
end
success success
end end