Skip to content

Commit

Permalink
feat: nfpm rpm.summary and nfpm.ghost_files (#1892)
Browse files Browse the repository at this point in the history
* feat: nfpm rpm.summary and nfpm.ghost_files

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

* fix: fmt

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Nov 12, 2020
1 parent 188447b commit 671c7ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/pipe/nfpm/nfpm.go
Expand Up @@ -197,8 +197,10 @@ func create(ctx *context.Context, fpm config.NFPM, format, arch string, binaries
},
},
RPM: nfpm.RPM{
Summary: overridden.RPM.Summary,
Group: overridden.RPM.Group,
Compression: overridden.RPM.Compression,
GhostFiles: overridden.RPM.GhostFiles,
ConfigNoReplaceFiles: overridden.RPM.ConfigNoReplaceFiles,
Signature: nfpm.RPMSignature{
KeyFile: overridden.RPM.Signature.KeyFile,
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Expand Up @@ -331,10 +331,12 @@ type NFPMRPMSignature 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"`
// https://www.cl.cam.ac.uk/~jw35/docs/rpm_config.html
ConfigNoReplaceFiles map[string]string `yaml:"config_noreplace_files,omitempty"`
GhostFiles []string `yaml:"ghost_files,omitempty"`
Signature NFPMRPMSignature `yaml:"signature,omitempty"`
}

Expand Down
18 changes: 18 additions & 0 deletions www/docs/customization/nfpm.md
Expand Up @@ -165,6 +165,10 @@ nfpms:

# Custon configuration applied only to the RPM packager.
rpm:
# The package summary.
# Defaults to the first line of the description.
summary: Explicit Summary for Sample Package

# The package group. This option is deprecated by most distros
# but required by old distros like CentOS 5 / EL 5 and earlier.
group: Unspecified
Expand All @@ -177,6 +181,20 @@ nfpms:
config_noreplace_files:
path/to/local/bar.con: /etc/bar.conf

# These files are not actually present in the package, but the file names
# are added to the package header. From the RPM directives documentation:
#
# "There are times when a file should be owned by the package but not
# installed - log files and state files are good examples of cases you might
# desire this to happen."
#
# "The way to achieve this, is to use the %ghost directive. By adding this
# directive to the line containing a file, RPM will know about the ghosted
# file, but will not add it to the package."
ghost_files:
- /etc/casper.conf
- /var/log/boo.log

# The package is signed if a key_file is set
signature:
# PGP secret key (can also be ASCII-armored). The passphrase is taken
Expand Down

1 comment on commit 671c7ef

@vercel
Copy link

@vercel vercel bot commented on 671c7ef Nov 12, 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.