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: add support for additional fields in Debian control files #491

Merged
merged 1 commit into from
Apr 6, 2022
Merged

feat: add support for additional fields in Debian control files #491

merged 1 commit into from
Apr 6, 2022

Conversation

atheriel
Copy link
Contributor

@atheriel atheriel commented Apr 6, 2022

Debian control files (DCF) have a number of optional fields -- including "Bugs" and "Tags" -- that are used by many existing packages. The original fpm supports adding arbitrary fields to DCFs with the --deb-field flag, but until now it was not possible to do so with nfpm.

This PR introduces a new deb-specific override, fields, that simply translates key-value pairs from a map directly into the DCF.
Given the following nfpm config file entry:

deb:
  fields:
    Bugs: https://github.com/goreleaser/nfpm/issues

The resulting DCF would contain the entry

Bugs: https://github.com/goreleaser/nfpm/issues

To avoid generating malformed DCFs, we simply ignore empty entries.

This PR includes unit tests and updates to the website documentation.

Closes #490.

Debian control files (DCF) have a number of optional fields [0] --
including "Bugs" and "Tags" -- that are used by many existing packages.
The original fpm supports adding arbitrary fields to DCFs with the
--deb-field flag [1], but until now it was not possible to do so with
nfpm.

This commit introduces a new deb-specific override, "fields", that
simply translates key-value pairs from a map directly into the DCF.
Given the following nfpm config file entry:

    deb:
      fields:
        Bugs: https://github.com/goreleaser/nfpm/issues

The resulting DCF would contain the entry

    Bugs: https://github.com/goreleaser/nfpm/issues

To avoid generating malformed DCFs, we simply ignore empty entries.

This commit includes unit tests and updates to the website
documentation.

Closes #490.

[0]: https://man7.org/linux/man-pages/man5/deb-control.5.html
[1]: https://fpm.readthedocs.io/en/latest/packages/deb.html?highlight=changelog#deb-specific-command-line-flags

Signed-off-by: Aaron Jacobs <aaron.jacobs@rstudio.com>
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 6, 2022
Copy link
Contributor

@djgilcrease djgilcrease left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #491 (b9fa012) into main (4a6d81c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #491   +/-   ##
=======================================
  Coverage   66.12%   66.12%           
=======================================
  Files          16       16           
  Lines        1916     1916           
=======================================
  Hits         1267     1267           
  Misses        510      510           
  Partials      139      139           
Impacted Files Coverage Δ
deb/deb.go 70.16% <ø> (ø)
nfpm.go 86.50% <ø> (ø)

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 4a6d81c...b9fa012. Read the comment docs.

Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

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

amazing, thank you!

@caarlos0 caarlos0 merged commit 98a59ec into goreleaser:main Apr 6, 2022
@github-actions github-actions bot added this to the 2.15.0 milestone Apr 6, 2022
@atheriel atheriel deleted the custom-deb-fields branch April 6, 2022 18:16
@caarlos0 caarlos0 modified the milestones: 2.15.0, v2.17.0, v2.16.0 Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

Add support for arbitrary .deb control file fields
3 participants