Skip to content

Commit

Permalink
fix(brew): linux brew with extra end
Browse files Browse the repository at this point in the history
refs #4822

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed May 6, 2024
1 parent e538341 commit 14ab459
Show file tree
Hide file tree
Showing 20 changed files with 185 additions and 199 deletions.
36 changes: 18 additions & 18 deletions internal/pipe/brew/templates/linux_packages.rb
Expand Up @@ -2,29 +2,29 @@
{{- range $element := .LinuxPackages }}
{{- if eq $element.Arch "amd64" }}
on_intel do
if Hardware::CPU.is_64_bit?
{{- end }}
{{- if eq $element.Arch "arm" }}
{{- if or (eq $element.Arch "arm") (eq $element.Arch "arm64") }}
on_arm do
{{- if eq $element.Arch "arm64" }}
if Hardware::CPU.is_64_bit?
{{- else }}
if !Hardware::CPU.is_64_bit?
{{- end }}
{{- if eq $element.Arch "arm64" }}
on_arm do
if Hardware::CPU.is_64_bit?
{{- end }}
{{- end }}
url "{{ $element.DownloadURL }}"
{{- if .DownloadStrategy }}, using: {{ .DownloadStrategy }}{{- end }}
{{- if .Headers }},
headers: [{{ printf "\n" }}
{{- join .Headers | indent 10 }}
]
{{- end }}
url "{{ $element.DownloadURL }}"
{{- if .DownloadStrategy }}, using: {{ .DownloadStrategy }}{{- end }}
{{- if .Headers }},
headers: [{{ printf "\n" }}
{{- join .Headers | indent 10 }}
]
{{- end }}
sha256 "{{ $element.SHA256 }}"
sha256 "{{ $element.SHA256 }}"

def install
{{- range $index, $element := .Install }}
{{ . -}}
{{- end }}
end
def install
{{- range $index, $element := .Install }}
{{ . -}}
{{- end }}
end
end
end
Expand Down
34 changes: 16 additions & 18 deletions internal/pipe/brew/testdata/TestFullFormulae.rb.golden
Expand Up @@ -31,34 +31,32 @@ class Test < Formula

on_linux do
on_intel do
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
if Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
def install
bin.install "test"
end
end
end
on_arm do
if !Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
def install
bin.install "test"
end
end
end
on_arm do
if Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
on_arm do
if Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
end
end
Expand Down
32 changes: 15 additions & 17 deletions internal/pipe/brew/testdata/TestFullFormulaeLinuxOnly.rb.golden
Expand Up @@ -9,34 +9,32 @@ class Test < Formula
depends_on :linux

on_intel do
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
if Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
def install
bin.install "test"
end
end
end
on_arm do
if !Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm6.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
def install
bin.install "test"
end
end
end
on_arm do
if Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
on_arm do
if Hardware::CPU.is_64_bit?
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"

def install
bin.install "test"
end
def install
bin.install "test"
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden
Expand Up @@ -34,12 +34,12 @@ class CustomBlock < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "custom_block_linux_amd64 => custom_block"
end
def install
bin.install "custom_block_linux_amd64 => custom_block"
end
end
end
Expand Down
Expand Up @@ -34,12 +34,12 @@ class CustomDownloadStrategy < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: GitHubPrivateRepositoryReleaseDownloadStrategy
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: GitHubPrivateRepositoryReleaseDownloadStrategy
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "custom_download_strategy_linux_amd64 => custom_download_strategy"
end
def install
bin.install "custom_download_strategy_linux_amd64 => custom_download_strategy"
end
end
end
Expand Down
Expand Up @@ -35,12 +35,12 @@ class CustomRequire < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: CustomDownloadStrategy
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: CustomDownloadStrategy
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "custom_require_linux_amd64 => custom_require"
end
def install
bin.install "custom_require_linux_amd64 => custom_require"
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions internal/pipe/brew/testdata/TestFullPipe/default.rb.golden
Expand Up @@ -34,12 +34,12 @@ class Default < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "default_linux_amd64 => default"
end
def install
bin.install "default_linux_amd64 => default"
end
end
end
Expand Down
Expand Up @@ -34,12 +34,12 @@ class DefaultGitlab < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "default_gitlab_linux_amd64 => default_gitlab"
end
def install
bin.install "default_gitlab_linux_amd64 => default_gitlab"
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions internal/pipe/brew/testdata/TestFullPipe/git_remote.rb.golden
Expand Up @@ -34,12 +34,12 @@ class GitRemote < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "git_remote_linux_amd64 => git_remote"
end
def install
bin.install "git_remote_linux_amd64 => git_remote"
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions internal/pipe/brew/testdata/TestFullPipe/open_pr.rb.golden
Expand Up @@ -34,12 +34,12 @@ class OpenPr < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "open_pr_linux_amd64 => open_pr"
end
def install
bin.install "open_pr_linux_amd64 => open_pr"
end
end
end
Expand Down
Expand Up @@ -34,12 +34,12 @@ class ValidRepositoryTemplates < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "valid_repository_templates_linux_amd64 => valid_repository_templates"
end
def install
bin.install "valid_repository_templates_linux_amd64 => valid_repository_templates"
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions internal/pipe/brew/testdata/TestFullPipe/with_header.rb.golden
Expand Up @@ -40,15 +40,15 @@ class WithHeader < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz",
headers: [
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz",
headers: [
"Authorization: bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}"
]
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
]
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "with_header_linux_amd64 => with_header"
end
def install
bin.install "with_header_linux_amd64 => with_header"
end
end
end
Expand Down
Expand Up @@ -42,16 +42,16 @@ class WithManyHeaders < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/bin.tar.gz",
headers: [
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/bin.tar.gz",
headers: [
"Accept: application/octet-stream",
"Authorization: bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}"
]
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
]
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "with_many_headers_linux_amd64 => with_many_headers"
end
def install
bin.install "with_many_headers_linux_amd64 => with_many_headers"
end
end
end
Expand Down
Expand Up @@ -21,25 +21,24 @@ class V1 < Formula

on_linux do
on_intel do
url "https://dummyhost/download/v1.0.1/amd64v2.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/amd64v2.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "foo"
man1.install "./man/foo.1.gz"
end
def install
bin.install "foo"
man1.install "./man/foo.1.gz"
end
end
end
on_arm do
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/arm64.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
on_arm do
if Hardware::CPU.is_64_bit?
url "https://dummyhost/download/v1.0.1/arm64.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

def install
bin.install "foo"
man1.install "./man/foo.1.gz"
end
def install
bin.install "foo"
man1.install "./man/foo.1.gz"
end
end
end
Expand Down

0 comments on commit 14ab459

Please sign in to comment.