From 5f92d002443a4fce6aa3d6cae6863e43282d6bd9 Mon Sep 17 00:00:00 2001 From: Seeker Date: Tue, 23 Feb 2021 09:00:17 -0800 Subject: [PATCH] bump-cask-pr: support separate downloads for Intel and ARM --- Library/Homebrew/dev-cmd/bump-cask-pr.rb | 26 ++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index 406f16cd13..3b09ef457e 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -125,10 +125,28 @@ module Homebrew tmp_config = cask.config tmp_url = tmp_cask.url.to_s - if new_hash.nil? && old_hash != :no_check - resource_path = fetch_resource(cask, new_version, tmp_url) - Utils::Tar.validate_file(resource_path) - new_hash = resource_path.sha256 + if old_hash != :no_check + if new_hash.nil? + resource_path = fetch_resource(cask, new_version, tmp_url) + Utils::Tar.validate_file(resource_path) + new_hash = resource_path.sha256 + end + + if tmp_contents.include?("Hardware::CPU.intel?") + other_contents = tmp_contents.gsub("Hardware::CPU.intel?", (!Hardware::CPU.intel?).to_s) + other_cask = Cask::CaskLoader.load(other_contents) + other_url = other_cask.url.to_s + other_old_hash = other_cask.sha256.to_s + + resource_path = fetch_resource(cask, new_version, other_url) + Utils::Tar.validate_file(resource_path) + other_new_hash = resource_path.sha256 + + replacement_pairs << [ + other_old_hash, + other_new_hash, + ] + end end cask.languages.each do |language|