Repository: goreleaser/goreleaser
Pull request #1995 (2021-01-05 20:03:57)

feat(nfpm): wire up two additional nfpm properties
The properties Section and Priority are currently omitted from the goreleaser config. This commit wires them up so we can use them to build our packages.

Provides two new properties to provide to NFPM, `Section` and `Priority`.

Allows us to add these properties to our Debian packages.

https://github.com/goreleaser/nfpm/blob/master/nfpm.go#L168-L169

vercel[bot]: @ryancurrah is attempting to deploy a commit to the **Goreleaser** Team on [Vercel](https://vercel.com).

A member of the Team first needs to [authorize it](https://vercel.com/git/authorize?team=Goreleaser&type=github&job=%7B%22headInfo%22%3A%7B%22sha%22%3A%22fc10a9d120415ae3602cfe32debd144692ac7c4b%22%7D%2C%22id%22%3A%22QmXQ71ASwWu5PV9Hnv5LLSsBm72SYv62yro8F33x3aKNmg%22%2C%22org%22%3A%22goreleaser%22%2C%22prId%22%3A1995%2C%22repo%22%3A%22goreleaser%22%7D).


codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=h1) Report
> Merging [#1995](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=desc) (fc10a9d) into [master](https://codecov.io/gh/goreleaser/goreleaser/commit/a9c143c24b872b3333a686d13252d78085e5e938?el=desc) (a9c143c) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/goreleaser/pull/1995/graphs/tree.svg?width=650&height=150&src=pr&token=3bJvv6b7hN)](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1995   +/-   ##
=======================================
  Coverage   82.83%   82.83%           
=======================================
  Files          74       74           
  Lines        3980     3980           
=======================================
  Hits         3297     3297           
  Misses        556      556           
  Partials      127      127           
```


| [Impacted Files](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pkg/config/config.go](https://codecov.io/gh/goreleaser/goreleaser/pull/1995/diff?src=pr&el=tree#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `93.75% <ø> (ø)` | |
| [internal/pipe/nfpm/nfpm.go](https://codecov.io/gh/goreleaser/goreleaser/pull/1995/diff?src=pr&el=tree#diff-aW50ZXJuYWwvcGlwZS9uZnBtL25mcG0uZ28=) | `95.34% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=footer). Last update [a9c143c...fc10a9d](https://codecov.io/gh/goreleaser/goreleaser/pull/1995?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.gitignore b/.gitignore
index c2e21563..e63a3873 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ site/
 www/docs/static/releases.json
 .vercel
 completions/
+.vscode/
\ No newline at end of file
diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go
index 3ff40cc1..687acbdd 100644
--- a/internal/pipe/nfpm/nfpm.go
+++ b/internal/pipe/nfpm/nfpm.go
@@ -208,8 +208,8 @@ func create(ctx *context.Context, fpm config.NFPM, format, arch string, binaries
 		Platform:        "linux",
 		Name:            fpm.PackageName,
 		Version:         ctx.Version,
-		Section:         "",
-		Priority:        "",
+		Section:         fpm.Section,
+		Priority:        fpm.Priority,
 		Epoch:           fpm.Epoch,
 		Release:         fpm.Release,
 		Prerelease:      fpm.Prerelease,
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 2d31724c..f9cd30cf 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -307,6 +307,8 @@ type NFPM struct {
 	ID          string   `yaml:",omitempty"`
 	Builds      []string `yaml:",omitempty"`
 	Formats     []string `yaml:",omitempty"`
+	Section     string   `yaml:",omitempty"`
+	Priority    string   `yaml:",omitempty"`
 	Vendor      string   `yaml:",omitempty"`
 	Homepage    string   `yaml:",omitempty"`
 	Maintainer  string   `yaml:",omitempty"`


Test patch:
diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go
index ae82aea4..980fad60 100644
--- a/internal/pipe/nfpm/nfpm_test.go
+++ b/internal/pipe/nfpm/nfpm_test.go
@@ -89,6 +89,8 @@ func TestRunPipe(t *testing.T) {
 				Bindir:      "/usr/bin",
 				Builds:      []string{"default"},
 				Formats:     []string{"deb", "rpm", "apk"},
+				Section:     "somesection",
+				Priority:    "standard",
 				Description: "Some description",
 				License:     "MIT",
 				Maintainer:  "me@me",
@@ -666,6 +668,8 @@ func TestMeta(t *testing.T) {
 				Bindir:      "/usr/bin",
 				Builds:      []string{"default"},
 				Formats:     []string{"deb", "rpm"},
+				Section:     "somesection",
+				Priority:    "standard",
 				Description: "Some description",
 				License:     "MIT",
 				Maintainer:  "me@me",