mirror of
https://github.com/goreleaser/nfpm
synced 2024-06-14 02:38:04 +02:00
feat: remove deprecated options (#267)
* feat: remove deprecated options Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fixing Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: configs Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: tempdir Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: fmt Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * feat: go 1.15 Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fix Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fix Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fix Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * refactor: test Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: lint Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: import Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: test Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: symlink Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
df152db001
commit
19817233b5
|
@ -42,7 +42,7 @@ jobs:
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.14
|
go-version: 1.15
|
||||||
-
|
-
|
||||||
name: Cache Go modules
|
name: Cache Go modules
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
|
|
|
@ -10,7 +10,7 @@ conduct](/CODE_OF_CONDUCT.md).
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
|
||||||
* `make`
|
* `make`
|
||||||
* [Go 1.14+](https://golang.org/doc/install)
|
* [Go 1.15+](https://golang.org/doc/install)
|
||||||
|
|
||||||
Clone `nfpm` from source:
|
Clone `nfpm` from source:
|
||||||
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -17,7 +17,7 @@ setup:
|
||||||
|
|
||||||
|
|
||||||
pull_test_imgs:
|
pull_test_imgs:
|
||||||
grep FROM ./acceptance/testdata/*.dockerfile | cut -f2 -d' ' | sort | uniq | while read -r img; do docker pull "$$img"; done
|
grep FROM ./testdata/acceptance/*.dockerfile | cut -f2 -d' ' | sort | uniq | while read -r img; do docker pull "$$img"; done
|
||||||
.PHONY: pull_test_imgs
|
.PHONY: pull_test_imgs
|
||||||
|
|
||||||
acceptance: pull_test_imgs
|
acceptance: pull_test_imgs
|
||||||
|
|
|
@ -100,7 +100,7 @@ func TestConfigNoReplace(t *testing.T) {
|
||||||
info.Target = target
|
info.Target = target
|
||||||
require.NoError(t, pkg.Package(nfpm.WithDefaults(info), f))
|
require.NoError(t, pkg.Package(nfpm.WithDefaults(info), f))
|
||||||
|
|
||||||
t.Run("noreplace-rpm", func(t *testing.T) {
|
t.Run("rpm", func(t *testing.T) {
|
||||||
accept(t, acceptParms{
|
accept(t, acceptParms{
|
||||||
Name: "noreplace_rpm",
|
Name: "noreplace_rpm",
|
||||||
Conf: "config-noreplace.yaml",
|
Conf: "config-noreplace.yaml",
|
||||||
|
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/goreleaser/nfpm"
|
"github.com/goreleaser/nfpm"
|
||||||
|
"github.com/goreleaser/nfpm/files"
|
||||||
"github.com/goreleaser/nfpm/internal/sign"
|
"github.com/goreleaser/nfpm/internal/sign"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -60,12 +61,20 @@ func exampleInfo() *nfpm.Info {
|
||||||
"zsh",
|
"zsh",
|
||||||
"foobarsh",
|
"foobarsh",
|
||||||
},
|
},
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/fake": "/usr/local/bin/fake",
|
{
|
||||||
"../testdata/whatever.conf": "/usr/share/doc/fake/fake.txt",
|
Source: "../testdata/fake",
|
||||||
},
|
Destination: "/usr/local/bin/fake",
|
||||||
ConfigFiles: map[string]string{
|
},
|
||||||
"../testdata/whatever.conf": "/etc/fake/fake.conf",
|
{
|
||||||
|
Source: "../testdata/whatever.conf",
|
||||||
|
Destination: "/usr/share/doc/fake/fake.txt",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Source: "../testdata/whatever.conf",
|
||||||
|
Destination: "/etc/fake/fake.conf",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
EmptyFolders: []string{
|
EmptyFolders: []string{
|
||||||
"/var/log/whatever",
|
"/var/log/whatever",
|
||||||
|
@ -169,11 +178,16 @@ func TestFileDoesNotExist(t *testing.T) {
|
||||||
Depends: []string{
|
Depends: []string{
|
||||||
"bash",
|
"bash",
|
||||||
},
|
},
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/fake": "/usr/local/bin/fake",
|
{
|
||||||
},
|
Source: "../testdata/fake",
|
||||||
ConfigFiles: map[string]string{
|
Destination: "/usr/local/bin/fake",
|
||||||
"../testdata/whatever.confzzz": "/etc/fake/fake.conf",
|
},
|
||||||
|
{
|
||||||
|
Source: "../testdata/whatever.confzzz",
|
||||||
|
Destination: "/etc/fake/fake.conf",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -320,8 +334,11 @@ func TestSignatureError(t *testing.T) {
|
||||||
func TestDisableGlobbing(t *testing.T) {
|
func TestDisableGlobbing(t *testing.T) {
|
||||||
info := exampleInfo()
|
info := exampleInfo()
|
||||||
info.DisableGlobbing = true
|
info.DisableGlobbing = true
|
||||||
info.Files = map[string]string{
|
info.Contents = []*files.Content{
|
||||||
"../testdata/{file}[": "/test/{file}[",
|
{
|
||||||
|
Source: "../testdata/{file}[",
|
||||||
|
Destination: "/test/{file}[",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
err := info.Validate()
|
err := info.Validate()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -404,9 +421,12 @@ func TestAPKConventionalFileName(t *testing.T) {
|
||||||
|
|
||||||
func TestPackageSymlinks(t *testing.T) {
|
func TestPackageSymlinks(t *testing.T) {
|
||||||
info := exampleInfo()
|
info := exampleInfo()
|
||||||
info.Files = map[string]string{}
|
info.Contents = []*files.Content{
|
||||||
info.Symlinks = map[string]string{
|
{
|
||||||
"../testdata/fake": "fake",
|
Source: "../testdata/fake",
|
||||||
|
Destination: "fake",
|
||||||
|
Type: "symlink",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
assert.NoError(t, Default.Package(info, ioutil.Discard))
|
assert.NoError(t, Default.Package(info, ioutil.Discard))
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,13 +162,17 @@ vendor: "FooBarCorp"
|
||||||
homepage: "http://example.com"
|
homepage: "http://example.com"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
changelog: "changelog.yaml"
|
changelog: "changelog.yaml"
|
||||||
files:
|
contents:
|
||||||
./foo: "/usr/local/bin/foo"
|
- src: ./foo
|
||||||
./bar: "/usr/local/bin/bar"
|
dst: /usr/local/bin/foo
|
||||||
config_files:
|
- src: ./bar
|
||||||
./foobar.conf: "/etc/foobar.conf"
|
dst: /usr/local/bin/bar
|
||||||
symlinks:
|
- src: ./foobar.conf
|
||||||
/sbin/foo: "/usr/local/bin/foo"
|
dst: /etc/foobar.conf
|
||||||
|
type: config
|
||||||
|
- src: /usr/local/bin/foo
|
||||||
|
dst: /sbin/foo
|
||||||
|
type: symlink
|
||||||
overrides:
|
overrides:
|
||||||
rpm:
|
rpm:
|
||||||
scripts:
|
scripts:
|
||||||
|
|
108
deb/deb_test.go
108
deb/deb_test.go
|
@ -61,12 +61,20 @@ func exampleInfo() *nfpm.Info {
|
||||||
Conflicts: []string{
|
Conflicts: []string{
|
||||||
"zsh",
|
"zsh",
|
||||||
},
|
},
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/fake": "/usr/local/bin/fake",
|
{
|
||||||
"../testdata/whatever.conf": "/usr/share/doc/fake/fake.txt",
|
Source: "../testdata/fake",
|
||||||
},
|
Destination: "/usr/local/bin/fake",
|
||||||
ConfigFiles: map[string]string{
|
},
|
||||||
"../testdata/whatever.conf": "/etc/fake/fake.conf",
|
{
|
||||||
|
Source: "../testdata/whatever.conf",
|
||||||
|
Destination: "/usr/share/doc/fake/fake.txt",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Source: "../testdata/whatever.conf",
|
||||||
|
Destination: "/etc/fake/fake.conf",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
EmptyFolders: []string{
|
EmptyFolders: []string{
|
||||||
"/var/log/whatever",
|
"/var/log/whatever",
|
||||||
|
@ -230,14 +238,13 @@ func TestNoJoinsControl(t *testing.T) {
|
||||||
Homepage: "http://carlosbecker.com",
|
Homepage: "http://carlosbecker.com",
|
||||||
Vendor: "nope",
|
Vendor: "nope",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
Depends: []string{},
|
Depends: []string{},
|
||||||
Recommends: []string{},
|
Recommends: []string{},
|
||||||
Suggests: []string{},
|
Suggests: []string{},
|
||||||
Replaces: []string{},
|
Replaces: []string{},
|
||||||
Provides: []string{},
|
Provides: []string{},
|
||||||
Conflicts: []string{},
|
Conflicts: []string{},
|
||||||
Files: map[string]string{},
|
Contents: []*files.Content{},
|
||||||
ConfigFiles: map[string]string{},
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
InstalledSize: 10,
|
InstalledSize: 10,
|
||||||
|
@ -267,11 +274,16 @@ func TestDebFileDoesNotExist(t *testing.T) {
|
||||||
Depends: []string{
|
Depends: []string{
|
||||||
"bash",
|
"bash",
|
||||||
},
|
},
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/fake": "/usr/local/bin/fake",
|
{
|
||||||
},
|
Source: "../testdata/fake",
|
||||||
ConfigFiles: map[string]string{
|
Destination: "/usr/local/bin/fake",
|
||||||
"../testdata/whatever.confzzz": "/etc/fake/fake.conf",
|
},
|
||||||
|
{
|
||||||
|
Source: "../testdata/whatever.confzzz",
|
||||||
|
Destination: "/etc/fake/fake.conf",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -317,8 +329,12 @@ func TestConffiles(t *testing.T) {
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Section: "default",
|
Section: "default",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
ConfigFiles: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/fake": "/etc/fake",
|
{
|
||||||
|
Source: "../testdata/fake",
|
||||||
|
Destination: "/etc/fake",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -636,8 +652,11 @@ func TestSymlinkInFiles(t *testing.T) {
|
||||||
Description: "This package's config references a file via symlink.",
|
Description: "This package's config references a file via symlink.",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
symlinkTo(t, symlinkTarget): packagedTarget,
|
{
|
||||||
|
Source: symlinkTo(t, symlinkTarget),
|
||||||
|
Destination: packagedTarget,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -669,11 +688,16 @@ func TestSymlink(t *testing.T) {
|
||||||
Description: "This package's config references a file via symlink.",
|
Description: "This package's config references a file via symlink.",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/whatever.conf": configFilePath,
|
{
|
||||||
},
|
Source: "../testdata/whatever.conf",
|
||||||
Symlinks: map[string]string{
|
Destination: configFilePath,
|
||||||
symlink: symlinkTarget,
|
},
|
||||||
|
{
|
||||||
|
Source: symlinkTarget,
|
||||||
|
Destination: symlink,
|
||||||
|
Type: "symlink",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -693,8 +717,12 @@ func TestSymlink(t *testing.T) {
|
||||||
|
|
||||||
func TestEnsureRelativePrefixInTarGzFiles(t *testing.T) {
|
func TestEnsureRelativePrefixInTarGzFiles(t *testing.T) {
|
||||||
info := exampleInfo()
|
info := exampleInfo()
|
||||||
info.Symlinks = map[string]string{
|
info.Contents = []*files.Content{
|
||||||
"/symlink/to/fake.txt": "/usr/share/doc/fake/fake.txt",
|
{
|
||||||
|
Source: "/symlink/to/fake.txt",
|
||||||
|
Destination: "/usr/share/doc/fake/fake.txt",
|
||||||
|
Type: "symlink",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
info.Changelog = "../testdata/changelog.yaml"
|
info.Changelog = "../testdata/changelog.yaml"
|
||||||
err := info.Validate()
|
err := info.Validate()
|
||||||
|
@ -809,11 +837,13 @@ func TestDebsigsSignatureError(t *testing.T) {
|
||||||
func TestDisableGlobbing(t *testing.T) {
|
func TestDisableGlobbing(t *testing.T) {
|
||||||
info := exampleInfo()
|
info := exampleInfo()
|
||||||
info.DisableGlobbing = true
|
info.DisableGlobbing = true
|
||||||
info.Files = map[string]string{
|
info.Contents = []*files.Content{
|
||||||
"../testdata/{file}[": "/test/{file}[",
|
{
|
||||||
|
Source: "../testdata/{file}[",
|
||||||
|
Destination: "/test/{file}[",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
err := info.Validate()
|
require.NoError(t, info.Validate())
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
dataTarGz, _, _, err := createDataTarGz(info)
|
dataTarGz, _, _, err := createDataTarGz(info)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -928,18 +958,10 @@ func symlinkTo(tb testing.TB, fileName string) string {
|
||||||
target, err := filepath.Abs(fileName)
|
target, err := filepath.Abs(fileName)
|
||||||
assert.NoError(tb, err)
|
assert.NoError(tb, err)
|
||||||
|
|
||||||
tempDir, err := ioutil.TempDir("", "nfpm_deb_test")
|
symlinkName := filepath.Join(tb.TempDir(), "symlink")
|
||||||
assert.NoError(tb, err)
|
|
||||||
|
|
||||||
symlinkName := filepath.Join(tempDir, "symlink")
|
|
||||||
err = os.Symlink(target, symlinkName)
|
err = os.Symlink(target, symlinkName)
|
||||||
assert.NoError(tb, err)
|
assert.NoError(tb, err)
|
||||||
|
|
||||||
tb.Cleanup(func() {
|
|
||||||
err = os.RemoveAll(tempDir)
|
|
||||||
assert.NoError(tb, err)
|
|
||||||
})
|
|
||||||
|
|
||||||
return files.ToNixPath(symlinkName)
|
return files.ToNixPath(symlinkName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
go.mod
3
go.mod
|
@ -1,6 +1,6 @@
|
||||||
module github.com/goreleaser/nfpm
|
module github.com/goreleaser/nfpm
|
||||||
|
|
||||||
go 1.14
|
go 1.15
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Djarvur/go-err113 v0.1.0 // indirect
|
github.com/Djarvur/go-err113 v0.1.0 // indirect
|
||||||
|
@ -28,6 +28,7 @@ require (
|
||||||
github.com/quasilyte/go-ruleguard v0.2.1 // indirect
|
github.com/quasilyte/go-ruleguard v0.2.1 // indirect
|
||||||
github.com/quasilyte/regex/syntax v0.0.0-20200805063351-8f842688393c // indirect
|
github.com/quasilyte/regex/syntax v0.0.0-20200805063351-8f842688393c // indirect
|
||||||
github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b
|
github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b
|
||||||
|
github.com/smartystreets/assertions v1.0.0 // indirect
|
||||||
github.com/spf13/afero v1.5.1 // indirect
|
github.com/spf13/afero v1.5.1 // indirect
|
||||||
github.com/stretchr/objx v0.3.0 // indirect
|
github.com/stretchr/objx v0.3.0 // indirect
|
||||||
github.com/stretchr/testify v1.6.1
|
github.com/stretchr/testify v1.6.1
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -452,6 +452,8 @@ github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM
|
||||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8=
|
||||||
|
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
|
|
102
nfpm.go
102
nfpm.go
|
@ -128,13 +128,16 @@ func (c *Config) Get(format string) (info *Info, err error) {
|
||||||
// no overrides
|
// no overrides
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
if !override.hasResetFiles {
|
|
||||||
override.resetFiles(format)
|
|
||||||
c.Contents = append(c.Contents, override.Contents...)
|
|
||||||
}
|
|
||||||
if err = mergo.Merge(&info.Overridables, override, mergo.WithOverride); err != nil {
|
if err = mergo.Merge(&info.Overridables, override, mergo.WithOverride); err != nil {
|
||||||
return nil, fmt.Errorf("failed to merge overrides into info: %w", err)
|
return nil, fmt.Errorf("failed to merge overrides into info: %w", err)
|
||||||
}
|
}
|
||||||
|
var contents []*files.Content
|
||||||
|
for _, f := range info.Contents {
|
||||||
|
if f.Packager == format || f.Packager == "" {
|
||||||
|
contents = append(contents, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info.Contents = contents
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +179,6 @@ type Info struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Info) Validate() error {
|
func (i *Info) Validate() error {
|
||||||
i.resetFiles("")
|
|
||||||
return Validate(i)
|
return Validate(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,84 +203,26 @@ func (i *Info) GetChangeLog() (log *chglog.PackageChangeLog, err error) {
|
||||||
|
|
||||||
// Overridables contain the field which are overridable in a package.
|
// Overridables contain the field which are overridable in a package.
|
||||||
type Overridables struct {
|
type Overridables struct {
|
||||||
Replaces []string `yaml:"replaces,omitempty"`
|
Replaces []string `yaml:"replaces,omitempty"`
|
||||||
Provides []string `yaml:"provides,omitempty"`
|
Provides []string `yaml:"provides,omitempty"`
|
||||||
Depends []string `yaml:"depends,omitempty"`
|
Depends []string `yaml:"depends,omitempty"`
|
||||||
Recommends []string `yaml:"recommends,omitempty"`
|
Recommends []string `yaml:"recommends,omitempty"`
|
||||||
Suggests []string `yaml:"suggests,omitempty"`
|
Suggests []string `yaml:"suggests,omitempty"`
|
||||||
Conflicts []string `yaml:"conflicts,omitempty"`
|
Conflicts []string `yaml:"conflicts,omitempty"`
|
||||||
Contents files.Contents `yaml:"contents,omitempty"`
|
Contents files.Contents `yaml:"contents,omitempty"`
|
||||||
Files map[string]string `yaml:"files,omitempty"`
|
EmptyFolders []string `yaml:"empty_folders,omitempty"`
|
||||||
ConfigFiles map[string]string `yaml:"config_files,omitempty"`
|
Scripts Scripts `yaml:"scripts,omitempty"`
|
||||||
Symlinks map[string]string `yaml:"symlinks,omitempty"`
|
RPM RPM `yaml:"rpm,omitempty"`
|
||||||
EmptyFolders []string `yaml:"empty_folders,omitempty"`
|
Deb Deb `yaml:"deb,omitempty"`
|
||||||
Scripts Scripts `yaml:"scripts,omitempty"`
|
APK APK `yaml:"apk,omitempty"`
|
||||||
RPM RPM `yaml:"rpm,omitempty"`
|
|
||||||
Deb Deb `yaml:"deb,omitempty"`
|
|
||||||
APK APK `yaml:"apk,omitempty"`
|
|
||||||
hasResetFiles bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *Overridables) resetFiles(packager string) {
|
|
||||||
if o.hasResetFiles {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for src, dst := range o.Files {
|
|
||||||
o.Contents = append(o.Contents, &files.Content{
|
|
||||||
Source: src,
|
|
||||||
Destination: dst,
|
|
||||||
Packager: packager,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
o.Files = nil
|
|
||||||
for src, dst := range o.ConfigFiles {
|
|
||||||
o.Contents = append(o.Contents, &files.Content{
|
|
||||||
Source: src,
|
|
||||||
Destination: dst,
|
|
||||||
Type: "config",
|
|
||||||
Packager: packager,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
o.ConfigFiles = nil
|
|
||||||
|
|
||||||
// Symlinks is backwards from other in the config file
|
|
||||||
for dst, src := range o.Symlinks {
|
|
||||||
o.Contents = append(o.Contents, &files.Content{
|
|
||||||
Source: src,
|
|
||||||
Destination: dst,
|
|
||||||
Type: "symlink",
|
|
||||||
Packager: packager,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
o.Symlinks = nil
|
|
||||||
for src, dst := range o.RPM.ConfigNoReplaceFiles {
|
|
||||||
o.Contents = append(o.Contents, &files.Content{
|
|
||||||
Source: src,
|
|
||||||
Destination: dst,
|
|
||||||
Type: "config|noreplace",
|
|
||||||
Packager: "rpm",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
o.RPM.ConfigNoReplaceFiles = nil
|
|
||||||
for _, dst := range o.RPM.GhostFiles {
|
|
||||||
o.Contents = append(o.Contents, &files.Content{
|
|
||||||
Destination: dst,
|
|
||||||
Type: "ghost",
|
|
||||||
Packager: "rpm",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
o.hasResetFiles = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RPM is custom configs that are only available on RPM packages.
|
// RPM is custom configs that are only available on RPM packages.
|
||||||
type RPM struct {
|
type RPM struct {
|
||||||
Group string `yaml:"group,omitempty"`
|
Group string `yaml:"group,omitempty"`
|
||||||
Summary string `yaml:"summary,omitempty"`
|
Summary string `yaml:"summary,omitempty"`
|
||||||
Compression string `yaml:"compression,omitempty"`
|
Compression string `yaml:"compression,omitempty"`
|
||||||
// https://www.cl.cam.ac.uk/~jw35/docs/rpm_config.html
|
Signature RPMSignature `yaml:"signature,omitempty"`
|
||||||
ConfigNoReplaceFiles map[string]string `yaml:"config_noreplace_files,omitempty"`
|
|
||||||
Signature RPMSignature `yaml:"signature,omitempty"`
|
|
||||||
GhostFiles []string `yaml:"ghost_files,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type RPMSignature struct {
|
type RPMSignature struct {
|
||||||
|
|
150
nfpm_test.go
150
nfpm_test.go
|
@ -8,10 +8,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/goreleaser/nfpm"
|
"github.com/goreleaser/nfpm"
|
||||||
|
"github.com/goreleaser/nfpm/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRegister(t *testing.T) {
|
func TestRegister(t *testing.T) {
|
||||||
|
@ -20,20 +20,20 @@ func TestRegister(t *testing.T) {
|
||||||
nfpm.RegisterPackager(format, pkgr)
|
nfpm.RegisterPackager(format, pkgr)
|
||||||
got, err := nfpm.Get(format)
|
got, err := nfpm.Get(format)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, pkgr, got)
|
require.Equal(t, pkgr, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGet(t *testing.T) {
|
func TestGet(t *testing.T) {
|
||||||
format := "TestGet"
|
format := "TestGet"
|
||||||
got, err := nfpm.Get(format)
|
got, err := nfpm.Get(format)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
assert.EqualError(t, err, "no packager registered for the format "+format)
|
require.EqualError(t, err, "no packager registered for the format "+format)
|
||||||
assert.Nil(t, got)
|
require.Nil(t, got)
|
||||||
pkgr := &fakePackager{}
|
pkgr := &fakePackager{}
|
||||||
nfpm.RegisterPackager(format, pkgr)
|
nfpm.RegisterPackager(format, pkgr)
|
||||||
got, err = nfpm.Get(format)
|
got, err = nfpm.Get(format)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, pkgr, got)
|
require.Equal(t, pkgr, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDefaultsVersion(t *testing.T) {
|
func TestDefaultsVersion(t *testing.T) {
|
||||||
|
@ -41,26 +41,26 @@ func TestDefaultsVersion(t *testing.T) {
|
||||||
Version: "v1.0.0",
|
Version: "v1.0.0",
|
||||||
}
|
}
|
||||||
info = nfpm.WithDefaults(info)
|
info = nfpm.WithDefaults(info)
|
||||||
assert.NotEmpty(t, info.Platform)
|
require.NotEmpty(t, info.Platform)
|
||||||
assert.Equal(t, "1.0.0", info.Version)
|
require.Equal(t, "1.0.0", info.Version)
|
||||||
assert.Equal(t, "", info.Release)
|
require.Equal(t, "", info.Release)
|
||||||
assert.Equal(t, "", info.Prerelease)
|
require.Equal(t, "", info.Prerelease)
|
||||||
|
|
||||||
info = &nfpm.Info{
|
info = &nfpm.Info{
|
||||||
Version: "v1.0.0-rc1",
|
Version: "v1.0.0-rc1",
|
||||||
}
|
}
|
||||||
info = nfpm.WithDefaults(info)
|
info = nfpm.WithDefaults(info)
|
||||||
assert.Equal(t, "1.0.0", info.Version)
|
require.Equal(t, "1.0.0", info.Version)
|
||||||
assert.Equal(t, "", info.Release)
|
require.Equal(t, "", info.Release)
|
||||||
assert.Equal(t, "rc1", info.Prerelease)
|
require.Equal(t, "rc1", info.Prerelease)
|
||||||
|
|
||||||
info = &nfpm.Info{
|
info = &nfpm.Info{
|
||||||
Version: "v1.0.0-beta1",
|
Version: "v1.0.0-beta1",
|
||||||
}
|
}
|
||||||
info = nfpm.WithDefaults(info)
|
info = nfpm.WithDefaults(info)
|
||||||
assert.Equal(t, "1.0.0", info.Version)
|
require.Equal(t, "1.0.0", info.Version)
|
||||||
assert.Equal(t, "", info.Release)
|
require.Equal(t, "", info.Release)
|
||||||
assert.Equal(t, "beta1", info.Prerelease)
|
require.Equal(t, "beta1", info.Prerelease)
|
||||||
|
|
||||||
info = &nfpm.Info{
|
info = &nfpm.Info{
|
||||||
Version: "v1.0.0-1",
|
Version: "v1.0.0-1",
|
||||||
|
@ -68,9 +68,9 @@ func TestDefaultsVersion(t *testing.T) {
|
||||||
Prerelease: "beta1",
|
Prerelease: "beta1",
|
||||||
}
|
}
|
||||||
info = nfpm.WithDefaults(info)
|
info = nfpm.WithDefaults(info)
|
||||||
assert.Equal(t, "1.0.0", info.Version)
|
require.Equal(t, "1.0.0", info.Version)
|
||||||
assert.Equal(t, "2", info.Release)
|
require.Equal(t, "2", info.Release)
|
||||||
assert.Equal(t, "beta1", info.Prerelease)
|
require.Equal(t, "beta1", info.Prerelease)
|
||||||
|
|
||||||
info = &nfpm.Info{
|
info = &nfpm.Info{
|
||||||
Version: "v1.0.0-1+xdg2",
|
Version: "v1.0.0-1+xdg2",
|
||||||
|
@ -78,10 +78,10 @@ func TestDefaultsVersion(t *testing.T) {
|
||||||
Prerelease: "beta1",
|
Prerelease: "beta1",
|
||||||
}
|
}
|
||||||
info = nfpm.WithDefaults(info)
|
info = nfpm.WithDefaults(info)
|
||||||
assert.Equal(t, "1.0.0", info.Version)
|
require.Equal(t, "1.0.0", info.Version)
|
||||||
assert.Equal(t, "2", info.Release)
|
require.Equal(t, "2", info.Release)
|
||||||
assert.Equal(t, "beta1", info.Prerelease)
|
require.Equal(t, "beta1", info.Prerelease)
|
||||||
assert.Equal(t, "", info.Deb.VersionMetadata)
|
require.Equal(t, "", info.Deb.VersionMetadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDefaults(t *testing.T) {
|
func TestDefaults(t *testing.T) {
|
||||||
|
@ -91,7 +91,7 @@ func TestDefaults(t *testing.T) {
|
||||||
Description: "no description given",
|
Description: "no description given",
|
||||||
}
|
}
|
||||||
got := nfpm.WithDefaults(info)
|
got := nfpm.WithDefaults(info)
|
||||||
assert.Equal(t, info, got)
|
require.Equal(t, info, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidate(t *testing.T) {
|
func TestValidate(t *testing.T) {
|
||||||
|
@ -100,8 +100,11 @@ func TestValidate(t *testing.T) {
|
||||||
Arch: "asd",
|
Arch: "asd",
|
||||||
Version: "1.2.3",
|
Version: "1.2.3",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"asa": "asd",
|
{
|
||||||
|
Source: "./testdata/contents.yaml",
|
||||||
|
Destination: "asd",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
@ -110,8 +113,12 @@ func TestValidate(t *testing.T) {
|
||||||
Arch: "asd",
|
Arch: "asd",
|
||||||
Version: "1.2.3",
|
Version: "1.2.3",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
ConfigFiles: map[string]string{
|
Contents: []*files.Content{
|
||||||
"asa": "asd",
|
{
|
||||||
|
Source: "./testdata/contents.yaml",
|
||||||
|
Destination: "asd",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
@ -149,13 +156,13 @@ func TestParseFile(t *testing.T) {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
config, err := nfpm.ParseFile("./testdata/versionenv.yaml")
|
config, err := nfpm.ParseFile("./testdata/versionenv.yaml")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, fmt.Sprintf("v%s", os.Getenv("GOROOT")), config.Version)
|
require.Equal(t, fmt.Sprintf("v%s", os.Getenv("GOROOT")), config.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseEnhancedFile(t *testing.T) {
|
func TestParseEnhancedFile(t *testing.T) {
|
||||||
config, err := nfpm.ParseFile("./testdata/contents.yaml")
|
config, err := nfpm.ParseFile("./testdata/contents.yaml")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, config.Name, "contents foo")
|
require.Equal(t, config.Name, "contents foo")
|
||||||
shouldFind := 5
|
shouldFind := 5
|
||||||
if len(config.Contents) != shouldFind {
|
if len(config.Contents) != shouldFind {
|
||||||
t.Errorf("should have had %d files but found %d", shouldFind, len(config.Contents))
|
t.Errorf("should have had %d files but found %d", shouldFind, len(config.Contents))
|
||||||
|
@ -192,7 +199,7 @@ func TestOptionsFromEnvironment(t *testing.T) {
|
||||||
os.Setenv("VERSION", version)
|
os.Setenv("VERSION", version)
|
||||||
info, err := nfpm.Parse(strings.NewReader("name: foo\nversion: $VERSION"))
|
info, err := nfpm.Parse(strings.NewReader("name: foo\nversion: $VERSION"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, version, info.Version)
|
require.Equal(t, version, info.Version)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("release", func(t *testing.T) {
|
t.Run("release", func(t *testing.T) {
|
||||||
|
@ -200,7 +207,7 @@ func TestOptionsFromEnvironment(t *testing.T) {
|
||||||
os.Setenv("RELEASE", release)
|
os.Setenv("RELEASE", release)
|
||||||
info, err := nfpm.Parse(strings.NewReader("name: foo\nrelease: $RELEASE"))
|
info, err := nfpm.Parse(strings.NewReader("name: foo\nrelease: $RELEASE"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, release, info.Release)
|
require.Equal(t, release, info.Release)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("global passphrase", func(t *testing.T) {
|
t.Run("global passphrase", func(t *testing.T) {
|
||||||
|
@ -208,9 +215,9 @@ func TestOptionsFromEnvironment(t *testing.T) {
|
||||||
os.Setenv("NFPM_PASSPHRASE", globalPass)
|
os.Setenv("NFPM_PASSPHRASE", globalPass)
|
||||||
info, err := nfpm.Parse(strings.NewReader("name: foo"))
|
info, err := nfpm.Parse(strings.NewReader("name: foo"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, globalPass, info.Deb.Signature.KeyPassphrase)
|
require.Equal(t, globalPass, info.Deb.Signature.KeyPassphrase)
|
||||||
assert.Equal(t, globalPass, info.RPM.Signature.KeyPassphrase)
|
require.Equal(t, globalPass, info.RPM.Signature.KeyPassphrase)
|
||||||
assert.Equal(t, globalPass, info.APK.Signature.KeyPassphrase)
|
require.Equal(t, globalPass, info.APK.Signature.KeyPassphrase)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("specific passphrases", func(t *testing.T) {
|
t.Run("specific passphrases", func(t *testing.T) {
|
||||||
|
@ -221,59 +228,48 @@ func TestOptionsFromEnvironment(t *testing.T) {
|
||||||
os.Setenv("NFPM_APK_PASSPHRASE", apkPass)
|
os.Setenv("NFPM_APK_PASSPHRASE", apkPass)
|
||||||
info, err := nfpm.Parse(strings.NewReader("name: foo"))
|
info, err := nfpm.Parse(strings.NewReader("name: foo"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, debPass, info.Deb.Signature.KeyPassphrase)
|
require.Equal(t, debPass, info.Deb.Signature.KeyPassphrase)
|
||||||
assert.Equal(t, rpmPass, info.RPM.Signature.KeyPassphrase)
|
require.Equal(t, rpmPass, info.RPM.Signature.KeyPassphrase)
|
||||||
assert.Equal(t, apkPass, info.APK.Signature.KeyPassphrase)
|
require.Equal(t, apkPass, info.APK.Signature.KeyPassphrase)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOverrides(t *testing.T) {
|
func TestOverrides(t *testing.T) {
|
||||||
|
nfpm.RegisterPackager("deb", &fakePackager{})
|
||||||
|
nfpm.RegisterPackager("rpm", &fakePackager{})
|
||||||
|
nfpm.RegisterPackager("apk", &fakePackager{})
|
||||||
|
|
||||||
file := "./testdata/overrides.yaml"
|
file := "./testdata/overrides.yaml"
|
||||||
config, err := nfpm.ParseFile(file)
|
config, err := nfpm.ParseFile(file)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "foo", config.Name)
|
require.Equal(t, "foo", config.Name)
|
||||||
assert.Equal(t, "amd64", config.Arch)
|
require.Equal(t, "amd64", config.Arch)
|
||||||
|
|
||||||
// deb overrides
|
for _, format := range []string{"apk", "deb", "rpm"} {
|
||||||
deb, err := config.Get("deb")
|
format := format
|
||||||
require.NoError(t, err)
|
t.Run(format, func(t *testing.T) {
|
||||||
assert.Contains(t, deb.Depends, "deb_depend")
|
pkg, err := config.Get(format)
|
||||||
assert.NotContains(t, deb.Depends, "rpm_depend")
|
require.NoError(t, err)
|
||||||
for _, f := range deb.Contents {
|
require.Equal(t, pkg.Depends, []string{format + "_depend"})
|
||||||
fmt.Printf("%+#v\n", f)
|
for _, f := range pkg.Contents {
|
||||||
assert.True(t, f.Packager != "rpm")
|
switch f.Packager {
|
||||||
assert.True(t, f.Packager != "apk")
|
case format:
|
||||||
if f.Packager == "deb" {
|
require.Contains(t, f.Destination, "/"+format)
|
||||||
assert.Contains(t, f.Destination, "/deb")
|
case "":
|
||||||
}
|
require.True(t, f.Destination == "/etc/foo/whatever.conf")
|
||||||
if f.Packager == "" {
|
default:
|
||||||
assert.True(t, f.Destination == "/etc/foo/whatever.conf")
|
t.Fatalf("invalid packager: %s", f.Packager)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
require.Equal(t, "amd64", pkg.Arch)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
assert.Equal(t, "amd64", deb.Arch)
|
|
||||||
|
|
||||||
// rpm overrides
|
t.Run("no_overrides", func(t *testing.T) {
|
||||||
rpm, err := config.Get("rpm")
|
info, err := config.Get("doesnotexist")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Contains(t, rpm.Depends, "rpm_depend")
|
require.True(t, reflect.DeepEqual(&config.Info, info))
|
||||||
assert.NotContains(t, rpm.Depends, "deb_depend")
|
})
|
||||||
for _, f := range rpm.Contents {
|
|
||||||
fmt.Printf("%+#v\n", f)
|
|
||||||
assert.True(t, f.Packager != "deb")
|
|
||||||
assert.True(t, f.Packager != "apk")
|
|
||||||
if f.Packager == "rpm" {
|
|
||||||
assert.Contains(t, f.Destination, "/rpm")
|
|
||||||
}
|
|
||||||
if f.Packager == "" {
|
|
||||||
assert.True(t, f.Destination == "/etc/foo/whatever.conf")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert.Equal(t, "amd64", rpm.Arch)
|
|
||||||
|
|
||||||
// no overrides
|
|
||||||
info, err := config.Get("doesnotexist")
|
|
||||||
require.NoError(t, err)
|
|
||||||
assert.True(t, reflect.DeepEqual(&config.Info, info))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakePackager struct{}
|
type fakePackager struct{}
|
||||||
|
|
|
@ -55,11 +55,16 @@ func exampleInfo() *nfpm.Info {
|
||||||
Conflicts: []string{
|
Conflicts: []string{
|
||||||
"zsh",
|
"zsh",
|
||||||
},
|
},
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/fake": "/usr/local/bin/fake",
|
{
|
||||||
},
|
Source: "../testdata/fake",
|
||||||
ConfigFiles: map[string]string{
|
Destination: "/usr/local/bin/fake",
|
||||||
"../testdata/whatever.conf": "/etc/fake/fake.conf",
|
},
|
||||||
|
{
|
||||||
|
Source: "../testdata/whatever.conf",
|
||||||
|
Destination: "/etc/fake/fake.conf",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
EmptyFolders: []string{
|
EmptyFolders: []string{
|
||||||
"/var/log/whatever",
|
"/var/log/whatever",
|
||||||
|
@ -365,11 +370,16 @@ echo "Postremove" > /dev/null
|
||||||
|
|
||||||
func TestRPMFileDoesNotExist(t *testing.T) {
|
func TestRPMFileDoesNotExist(t *testing.T) {
|
||||||
info := exampleInfo()
|
info := exampleInfo()
|
||||||
info.Files = map[string]string{
|
info.Contents = []*files.Content{
|
||||||
"../testdata/fake": "/usr/local/bin/fake",
|
{
|
||||||
}
|
Source: "../testdata/fake",
|
||||||
info.ConfigFiles = map[string]string{
|
Destination: "/usr/local/bin/fake",
|
||||||
"../testdata/whatever.confzzz": "/etc/fake/fake.conf",
|
},
|
||||||
|
{
|
||||||
|
Source: "../testdata/whatever.confzzz",
|
||||||
|
Destination: "/etc/fake/fake.conf",
|
||||||
|
Type: "config",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
var err = Default.Package(info, ioutil.Discard)
|
var err = Default.Package(info, ioutil.Discard)
|
||||||
assert.EqualError(t, err, "matching \"../testdata/whatever.confzzz\": file does not exist")
|
assert.EqualError(t, err, "matching \"../testdata/whatever.confzzz\": file does not exist")
|
||||||
|
@ -397,9 +407,11 @@ func TestConfigNoReplace(t *testing.T) {
|
||||||
Description: "This package's config references a file via symlink.",
|
Description: "This package's config references a file via symlink.",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
RPM: nfpm.RPM{
|
Contents: []*files.Content{
|
||||||
ConfigNoReplaceFiles: map[string]string{
|
{
|
||||||
buildConfigFile: packageConfigFile,
|
Source: buildConfigFile,
|
||||||
|
Destination: packageConfigFile,
|
||||||
|
Type: "config|noreplace",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -533,8 +545,11 @@ func TestSymlinkInFiles(t *testing.T) {
|
||||||
Description: "This package's config references a file via symlink.",
|
Description: "This package's config references a file via symlink.",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
symlinkTo(t, symlinkTarget): packagedTarget,
|
{
|
||||||
|
Source: symlinkTo(t, symlinkTarget),
|
||||||
|
Destination: packagedTarget,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -565,11 +580,16 @@ func TestSymlink(t *testing.T) {
|
||||||
Description: "This package's config references a file via symlink.",
|
Description: "This package's config references a file via symlink.",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Overridables: nfpm.Overridables{
|
Overridables: nfpm.Overridables{
|
||||||
Files: map[string]string{
|
Contents: []*files.Content{
|
||||||
"../testdata/whatever.conf": configFilePath,
|
{
|
||||||
},
|
Source: "../testdata/whatever.conf",
|
||||||
Symlinks: map[string]string{
|
Destination: configFilePath,
|
||||||
symlink: symlinkTarget,
|
},
|
||||||
|
{
|
||||||
|
Source: symlinkTarget,
|
||||||
|
Destination: symlink,
|
||||||
|
Type: "symlink",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -628,11 +648,18 @@ func TestRPMGhostFiles(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
info := &nfpm.Info{
|
info := &nfpm.Info{
|
||||||
Name: "rpm-ghost",
|
Name: "rpm-ghost",
|
||||||
Arch: "amd64",
|
Arch: "amd64",
|
||||||
Description: "This RPM contains ghost files.",
|
Description: "This RPM contains ghost files.",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Overridables: nfpm.Overridables{RPM: nfpm.RPM{GhostFiles: []string{filename}}},
|
Overridables: nfpm.Overridables{
|
||||||
|
Contents: []*files.Content{
|
||||||
|
{
|
||||||
|
Destination: filename,
|
||||||
|
Type: "ghost",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var rpmFileBuffer bytes.Buffer
|
var rpmFileBuffer bytes.Buffer
|
||||||
|
@ -666,8 +693,11 @@ func TestRPMGhostFiles(t *testing.T) {
|
||||||
func TestDisableGlobbing(t *testing.T) {
|
func TestDisableGlobbing(t *testing.T) {
|
||||||
info := exampleInfo()
|
info := exampleInfo()
|
||||||
info.DisableGlobbing = true
|
info.DisableGlobbing = true
|
||||||
info.Files = map[string]string{
|
info.Contents = []*files.Content{
|
||||||
"../testdata/{file}[": "/test/{file}[",
|
{
|
||||||
|
Source: "../testdata/{file}[",
|
||||||
|
Destination: "/test/{file}[",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var rpmFileBuffer bytes.Buffer
|
var rpmFileBuffer bytes.Buffer
|
||||||
|
@ -760,17 +790,9 @@ func symlinkTo(tb testing.TB, fileName string) string {
|
||||||
target, err := filepath.Abs(fileName)
|
target, err := filepath.Abs(fileName)
|
||||||
assert.NoError(tb, err)
|
assert.NoError(tb, err)
|
||||||
|
|
||||||
tempDir, err := ioutil.TempDir("", "nfpm_rpm_test")
|
symlinkName := path.Join(tb.TempDir(), "symlink")
|
||||||
assert.NoError(tb, err)
|
|
||||||
|
|
||||||
symlinkName := path.Join(tempDir, "symlink")
|
|
||||||
err = os.Symlink(target, symlinkName)
|
err = os.Symlink(target, symlinkName)
|
||||||
assert.NoError(tb, err)
|
assert.NoError(tb, err)
|
||||||
|
|
||||||
tb.Cleanup(func() {
|
|
||||||
err = os.RemoveAll(tempDir)
|
|
||||||
assert.NoError(tb, err)
|
|
||||||
})
|
|
||||||
|
|
||||||
return files.ToNixPath(symlinkName)
|
return files.ToNixPath(symlinkName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,14 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
./testdata/acceptance/folder/*: "/usr/share/whatever/folder/"
|
dst: /usr/local/bin/fake
|
||||||
config_files:
|
- src: ./testdata/acceptance/folder/*
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
dst: /usr/share/whatever/folder/
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
empty_folders:
|
empty_folders:
|
||||||
- /var/log/whatever
|
- /var/log/whatever
|
||||||
- /usr/share/foo
|
- /usr/share/foo
|
||||||
|
|
|
@ -19,11 +19,14 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
./testdata/acceptance/folder/*: "/usr/share/whatever/folder/"
|
dst: /usr/local/bin/fake
|
||||||
config_files:
|
- src: ./testdata/acceptance/folder/*
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
dst: /usr/share/whatever/folder/
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
empty_folders:
|
empty_folders:
|
||||||
- /var/log/whatever
|
- /var/log/whatever
|
||||||
- /usr/share/foo
|
- /usr/share/foo
|
||||||
|
|
|
@ -6,8 +6,10 @@ maintainer: "Foo Bar"
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
config_files:
|
contents:
|
||||||
./testdata/whatever.conf: "/etc/regular.conf"
|
- src: ./testdata/whatever.conf
|
||||||
rpm:
|
dst: /etc/regular.conf
|
||||||
config_noreplace_files:
|
type: config
|
||||||
./testdata/whatever.conf: "/etc/noreplace.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/noreplace.conf
|
||||||
|
type: config|noreplace
|
||||||
|
|
|
@ -6,8 +6,10 @@ maintainer: "Foo Bar"
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
config_files:
|
contents:
|
||||||
./testdata/whatever2.conf: "/etc/regular.conf"
|
- src: ./testdata/whatever2.conf
|
||||||
rpm:
|
dst: /etc/regular.conf
|
||||||
config_noreplace_files:
|
type: config
|
||||||
./testdata/whatever2.conf: "/etc/noreplace.conf"
|
- src: ./testdata/whatever2.conf
|
||||||
|
dst: /etc/noreplace.conf
|
||||||
|
type: config|noreplace
|
||||||
|
|
|
@ -17,11 +17,14 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
./testdata/acceptance/folder/**/*: "/usr/share/whatever/folder/"
|
dst: /usr/local/bin/fake
|
||||||
config_files:
|
- src: ./testdata/acceptance/folder/**/*
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
dst: /usr/share/whatever/folder/
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
empty_folders:
|
empty_folders:
|
||||||
- /var/log/whatever
|
- /var/log/whatever
|
||||||
- /usr/share/foo
|
- /usr/share/foo
|
||||||
|
|
|
@ -9,9 +9,11 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
rpm:
|
rpm:
|
||||||
compression: "gzip"
|
compression: "gzip"
|
||||||
|
|
|
@ -9,9 +9,11 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
rpm:
|
rpm:
|
||||||
compression: "lzma"
|
compression: "lzma"
|
||||||
|
|
|
@ -2,5 +2,6 @@ name: foo
|
||||||
arch: amd64
|
arch: amd64
|
||||||
version: 1.2.3
|
version: 1.2.3
|
||||||
license: MIT
|
license: MIT
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
|
dst: /usr/local/bin/fake
|
||||||
|
|
|
@ -17,11 +17,14 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
./testdata/acceptance/folder/*: "/usr/share/whatever/folder/"
|
dst: /usr/local/bin/fake
|
||||||
config_files:
|
- src: ./testdata/acceptance/folder/*
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
dst: /usr/share/whatever/folder/
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
overrides:
|
overrides:
|
||||||
rpm:
|
rpm:
|
||||||
scripts:
|
scripts:
|
||||||
|
|
|
@ -10,7 +10,9 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
|
|
@ -9,10 +9,12 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
deb:
|
deb:
|
||||||
scripts:
|
scripts:
|
||||||
rules: ./testdata/acceptance/scripts/rules.sh
|
rules: ./testdata/acceptance/scripts/rules.sh
|
||||||
|
|
|
@ -6,8 +6,9 @@ maintainer: "John Doe <john@example.com>"
|
||||||
description: This package is sigend
|
description: This package is sigend
|
||||||
vendor: "FooBarCorp"
|
vendor: "FooBarCorp"
|
||||||
homepage: "http://example.com"
|
homepage: "http://example.com"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
|
dst: /usr/local/bin/fake
|
||||||
deb:
|
deb:
|
||||||
signature:
|
signature:
|
||||||
key_file: ./internal/sign/testdata/privkey_unprotected.asc
|
key_file: ./internal/sign/testdata/privkey_unprotected.asc
|
||||||
|
|
|
@ -9,7 +9,9 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
|
|
@ -9,7 +9,9 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
|
|
@ -9,7 +9,9 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
|
|
@ -10,7 +10,9 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
|
|
@ -6,7 +6,9 @@ maintainer: "Foo Bar"
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
symlinks:
|
dst: /etc/foo/whatever.conf
|
||||||
/path/to/symlink: "/etc/foo/whatever.conf"
|
- src: /etc/foo/whatever.conf
|
||||||
|
dst: /path/to/symlink
|
||||||
|
type: symlink
|
||||||
|
|
|
@ -5,8 +5,9 @@ version: "v1.2.3-beta"
|
||||||
maintainer: "Foo Bar"
|
maintainer: "Foo Bar"
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
|
dst: /usr/local/bin/fake
|
||||||
scripts:
|
scripts:
|
||||||
postinstall: ./testdata/acceptance/scripts/postinstall_trigger.sh
|
postinstall: ./testdata/acceptance/scripts/postinstall_trigger.sh
|
||||||
deb:
|
deb:
|
||||||
|
|
|
@ -11,7 +11,9 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
|
|
@ -9,9 +9,11 @@ description: |
|
||||||
vendor: "foobar"
|
vendor: "foobar"
|
||||||
homepage: "https://foobar.org"
|
homepage: "https://foobar.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
files:
|
contents:
|
||||||
./testdata/fake: "/usr/local/bin/fake"
|
- src: ./testdata/fake
|
||||||
config_files:
|
dst: /usr/local/bin/fake
|
||||||
./testdata/whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
rpm:
|
rpm:
|
||||||
compression: "xz"
|
compression: "xz"
|
||||||
|
|
|
@ -2,23 +2,31 @@
|
||||||
name: "foo"
|
name: "foo"
|
||||||
arch: "amd64"
|
arch: "amd64"
|
||||||
version: "v1.2.3"
|
version: "v1.2.3"
|
||||||
config_files:
|
contents:
|
||||||
whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/whatever.conf
|
||||||
|
type: config
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /deb/path.conf
|
||||||
|
type: config
|
||||||
|
packager: deb
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /rpm/path.conf
|
||||||
|
type: config
|
||||||
|
packager: rpm
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /apk/path.conf
|
||||||
|
type: config
|
||||||
|
packager: apk
|
||||||
rpm:
|
rpm:
|
||||||
group: foo
|
group: foo
|
||||||
overrides:
|
overrides:
|
||||||
deb:
|
deb:
|
||||||
depends:
|
depends:
|
||||||
- deb_depend
|
- deb_depend
|
||||||
config_files:
|
|
||||||
deb.conf: "/deb/path"
|
|
||||||
rpm:
|
rpm:
|
||||||
depends:
|
depends:
|
||||||
- rpm_depend
|
- rpm_depend
|
||||||
config_files:
|
|
||||||
rpm.conf: "/rpm/path"
|
|
||||||
apk:
|
apk:
|
||||||
depends:
|
depends:
|
||||||
- apk_depend
|
- apk_depend
|
||||||
config_files:
|
|
||||||
apk.conf: "/apk/path"
|
|
||||||
|
|
|
@ -2,16 +2,22 @@
|
||||||
name: "foo"
|
name: "foo"
|
||||||
arch: "amd64"
|
arch: "amd64"
|
||||||
version: "v$GOROOT"
|
version: "v$GOROOT"
|
||||||
config_files:
|
contents:
|
||||||
whatever.conf: "/etc/foo/whatever.conf"
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /etc/foo/regular.conf
|
||||||
|
type: config
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /deb/path
|
||||||
|
type: config
|
||||||
|
packager: deb
|
||||||
|
- src: ./testdata/whatever.conf
|
||||||
|
dst: /rpm/path
|
||||||
|
type: config
|
||||||
|
packager: rpm
|
||||||
overrides:
|
overrides:
|
||||||
deb:
|
deb:
|
||||||
depends:
|
depends:
|
||||||
- deb_depend
|
- deb_depend
|
||||||
config_files:
|
|
||||||
deb.conf: "/deb/path"
|
|
||||||
rpm:
|
rpm:
|
||||||
depends:
|
depends:
|
||||||
- rpm_depend
|
- rpm_depend
|
||||||
config_files:
|
|
||||||
rpm.conf: "/rpm/path"
|
|
||||||
|
|
Loading…
Reference in New Issue