Skip to content

Commit

Permalink
feat: support replaces on nfpm (#1888)
Browse files Browse the repository at this point in the history
* feat: support replaces on nfpm

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* Update www/docs/customization/nfpm.md
  • Loading branch information
caarlos0 committed Nov 6, 2020
1 parent 17e5674 commit 9935b87
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/pipe/nfpm/nfpm.go
Expand Up @@ -165,6 +165,7 @@ func create(ctx *context.Context, fpm config.NFPM, format, arch string, binaries
Depends: overridden.Dependencies,
Recommends: overridden.Recommends,
Suggests: overridden.Suggests,
Replaces: overridden.Replaces,
EmptyFolders: overridden.EmptyFolders,
Files: files,
ConfigFiles: overridden.ConfigFiles,
Expand Down
2 changes: 2 additions & 0 deletions internal/pipe/nfpm/nfpm_test.go
Expand Up @@ -101,6 +101,7 @@ func TestRunPipe(t *testing.T) {
Dependencies: []string{"make"},
Recommends: []string{"svn"},
Suggests: []string{"bzr"},
Replaces: []string{"fish"},
Conflicts: []string{"git"},
EmptyFolders: []string{"/var/log/foobar"},
Release: "10",
Expand Down Expand Up @@ -607,6 +608,7 @@ func TestMeta(t *testing.T) {
Dependencies: []string{"make"},
Recommends: []string{"svn"},
Suggests: []string{"bzr"},
Replaces: []string{"fish"},
Conflicts: []string{"git"},
EmptyFolders: []string{"/var/log/foobar"},
Release: "10",
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Expand Up @@ -399,6 +399,7 @@ type NFPMOverridables struct {
Recommends []string `yaml:",omitempty"`
Suggests []string `yaml:",omitempty"`
Conflicts []string `yaml:",omitempty"`
Replaces []string `yaml:",omitempty"`
EmptyFolders []string `yaml:"empty_folders,omitempty"`
Files map[string]string `yaml:",omitempty"`
ConfigFiles map[string]string `yaml:"config_files,omitempty"`
Expand Down
8 changes: 7 additions & 1 deletion www/docs/customization/nfpm.md
Expand Up @@ -85,6 +85,10 @@ nfpms:
- svn
- bash

# Packages it replaces.
replaces:
- fish

# Override default /usr/local/bin destination for binaries
bindir: /usr/bin

Expand Down Expand Up @@ -133,7 +137,7 @@ nfpms:
preremove: "scripts/preremove.sh"
postremove: "scripts/postremove.sh"

# Some attributes can be overrided per package format.
# Some attributes can be overridden per package format.
overrides:
deb:
conflicts:
Expand All @@ -144,6 +148,8 @@ nfpms:
- gitk
recommends:
- tig
replaces:
- bash
empty_folders:
- /var/log/bar
rpm:
Expand Down

1 comment on commit 9935b87

@vercel
Copy link

@vercel vercel bot commented on 9935b87 Nov 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.