mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-30 04:50:45 +02:00
feat: remove some nfpm deprecated options (#2315)
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
afc7d85688
commit
560938152a
@ -16,7 +16,6 @@ import (
|
||||
"github.com/imdario/mergo"
|
||||
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||
"github.com/goreleaser/goreleaser/internal/ids"
|
||||
"github.com/goreleaser/goreleaser/internal/linux"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
@ -52,62 +51,7 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if fpm.FileNameTemplate == "" {
|
||||
fpm.FileNameTemplate = defaultNameTemplate
|
||||
}
|
||||
if len(fpm.Files) > 0 {
|
||||
for src, dst := range fpm.Files {
|
||||
fpm.Contents = append(fpm.Contents, &files.Content{
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
})
|
||||
}
|
||||
deprecate.Notice(ctx, "nfpms.files")
|
||||
}
|
||||
if len(fpm.ConfigFiles) > 0 {
|
||||
for src, dst := range fpm.ConfigFiles {
|
||||
fpm.Contents = append(fpm.Contents, &files.Content{
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
Type: "config",
|
||||
})
|
||||
}
|
||||
deprecate.Notice(ctx, "nfpms.config_files")
|
||||
}
|
||||
if len(fpm.Symlinks) > 0 {
|
||||
for src, dst := range fpm.Symlinks {
|
||||
fpm.Contents = append(fpm.Contents, &files.Content{
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
Type: "symlink",
|
||||
})
|
||||
}
|
||||
deprecate.Notice(ctx, "nfpms.symlinks")
|
||||
}
|
||||
if len(fpm.RPM.GhostFiles) > 0 {
|
||||
for _, dst := range fpm.RPM.GhostFiles {
|
||||
fpm.Contents = append(fpm.Contents, &files.Content{
|
||||
Destination: dst,
|
||||
Type: "ghost",
|
||||
Packager: "rpm",
|
||||
})
|
||||
}
|
||||
deprecate.Notice(ctx, "nfpms.rpm.ghost_files")
|
||||
}
|
||||
if len(fpm.RPM.ConfigNoReplaceFiles) > 0 {
|
||||
for src, dst := range fpm.RPM.ConfigNoReplaceFiles {
|
||||
fpm.Contents = append(fpm.Contents, &files.Content{
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
Type: "config|noreplace",
|
||||
Packager: "rpm",
|
||||
})
|
||||
}
|
||||
deprecate.Notice(ctx, "nfpms.rpm.config_noreplace_files")
|
||||
}
|
||||
if fpm.Deb.VersionMetadata != "" {
|
||||
deprecate.Notice(ctx, "nfpms.deb.version_metadata")
|
||||
fpm.VersionMetadata = fpm.Deb.VersionMetadata
|
||||
}
|
||||
|
||||
if len(fpm.Builds) == 0 {
|
||||
if len(fpm.Builds) == 0 { // TODO: change this to empty by default and deal with it in the filtering code
|
||||
for _, b := range ctx.Config.Builds {
|
||||
fpm.Builds = append(fpm.Builds, b.ID)
|
||||
}
|
||||
|
@ -412,55 +412,6 @@ func TestDefault(t *testing.T) {
|
||||
require.Equal(t, ctx.Config.ProjectName, ctx.Config.NFPMs[0].PackageName)
|
||||
}
|
||||
|
||||
func TestDefaultDeprecatedOptions(t *testing.T) {
|
||||
ctx := &context.Context{
|
||||
Config: config.Project{
|
||||
ProjectName: "foobar",
|
||||
NFPMs: []config.NFPM{
|
||||
{
|
||||
NFPMOverridables: config.NFPMOverridables{
|
||||
Files: map[string]string{
|
||||
"testdata/testfile.txt": "/bin/foo",
|
||||
},
|
||||
ConfigFiles: map[string]string{
|
||||
"testdata/testfile.txt": "/etc/foo.conf",
|
||||
},
|
||||
Symlinks: map[string]string{
|
||||
"/etc/foo.conf": "/etc/foov2.conf",
|
||||
},
|
||||
RPM: config.NFPMRPM{
|
||||
GhostFiles: []string{"/etc/ghost.conf"},
|
||||
ConfigNoReplaceFiles: map[string]string{
|
||||
"testdata/testfile.txt": "/etc/foo_keep.conf",
|
||||
},
|
||||
},
|
||||
Deb: config.NFPMDeb{
|
||||
VersionMetadata: "beta1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Builds: []config.Build{
|
||||
{ID: "foo"},
|
||||
{ID: "bar"},
|
||||
},
|
||||
},
|
||||
}
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.Equal(t, "/usr/local/bin", ctx.Config.NFPMs[0].Bindir)
|
||||
require.Equal(t, []string{"foo", "bar"}, ctx.Config.NFPMs[0].Builds)
|
||||
require.ElementsMatch(t, []*files.Content{
|
||||
{Source: "testdata/testfile.txt", Destination: "/bin/foo"},
|
||||
{Source: "testdata/testfile.txt", Destination: "/etc/foo.conf", Type: "config"},
|
||||
{Source: "/etc/foo.conf", Destination: "/etc/foov2.conf", Type: "symlink"},
|
||||
{Destination: "/etc/ghost.conf", Type: "ghost", Packager: "rpm"},
|
||||
{Source: "testdata/testfile.txt", Destination: "/etc/foo_keep.conf", Type: "config|noreplace", Packager: "rpm"},
|
||||
}, ctx.Config.NFPMs[0].Contents)
|
||||
require.Equal(t, defaultNameTemplate, ctx.Config.NFPMs[0].FileNameTemplate)
|
||||
require.Equal(t, ctx.Config.ProjectName, ctx.Config.NFPMs[0].PackageName)
|
||||
require.Equal(t, "beta1", ctx.Config.NFPMs[0].VersionMetadata)
|
||||
}
|
||||
|
||||
func TestDefaultSet(t *testing.T) {
|
||||
ctx := &context.Context{
|
||||
Config: config.Project{
|
||||
|
@ -345,13 +345,11 @@ type NFPMRPMScripts struct {
|
||||
|
||||
// NFPMRPM is custom configs that are only available on RPM packages.
|
||||
type NFPMRPM struct {
|
||||
Summary string `yaml:"summary,omitempty"`
|
||||
Group string `yaml:"group,omitempty"`
|
||||
Compression string `yaml:"compression,omitempty"`
|
||||
ConfigNoReplaceFiles map[string]string `yaml:"config_noreplace_files,omitempty"` // deprecated: use contents instead
|
||||
GhostFiles []string `yaml:"ghost_files,omitempty"` // deprecated: use contents instead
|
||||
Signature NFPMRPMSignature `yaml:"signature,omitempty"`
|
||||
Scripts NFPMRPMScripts `yaml:"scripts,omitempty"`
|
||||
Summary string `yaml:"summary,omitempty"`
|
||||
Group string `yaml:"group,omitempty"`
|
||||
Compression string `yaml:"compression,omitempty"`
|
||||
Signature NFPMRPMSignature `yaml:"signature,omitempty"`
|
||||
Scripts NFPMRPMScripts `yaml:"scripts,omitempty"`
|
||||
}
|
||||
|
||||
// NFPMDebScripts is scripts only available on deb packages.
|
||||
@ -383,11 +381,10 @@ type NFPMDebSignature struct {
|
||||
|
||||
// NFPMDeb is custom configs that are only available on deb packages.
|
||||
type NFPMDeb struct {
|
||||
Scripts NFPMDebScripts `yaml:"scripts,omitempty"`
|
||||
Triggers NFPMDebTriggers `yaml:"triggers,omitempty"`
|
||||
Breaks []string `yaml:"breaks,omitempty"`
|
||||
VersionMetadata string `yaml:"metadata,omitempty"` // Deprecated: Moved to Info
|
||||
Signature NFPMDebSignature `yaml:"signature,omitempty"`
|
||||
Scripts NFPMDebScripts `yaml:"scripts,omitempty"`
|
||||
Triggers NFPMDebTriggers `yaml:"triggers,omitempty"`
|
||||
Breaks []string `yaml:"breaks,omitempty"`
|
||||
Signature NFPMDebSignature `yaml:"signature,omitempty"`
|
||||
}
|
||||
|
||||
type NFPMAPKScripts struct {
|
||||
@ -426,9 +423,6 @@ type NFPMOverridables struct {
|
||||
Replaces []string `yaml:",omitempty"`
|
||||
EmptyFolders []string `yaml:"empty_folders,omitempty"`
|
||||
Contents files.Contents `yaml:"contents,omitempty"`
|
||||
Files map[string]string `yaml:",omitempty"` // deprecated: use contents instead
|
||||
ConfigFiles map[string]string `yaml:"config_files,omitempty"` // deprecated: use contents instead
|
||||
Symlinks map[string]string `yaml:"symlinks,omitempty"` // deprecated: use contents instead
|
||||
Scripts NFPMScripts `yaml:"scripts,omitempty"`
|
||||
RPM NFPMRPM `yaml:"rpm,omitempty"`
|
||||
Deb NFPMDeb `yaml:"deb,omitempty"`
|
||||
|
@ -112,6 +112,33 @@ Change this:
|
||||
ids: ['foo']
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Template for new deprecations:
|
||||
|
||||
### property
|
||||
|
||||
> since yyyy-mm-dd
|
||||
|
||||
Description.
|
||||
|
||||
=== "Before"
|
||||
|
||||
``` yaml
|
||||
foo: bar
|
||||
```
|
||||
|
||||
=== "After"
|
||||
``` yaml
|
||||
foo: bar
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
## Expired deprecation notices
|
||||
|
||||
The following options were deprecated in the past and were already removed.
|
||||
|
||||
### nfpms.files
|
||||
|
||||
> since 2020-12-21 (v0.149.0)
|
||||
@ -268,33 +295,6 @@ Change this:
|
||||
version_metadata: beta1
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Template for new deprecations:
|
||||
|
||||
### property
|
||||
|
||||
> since yyyy-mm-dd
|
||||
|
||||
Description.
|
||||
|
||||
=== "Before"
|
||||
|
||||
``` yaml
|
||||
foo: bar
|
||||
```
|
||||
|
||||
=== "After"
|
||||
``` yaml
|
||||
foo: bar
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
## Expired deprecation notices
|
||||
|
||||
The following options were deprecated in the past and were already removed.
|
||||
|
||||
### brews.github
|
||||
|
||||
> since 2020-07-06 (v0.139.0), removed 2021-01-04 (v0.152.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user