From 3a3cf610f894afbfe018a330d9ee3bbf1ab1e7ff Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 2 Nov 2023 12:32:31 +0000 Subject: [PATCH] docs: conventional file name on armv6 refs https://github.com/charmbracelet/meta/pull/116 --- internal/pipe/nfpm/nfpm_test.go | 10 ++++++++-- www/docs/customization/nfpm.md | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go index d7f79de9210..4a9c3b4cbd3 100644 --- a/internal/pipe/nfpm/nfpm_test.go +++ b/internal/pipe/nfpm/nfpm_test.go @@ -340,8 +340,13 @@ func doTestRunPipeConventionalNameTemplate(t *testing.T, snapshot bool) { Homepage: "https://goreleaser.com/", Bindir: "/usr/bin", NFPMOverridables: config.NFPMOverridables{ - FileNameTemplate: `{{ trimsuffix (trimsuffix (trimsuffix (trimsuffix .ConventionalFileName ".pkg.tar.zst") ".deb") ".rpm") ".apk" }}{{ if not (eq .Amd64 "v1")}}{{ .Amd64 }}{{ end }}`, - PackageName: "foo{{ if .IsSnapshot }}-snapshot{{ end }}", + FileNameTemplate: ` + {{- trimsuffix .ConventionalFileName .ConventionalExtension -}} + {{- if and (eq .Arm "6") (eq .ConventionalExtension ".deb") }}6{{ end -}} + {{- if not (eq .Amd64 "v1")}}{{ .Amd64 }}{{ end -}} + {{- .ConventionalExtension -}} + `, + PackageName: "foo{{ if .IsSnapshot }}-snapshot{{ end }}", }, }, }, @@ -437,6 +442,7 @@ func doTestRunPipeConventionalNameTemplate(t *testing.T, snapshot bool) { prefix + "_1.0.0_arm64.deb", prefix + "_1.0.0_armhf.apk", prefix + "_1.0.0_armhf.deb", + prefix + "_1.0.0_armhf6.deb", prefix + "_1.0.0_armv7.apk", prefix + "_1.0.0_i386.deb", prefix + "_1.0.0_mips.apk", diff --git a/www/docs/customization/nfpm.md b/www/docs/customization/nfpm.md index caa1bbf55a9..62ff9bd1932 100644 --- a/www/docs/customization/nfpm.md +++ b/www/docs/customization/nfpm.md @@ -456,3 +456,26 @@ Termux is the same format as `deb`, the differences are: - it uses a different `bindir` (prefixed with `/data/data/com.termux/files/`) - it uses slightly different architecture names than Debian + +## Conventional file names, Debian, and ARMv6 + +On Debian, both ARMv6 and ARMv7 have the same architecture name: `armhf`. + +If you use `{{.ConventionalFileName}}`, and build for both architectures, you'll +get duplicated file names. + +You can go around that with something like this: + +```yaml +# .goreleaser.yaml +nfpms: + - + # ... + file_name_template: >- + {{- trimsuffix .ConventionalFileName .ConventionalExtension -}} + {{- if and (eq .Arm "6") (eq .ConventionalExtension ".deb") }}6{{ end -}} + {{- if not (eq .Amd64 "v1")}}{{ .Amd64 }}{{ end -}} + {{- .ConventionalExtension -}} + + # ... +```