Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support RPM ghost files #245

Merged
merged 1 commit into from Nov 8, 2020
Merged

feat: Support RPM ghost files #245

merged 1 commit into from Nov 8, 2020

Conversation

wwade
Copy link
Contributor

@wwade wwade commented Nov 7, 2020

From the Maximum RPM guide:

The %ghost Directive

As we mentioned in the Section called The %files List, if a file
is specified in the %files list, that file will automatically be
included in the package. 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 are specified using Type: rpmpack.GhostFile when
constructing the output package.

The test ensures that we have:

  • The target file present in the RPM.
  • The specified mode attributes (although not really important,
    either).
  • An empty file [1] in the RPM for the named ghost,
    see google/rpmpack #51.

[1] Instead of an empty file, no file should be created, but this is
not possible until the upstream issue is resolved.

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 7, 2020
@vercel
Copy link

vercel bot commented Nov 7, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/goreleaser/nfpm/x5z8hufgg
✅ Preview: https://nfpm-git-rpm-ghost.goreleaser.vercel.app

@vercel vercel bot temporarily deployed to Preview November 7, 2020 21:04 Inactive
@vercel vercel bot temporarily deployed to Preview November 7, 2020 21:09 Inactive
@codecov
Copy link

codecov bot commented Nov 7, 2020

Codecov Report

Merging #245 (6841e63) into master (13335ee) will increase coverage by 0.25%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #245      +/-   ##
==========================================
+ Coverage   66.86%   67.11%   +0.25%     
==========================================
  Files           9        9              
  Lines        1023     1031       +8     
==========================================
+ Hits          684      692       +8     
  Misses        204      204              
  Partials      135      135              
Impacted Files Coverage Δ
nfpm.go 78.04% <ø> (ø)
rpm/rpm.go 72.94% <100.00%> (+1.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13335ee...6841e63. Read the comment docs.

nfpm.go Outdated
@@ -181,6 +181,7 @@ type RPM struct {
// https://www.cl.cam.ac.uk/~jw35/docs/rpm_config.html
ConfigNoReplaceFiles map[string]string `yaml:"config_noreplace_files,omitempty"`
Signature RPMSignature `yaml:"signature,omitempty"`
Ghosts []string `yaml:"ghosts,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

maybe GhostFiles instead (to go with ConfigNoReplaceFiles)?

Suggested change
Ghosts []string `yaml:"ghosts,omitempty"`
GhostFiles []string `yaml:"ghost_files,omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thanks for reviewing. I'll make the changes.

From the [Maximum RPM] guide:

    The %ghost Directive

    As we mentioned in the Section called The %files List, if a file
    is specified in the %files list, that file will automatically be
    included in the package. 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 are specified using `Type: rpmpack.GhostFile` when
constructing the output package.

The test ensures that we have:
 - The target file present in the RPM.
 - The specified mode attributes (although not really important,
 either).
 - An empty file *[1]* in the RPM for the named ghost,
see [google/rpmpack #51].

*[1] Instead of an empty file, no file should be created, but this is
not possible until the upstream issue is resolved.*

[Maximum RPM]:
http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html
[google/rpmpack #51]: google/rpmpack#51
@vercel vercel bot temporarily deployed to Preview November 8, 2020 18:19 Inactive
@caarlos0
Copy link
Member

caarlos0 commented Nov 8, 2020

Thanks!

@caarlos0 caarlos0 merged commit 8c19c6a into goreleaser:master Nov 8, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2020

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants