mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-01 13:07:49 +02:00
feat: remove deprecated rlcp options (#4076)
removing another deprecated option --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
70d5e1e42e
commit
eadd377730
@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
// Eval evaluates the given list of files to their final form.
|
||||
func Eval(template *tmpl.Template, rlcp bool, files []config.File) ([]config.File, error) {
|
||||
func Eval(template *tmpl.Template, files []config.File) ([]config.File, error) {
|
||||
var result []config.File
|
||||
for _, f := range files {
|
||||
glob, err := template.Apply(f.Source)
|
||||
@ -50,7 +50,7 @@ func Eval(template *tmpl.Template, rlcp bool, files []config.File) ([]config.Fil
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
dst, err := destinationFor(f, prefix, file, rlcp)
|
||||
dst, err := destinationFor(f, prefix, file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -113,12 +113,12 @@ func unique(in []config.File) []config.File {
|
||||
return result
|
||||
}
|
||||
|
||||
func destinationFor(f config.File, prefix, path string, rlcp bool) (string, error) {
|
||||
func destinationFor(f config.File, prefix, path string) (string, error) {
|
||||
if f.StripParent {
|
||||
return filepath.Join(f.Destination, filepath.Base(path)), nil
|
||||
}
|
||||
|
||||
if rlcp && f.Destination != "" {
|
||||
if f.Destination != "" {
|
||||
relpath, err := filepath.Rel(prefix, path)
|
||||
if err != nil {
|
||||
// since prefix is a prefix of src a relative path should always be found
|
||||
|
@ -20,7 +20,7 @@ func TestEval(t *testing.T) {
|
||||
tmpl := tmpl.New(ctx)
|
||||
|
||||
t.Run("invalid glob", func(t *testing.T) {
|
||||
_, err := Eval(tmpl, false, []config.File{
|
||||
_, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "../testdata/**/nope.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
@ -30,23 +30,23 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("templated src", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{
|
||||
result, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "./testdata/**/{{ .Env.FOLDER }}.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar/",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []config.File{
|
||||
{
|
||||
Source: "testdata/a/b/c/d.txt",
|
||||
Destination: "var/foobar/d.txt/testdata/a/b/c/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
},
|
||||
}, result)
|
||||
})
|
||||
|
||||
t.Run("templated src error", func(t *testing.T) {
|
||||
_, err := Eval(tmpl, false, []config.File{
|
||||
_, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "./testdata/**/{{ .Env.NOPE }}.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
@ -56,10 +56,10 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("templated info", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{
|
||||
result, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "./testdata/**/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar/",
|
||||
Info: config.FileInfo{
|
||||
MTime: "{{.CommitDate}}",
|
||||
Owner: "{{ .Env.OWNER }}",
|
||||
@ -72,7 +72,7 @@ func TestEval(t *testing.T) {
|
||||
require.Equal(t, []config.File{
|
||||
{
|
||||
Source: "testdata/a/b/c/d.txt",
|
||||
Destination: "var/foobar/d.txt/testdata/a/b/c/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Info: config.FileInfo{
|
||||
MTime: now.UTC().Format(time.RFC3339),
|
||||
ParsedMTime: now.UTC(),
|
||||
@ -85,9 +85,9 @@ func TestEval(t *testing.T) {
|
||||
|
||||
t.Run("template info errors", func(t *testing.T) {
|
||||
t.Run("owner", func(t *testing.T) {
|
||||
_, err := Eval(tmpl, false, []config.File{{
|
||||
_, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/**/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar",
|
||||
Info: config.FileInfo{
|
||||
Owner: "{{ .Env.NOPE }}",
|
||||
},
|
||||
@ -95,9 +95,9 @@ func TestEval(t *testing.T) {
|
||||
testlib.RequireTemplateError(t, err)
|
||||
})
|
||||
t.Run("group", func(t *testing.T) {
|
||||
_, err := Eval(tmpl, false, []config.File{{
|
||||
_, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/**/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar",
|
||||
Info: config.FileInfo{
|
||||
Group: "{{ .Env.NOPE }}",
|
||||
},
|
||||
@ -105,9 +105,9 @@ func TestEval(t *testing.T) {
|
||||
testlib.RequireTemplateError(t, err)
|
||||
})
|
||||
t.Run("mtime", func(t *testing.T) {
|
||||
_, err := Eval(tmpl, false, []config.File{{
|
||||
_, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/**/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar",
|
||||
Info: config.FileInfo{
|
||||
MTime: "{{ .Env.NOPE }}",
|
||||
},
|
||||
@ -115,9 +115,9 @@ func TestEval(t *testing.T) {
|
||||
testlib.RequireTemplateError(t, err)
|
||||
})
|
||||
t.Run("mtime format", func(t *testing.T) {
|
||||
_, err := Eval(tmpl, false, []config.File{{
|
||||
_, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/**/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar",
|
||||
Info: config.FileInfo{
|
||||
MTime: "2005-123-123",
|
||||
},
|
||||
@ -127,10 +127,10 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("single file", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{
|
||||
result, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "./testdata/**/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
Destination: "var/foobar",
|
||||
},
|
||||
})
|
||||
|
||||
@ -138,13 +138,13 @@ func TestEval(t *testing.T) {
|
||||
require.Equal(t, []config.File{
|
||||
{
|
||||
Source: "testdata/a/b/c/d.txt",
|
||||
Destination: "var/foobar/d.txt/testdata/a/b/c/d.txt",
|
||||
Destination: "var/foobar/d.txt",
|
||||
},
|
||||
}, result)
|
||||
})
|
||||
|
||||
t.Run("rlcp", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, true, []config.File{{
|
||||
result, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/a/**/*",
|
||||
Destination: "foo/bar",
|
||||
}})
|
||||
@ -157,7 +157,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("rlcp empty destination", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, true, []config.File{{
|
||||
result, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/a/**/*",
|
||||
}})
|
||||
|
||||
@ -169,7 +169,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("rlcp no results", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, true, []config.File{{
|
||||
result, err := Eval(tmpl, []config.File{{
|
||||
Source: "./testdata/abc/**/*",
|
||||
Destination: "foo/bar",
|
||||
}})
|
||||
@ -179,7 +179,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("strip parent plays nicely with destination omitted", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{{Source: "./testdata/a/b", StripParent: true}})
|
||||
result, err := Eval(tmpl, []config.File{{Source: "./testdata/a/b", StripParent: true}})
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []config.File{
|
||||
@ -189,7 +189,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("strip parent plays nicely with destination as an empty string", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{{Source: "./testdata/a/b", Destination: "", StripParent: true}})
|
||||
result, err := Eval(tmpl, []config.File{{Source: "./testdata/a/b", Destination: "", StripParent: true}})
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []config.File{
|
||||
@ -199,7 +199,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("match multiple files within tree without destination", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{{Source: "./testdata/a"}})
|
||||
result, err := Eval(tmpl, []config.File{{Source: "./testdata/a"}})
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []config.File{
|
||||
@ -210,7 +210,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("match multiple files within tree specific destination", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{
|
||||
result, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "./testdata/a",
|
||||
Destination: "usr/local/test",
|
||||
@ -227,7 +227,7 @@ func TestEval(t *testing.T) {
|
||||
require.Equal(t, []config.File{
|
||||
{
|
||||
Source: "testdata/a/a.txt",
|
||||
Destination: "usr/local/test/testdata/a/a.txt",
|
||||
Destination: "usr/local/test/a.txt",
|
||||
Info: config.FileInfo{
|
||||
Owner: "carlos",
|
||||
Group: "users",
|
||||
@ -237,7 +237,7 @@ func TestEval(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Source: "testdata/a/b/a.txt",
|
||||
Destination: "usr/local/test/testdata/a/b/a.txt",
|
||||
Destination: "usr/local/test/b/a.txt",
|
||||
Info: config.FileInfo{
|
||||
Owner: "carlos",
|
||||
Group: "users",
|
||||
@ -247,7 +247,7 @@ func TestEval(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Source: "testdata/a/b/c/d.txt",
|
||||
Destination: "usr/local/test/testdata/a/b/c/d.txt",
|
||||
Destination: "usr/local/test/b/c/d.txt",
|
||||
Info: config.FileInfo{
|
||||
Owner: "carlos",
|
||||
Group: "users",
|
||||
@ -259,7 +259,7 @@ func TestEval(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("match multiple files within tree specific destination stripping parents", func(t *testing.T) {
|
||||
result, err := Eval(tmpl, false, []config.File{
|
||||
result, err := Eval(tmpl, []config.File{
|
||||
{
|
||||
Source: "./testdata/a",
|
||||
Destination: "usr/local/test",
|
||||
|
@ -59,8 +59,8 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if archive.ID == "" {
|
||||
archive.ID = "default"
|
||||
}
|
||||
if !archive.RLCP && archive.Format != "binary" && len(archive.Files) > 0 {
|
||||
deprecate.NoticeCustom(ctx, "archives.rlcp", "`{{ .Property }}` will be the default soon, check {{ .URL }} for more info")
|
||||
if archive.RLCP != "" && archive.Format != "binary" && len(archive.Files) > 0 {
|
||||
deprecate.Notice(ctx, "archives.rlcp")
|
||||
}
|
||||
if len(archive.Files) == 0 {
|
||||
archive.Files = []config.File{
|
||||
@ -187,7 +187,7 @@ func doCreate(ctx *context.Context, arch config.Archive, binaries []*artifact.Ar
|
||||
a = NewEnhancedArchive(a, wrap)
|
||||
defer a.Close()
|
||||
|
||||
files, err := archivefiles.Eval(template, arch.RLCP, arch.Files)
|
||||
files, err := archivefiles.Eval(template, arch.Files)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to find files to archive: %w", err)
|
||||
}
|
||||
|
@ -718,7 +718,6 @@ func TestDefault(t *testing.T) {
|
||||
require.NotEmpty(t, ctx.Config.Archives[0].NameTemplate)
|
||||
require.Equal(t, "tar.gz", ctx.Config.Archives[0].Format)
|
||||
require.NotEmpty(t, ctx.Config.Archives[0].Files)
|
||||
require.False(t, ctx.Config.Archives[0].RLCP)
|
||||
}
|
||||
|
||||
func TestDefaultSet(t *testing.T) {
|
||||
@ -737,7 +736,6 @@ func TestDefaultSet(t *testing.T) {
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.Equal(t, "foo", ctx.Config.Archives[0].NameTemplate)
|
||||
require.Equal(t, "zip", ctx.Config.Archives[0].Format)
|
||||
require.False(t, ctx.Config.Archives[0].RLCP)
|
||||
require.Equal(t, config.File{Source: "foo"}, ctx.Config.Archives[0].Files[0])
|
||||
}
|
||||
|
||||
@ -751,7 +749,6 @@ func TestDefaultNoFiles(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.Equal(t, defaultNameTemplate, ctx.Config.Archives[0].NameTemplate)
|
||||
require.False(t, ctx.Config.Archives[0].RLCP)
|
||||
}
|
||||
|
||||
func TestDefaultFormatBinary(t *testing.T) {
|
||||
@ -764,7 +761,6 @@ func TestDefaultFormatBinary(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.Equal(t, defaultBinaryNameTemplate, ctx.Config.Archives[0].NameTemplate)
|
||||
require.False(t, ctx.Config.Archives[0].RLCP)
|
||||
}
|
||||
|
||||
func TestFormatFor(t *testing.T) {
|
||||
|
@ -103,11 +103,7 @@ func appendExtraFilesToArchive(ctx *context.Context, prefix, path, format string
|
||||
return err
|
||||
}
|
||||
|
||||
files, err := archivefiles.Eval(
|
||||
tmpl.New(ctx),
|
||||
ctx.Config.Source.RLCP,
|
||||
ctx.Config.Source.Files,
|
||||
)
|
||||
files, err := archivefiles.Eval(tmpl.New(ctx), ctx.Config.Source.Files)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -138,8 +134,8 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
archive.NameTemplate = "{{ .ProjectName }}-{{ .Version }}"
|
||||
}
|
||||
|
||||
if archive.Enabled && !archive.RLCP {
|
||||
deprecate.NoticeCustom(ctx, "source.rlcp", "`{{ .Property }}` will be the default soon, check {{ .URL }} for more info")
|
||||
if archive.Enabled && archive.RLCP != "" {
|
||||
deprecate.Notice(ctx, "source.rlcp")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ type Archive struct {
|
||||
FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty" json:"format_overrides,omitempty"`
|
||||
WrapInDirectory string `yaml:"wrap_in_directory,omitempty" json:"wrap_in_directory,omitempty" jsonschema:"oneof_type=string;boolean"`
|
||||
StripParentBinaryFolder bool `yaml:"strip_parent_binary_folder,omitempty" json:"strip_parent_binary_folder,omitempty"`
|
||||
RLCP bool `yaml:"rlcp,omitempty" json:"rlcp,omitempty"`
|
||||
RLCP string `yaml:"rlcp,omitempty" json:"rlcp,omitempty" jsonschema:"oneof_type=string;boolean"` // Deprecated
|
||||
Files []File `yaml:"files,omitempty" json:"files,omitempty"`
|
||||
Meta bool `yaml:"meta,omitempty" json:"meta,omitempty"`
|
||||
AllowDifferentBinaryCount bool `yaml:"allow_different_binary_count,omitempty" json:"allow_different_binary_count,omitempty"`
|
||||
@ -1018,7 +1018,7 @@ type Source struct {
|
||||
Enabled bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
|
||||
PrefixTemplate string `yaml:"prefix_template,omitempty" json:"prefix_template,omitempty"`
|
||||
Files []File `yaml:"files,omitempty" json:"files,omitempty"`
|
||||
RLCP bool `yaml:"rlcp,omitempty" json:"rlcp,omitempty"`
|
||||
RLCP string `yaml:"rlcp,omitempty" json:"rlcp,omitempty" jsonschema:"oneof_type=string;boolean"` // Deprecated
|
||||
}
|
||||
|
||||
// Project includes all project configuration.
|
||||
|
@ -37,6 +37,24 @@ Description.
|
||||
|
||||
-->
|
||||
|
||||
### archives.rlcp
|
||||
|
||||
> since 2023-06-06 (v1.19.0)
|
||||
|
||||
This option is now default and can't be changed. You can remove it from your
|
||||
configuration files.
|
||||
|
||||
See [this](#archivesrlcp_1) for more info.
|
||||
|
||||
### source.rlcp
|
||||
|
||||
> since 2023-06-06 (v1.19.0)
|
||||
|
||||
This option is now default and can't be changed. You can remove it from your
|
||||
configuration files.
|
||||
|
||||
See [this](#sourcerlcp_1) for more info.
|
||||
|
||||
### brews.plist
|
||||
|
||||
> since 2023-06-06 (v1.19.0)
|
||||
@ -148,9 +166,33 @@ Simply use the pluralized form, `builds`, according to the
|
||||
goreleaser release --clean
|
||||
```
|
||||
|
||||
### nfpms.maintainer
|
||||
|
||||
> since 2022-05-07 (v1.9.0)
|
||||
|
||||
nFPM will soon make mandatory setting the maintainer field.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
nfpms:
|
||||
- maintainer: ''
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
nfpms:
|
||||
- maintainer: 'Name <email>'
|
||||
```
|
||||
|
||||
## Expired deprecation notices
|
||||
|
||||
The following options were deprecated in the past and were already removed.
|
||||
|
||||
### archives.rlcp
|
||||
|
||||
> since 2022-12-23 (v1.14.0)
|
||||
> since 2022-12-23 (v1.14.0), removed 2023-06-06 (v1.19.0)
|
||||
|
||||
This is not so much a deprecation property (yet), as it is a default behavior
|
||||
change.
|
||||
@ -179,7 +221,7 @@ enable this option and test it out with
|
||||
|
||||
### source.rlcp
|
||||
|
||||
> since 2022-12-23 (v1.14.0)
|
||||
> since 2022-12-23 (v1.14.0), removed 2023-06-06 (v1.19.0)
|
||||
|
||||
Same as [`archives.rlcp`](#archivesrlcp).
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user