Skip to content

Commit

Permalink
docs: conventional file name on armv6
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Nov 2, 2023
1 parent 9c54dda commit 3a3cf61
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/pipe/nfpm/nfpm_test.go
Expand Up @@ -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 }}",
},
},
},
Expand Down Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions www/docs/customization/nfpm.md
Expand Up @@ -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 -}}
# ...
```

0 comments on commit 3a3cf61

Please sign in to comment.