mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-13 11:50:34 +02:00
feat(pipe/brew): install amd64 binaries when no arm64 binaries present (#2939)
Currently on a M1 macbook when adding a tap with formulas that only support amd64 it fails to add the tap. This prevents new arm64 users from using the tap. By allowing arm64 users to install an amd64 binary if no arm64 binary is avialable will atleast allow the user to use the tap.
This commit is contained in:
parent
a5a1abc6c6
commit
f734b503d4
@ -374,6 +374,10 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, cl client.Client, artifa
|
||||
}
|
||||
}
|
||||
|
||||
if len(result.MacOSPackages) == 1 && result.MacOSPackages[0].Arch == "amd64" {
|
||||
result.HasOnlyAmd64MacOsPkg = true
|
||||
}
|
||||
|
||||
sort.Slice(result.LinuxPackages, lessFnFor(result.LinuxPackages))
|
||||
sort.Slice(result.MacOSPackages, lessFnFor(result.MacOSPackages))
|
||||
return result, nil
|
||||
|
@ -81,9 +81,10 @@ var defaultTemplateData = templateData{
|
||||
Install: []string{`bin.install "test"`},
|
||||
},
|
||||
},
|
||||
Name: "Test",
|
||||
Version: "0.1.3",
|
||||
Caveats: []string{},
|
||||
Name: "Test",
|
||||
Version: "0.1.3",
|
||||
Caveats: []string{},
|
||||
HasOnlyAmd64MacOsPkg: false,
|
||||
}
|
||||
|
||||
func assertDefaultTemplateData(t *testing.T, formulae string) {
|
||||
|
@ -3,21 +3,22 @@ package brew
|
||||
import "github.com/goreleaser/goreleaser/pkg/config"
|
||||
|
||||
type templateData struct {
|
||||
Name string
|
||||
Desc string
|
||||
Homepage string
|
||||
Version string
|
||||
License string
|
||||
Caveats []string
|
||||
Plist string
|
||||
PostInstall string
|
||||
Dependencies []config.HomebrewDependency
|
||||
Conflicts []string
|
||||
Tests []string
|
||||
CustomRequire string
|
||||
CustomBlock []string
|
||||
LinuxPackages []releasePackage
|
||||
MacOSPackages []releasePackage
|
||||
Name string
|
||||
Desc string
|
||||
Homepage string
|
||||
Version string
|
||||
License string
|
||||
Caveats []string
|
||||
Plist string
|
||||
PostInstall string
|
||||
Dependencies []config.HomebrewDependency
|
||||
Conflicts []string
|
||||
Tests []string
|
||||
CustomRequire string
|
||||
CustomBlock []string
|
||||
LinuxPackages []releasePackage
|
||||
MacOSPackages []releasePackage
|
||||
HasOnlyAmd64MacOsPkg bool
|
||||
}
|
||||
|
||||
type releasePackage struct {
|
||||
@ -64,6 +65,26 @@ class {{ .Name }} < Formula
|
||||
{{ . -}}
|
||||
{{- end }}
|
||||
end
|
||||
{{- else if $.HasOnlyAmd64MacOsPkg }}
|
||||
url "{{ $element.DownloadURL }}"
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
sha256 "{{ $element.SHA256 }}"
|
||||
|
||||
def install
|
||||
{{- range $index, $element := .Install }}
|
||||
{{ . -}}
|
||||
{{- end }}
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the {{ $.Name }}
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
{{- else }}
|
||||
{{- if eq $element.Arch "amd64" }}
|
||||
if Hardware::CPU.intel?
|
||||
|
@ -9,12 +9,20 @@ class CustomBlock < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "custom_block"
|
||||
def install
|
||||
bin.install "custom_block"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the CustomBlock
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,12 +9,20 @@ class CustomDownloadStrategy < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "custom_download_strategy"
|
||||
def install
|
||||
bin.install "custom_download_strategy"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the CustomDownloadStrategy
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,12 +10,20 @@ class CustomRequire < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz", :using => CustomDownloadStrategy
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz", :using => CustomDownloadStrategy
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "custom_require"
|
||||
def install
|
||||
bin.install "custom_require"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the CustomRequire
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,12 +9,20 @@ class Default < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "default"
|
||||
def install
|
||||
bin.install "default"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the Default
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,12 +9,20 @@ class DefaultGitlab < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "default_gitlab"
|
||||
def install
|
||||
bin.install "default_gitlab"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the DefaultGitlab
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,12 +9,20 @@ class ValidTapTemplates < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "valid_tap_templates"
|
||||
def install
|
||||
bin.install "valid_tap_templates"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the ValidTapTemplates
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,12 +8,20 @@ class MultipleArmv5 < Formula
|
||||
version "1.0.1"
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "multiple_armv5"
|
||||
def install
|
||||
bin.install "multiple_armv5"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the MultipleArmv5
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,12 +8,20 @@ class MultipleArmv6 < Formula
|
||||
version "1.0.1"
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "multiple_armv6"
|
||||
def install
|
||||
bin.install "multiple_armv6"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the MultipleArmv6
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,12 +8,20 @@ class MultipleArmv7 < Formula
|
||||
version "1.0.1"
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "multiple_armv7"
|
||||
def install
|
||||
bin.install "multiple_armv7"
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the MultipleArmv7
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,11 +9,19 @@ class FooIsBar < Formula
|
||||
depends_on :macos
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.intel?
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
def install
|
||||
end
|
||||
|
||||
if Hardware::CPU.arm?
|
||||
def caveats
|
||||
<<~EOS
|
||||
The darwin_arm64 architecture is not supported for the FooIsBar
|
||||
formula at this time. The darwin_amd64 binary may work in compatibility
|
||||
mode, but it might not be fully supported.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user