From 03e743a75e840f0be8a97ecf563cc0d7b16fa0d1 Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Wed, 11 Oct 2023 09:47:15 -0400 Subject: [PATCH] api: add `using:` attribute to head & stable URLs --- Library/Homebrew/formula.rb | 2 ++ Library/Homebrew/formulary.rb | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 13901ed4aa..e7b757c5e8 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2281,6 +2281,7 @@ class Formula "url" => stable_spec.url, "tag" => stable_spec.specs[:tag], "revision" => stable_spec.specs[:revision], + "using" => (stable_spec.using if stable_spec.using.is_a?(Symbol)), "checksum" => stable_spec.checksum&.to_s, } @@ -2291,6 +2292,7 @@ class Formula hsh["urls"]["head"] = { "url" => T.must(head).url, "branch" => T.must(head).specs[:branch], + "using" => (T.must(head).using if T.must(head).using.is_a?(Symbol)), } end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index f2e0d5137b..951bb60a61 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -241,7 +241,11 @@ module Formulary if (urls_stable = json_formula["urls"]["stable"].presence) stable do - url_spec = { tag: urls_stable["tag"], revision: urls_stable["revision"] }.compact + url_spec = { + tag: urls_stable["tag"], + revision: urls_stable["revision"], + using: urls_stable["using"]&.to_sym, + }.compact url urls_stable["url"], **url_spec version json_formula["versions"]["stable"] sha256 urls_stable["checksum"] if urls_stable["checksum"].present? @@ -256,7 +260,10 @@ module Formulary if (urls_head = json_formula["urls"]["head"].presence) head do - url_spec = { branch: urls_head["branch"] }.compact + url_spec = { + branch: urls_head["branch"], + using: urls_head["using"]&.to_sym, + }.compact url urls_head["url"], **url_spec instance_exec(:head, &add_deps)