mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-13 11:50:34 +02:00
feat(nfpm): add .Format tmpl var
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
765d534c2e
commit
b294759d95
@ -218,6 +218,10 @@ func create(ctx *context.Context, fpm config.NFPM, format string, artifacts []*a
|
||||
|
||||
// We cannot use t.ApplyAll on the following fields as they are shared
|
||||
// across multiple nfpms.
|
||||
//
|
||||
t = t.WithExtraFields(tmpl.Fields{
|
||||
"Format": format,
|
||||
})
|
||||
|
||||
debKeyFile, err := t.Apply(overridden.Deb.Signature.KeyFile)
|
||||
if err != nil {
|
||||
|
@ -108,7 +108,7 @@ func TestRunPipe(t *testing.T) {
|
||||
|
||||
}
|
||||
libPrefix := `/usr/lib
|
||||
{{- if eq .Arch "amd64" }}64{{- end -}}
|
||||
{{- if eq .Arch "amd64" }}{{if eq .Format "rpm"}}_rpm{{end}}64{{- end -}}
|
||||
`
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
ProjectName: "mybin",
|
||||
@ -439,9 +439,15 @@ func TestRunPipe(t *testing.T) {
|
||||
carchive := "/usr/lib/c-archives"
|
||||
cshared := "/usr/lib/c-shareds"
|
||||
if pkg.Goarch == "amd64" {
|
||||
header = "/usr/lib64/headers"
|
||||
carchive = "/usr/lib64/c-archives"
|
||||
cshared = "/usr/lib64/c-shareds"
|
||||
if pkg.Format() == "rpm" {
|
||||
header = "/usr/lib_rpm64/headers"
|
||||
carchive = "/usr/lib_rpm64/c-archives"
|
||||
cshared = "/usr/lib_rpm64/c-shareds"
|
||||
} else {
|
||||
header = "/usr/lib64/headers"
|
||||
carchive = "/usr/lib64/c-archives"
|
||||
cshared = "/usr/lib64/c-shareds"
|
||||
}
|
||||
}
|
||||
if format == termuxFormat {
|
||||
bin = filepath.Join("/data/data/com.termux/files", bin)
|
||||
|
@ -121,6 +121,7 @@ In the nFPM name template field, you can use those extra fields:
|
||||
| `.PackageName` | package the name. Same as `ProjectName` if not overridden. |
|
||||
| `.ConventionalFileName` | conventional package file name as provided by nFPM.[^arm-names] |
|
||||
| `.ConventionalExtension` | conventional package extension as provided by nFPM. Since v1.16 |
|
||||
| `.Format` | package format. Since v1.24 |
|
||||
|
||||
[^arm-names]:
|
||||
Please beware: some OSs might have the same names for different
|
||||
|
Loading…
x
Reference in New Issue
Block a user