Repository: goreleaser/goreleaser
Pull request #1619 (2020-06-19 08:00:50)

chore(deps): bump actions/checkout from v2.3.0 to v2.3.1
Bumps [actions/checkout](https://github.com/actions/checkout) from v2.3.0 to v2.3.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/checkout/releases">actions/checkout's releases</a>.</em></p>
<blockquote>
<h2>v2.3.1</h2>
<p><a href="https://github-redirect.dependabot.com/actions/checkout/pull/284">Fix default branch resolution for .wiki and when using SSH</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/actions/checkout/blob/master/CHANGELOG.md">actions/checkout's changelog</a>.</em></p>
<blockquote>
<h2>v2.3.1</h2>
<ul>
<li><a href="https://github-redirect.dependabot.com/actions/checkout/pull/284">Fix default branch resolution for .wiki and when using SSH</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/actions/checkout/commit/28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b"><code>28c7f3d</code></a> changelog</li>
<li><a href="https://github.com/actions/checkout/commit/fb6f360df236bd2026c7963cf88c8ddf20b4f0e2"><code>fb6f360</code></a> fix default branch for .wiki and when using ssh (<a href="https://github-redirect.dependabot.com/actions/checkout/issues/284">#284</a>)</li>
<li>See full diff in <a href="https://github.com/actions/checkout/compare/v2.3.0...28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

vercel[bot]: 
This pull request is being automatically deployed with Vercel ([learn more](https://vercel.link/github-learn-more)).
To see the status of your deployment, click on the icon next to each commit.
	
codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/1619?src=pr&el=h1) Report
> Merging [#1619](https://codecov.io/gh/goreleaser/goreleaser/pull/1619?src=pr&el=desc) into [master](https://codecov.io/gh/goreleaser/goreleaser/commit/48b2a1f3e65939d38f2c019f7202aabfa935113d&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master    #1619   +/-   ##
=======================================
  Coverage   85.31%   85.31%           
=======================================
  Files          70       70           
  Lines        3887     3887           
=======================================
  Hits         3316     3316           
  Misses        467      467           
  Partials      104      104           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/1619?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/1619?src=pr&el=footer). Last update [48b2a1f...3960898](https://codecov.io/gh/goreleaser/goreleaser/pull/1619?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 87a53b0c..f1e2bba4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -14,7 +14,7 @@ jobs:
     steps:
       -
         name: Checkout
-        uses: actions/checkout@v2.3.0
+        uses: actions/checkout@v2.3.1
         with:
           fetch-depth: 0
       -
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 86dd73e4..e3870d41 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -15,7 +15,7 @@ jobs:
     steps:
       -
         name: Checkout
-        uses: actions/checkout@v2.3.0
+        uses: actions/checkout@v2.3.1
       -
         name: build
         run: |
diff --git a/.github/workflows/gosum.yml b/.github/workflows/gosum.yml
index bc0d2c20..6958698d 100644
--- a/.github/workflows/gosum.yml
+++ b/.github/workflows/gosum.yml
@@ -15,7 +15,7 @@ jobs:
     steps:
       -
         name: Checkout
-        uses: actions/checkout@v2.3.0
+        uses: actions/checkout@v2.3.1
       -
         name: Set up Go
         uses: actions/setup-go@v2
diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go
index b9fdd067..25133afb 100644
--- a/internal/pipe/nfpm/nfpm.go
+++ b/internal/pipe/nfpm/nfpm.go
@@ -133,12 +133,15 @@ func create(ctx *context.Context, fpm config.NFPM, format, arch string, binaries
 	for k, v := range overridden.Files {
 		files[k] = v
 	}
-	var log = log.WithField("package", name+"."+format).WithField("arch", arch)
-	for _, binary := range binaries {
-		src := binary.Path
-		dst := filepath.Join(fpm.Bindir, binary.Name)
-		log.WithField("src", src).WithField("dst", dst).Debug("adding binary to package")
-		files[src] = dst
+	// FPM meta package should not contain binaries at all
+	if !fpm.Meta {
+		var log = log.WithField("package", name+"."+format).WithField("arch", arch)
+		for _, binary := range binaries {
+			src := binary.Path
+			dst := filepath.Join(fpm.Bindir, binary.Name)
+			log.WithField("src", src).WithField("dst", dst).Debug("adding binary to package")
+			files[src] = dst
+		}
 	}
 	log.WithField("files", files).Debug("all archive files")
 
@@ -206,6 +209,7 @@ func create(ctx *context.Context, fpm config.NFPM, format, arch string, binaries
 			"Builds": binaries,
 			"ID":     fpm.ID,
 			"Format": format,
+			"Files":  files,
 		},
 	})
 	return nil
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 8dff9857..6db8b54b 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -286,6 +286,7 @@ type NFPM struct {
 	Description string   `yaml:",omitempty"`
 	License     string   `yaml:",omitempty"`
 	Bindir      string   `yaml:",omitempty"`
+	Meta        bool     `yaml:",omitempty"` // make package without binaries - only deps
 }
 
 // NFPMScripts is used to specify maintainer scripts.
diff --git a/www/docs/customization/nfpm.md b/www/docs/customization/nfpm.md
index 70ffab9e..240a14ca 100644
--- a/www/docs/customization/nfpm.md
+++ b/www/docs/customization/nfpm.md
@@ -95,6 +95,11 @@ nfpms:
     # Defaults to empty.
     release: 1
 
+    # Makes a meta package - an empty package that contains only supporting files and dependencies.
+    # When set to `true`, the `builds` option is ignored.
+    # Defaults to false.
+    meta: true
+
     # Empty folders that should be created and managed by the packager
     # implementation.
     # Default is empty.


Test patch:
diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go
index 9efa2176..cb20219b 100644
--- a/internal/pipe/nfpm/nfpm_test.go
+++ b/internal/pipe/nfpm/nfpm_test.go
@@ -362,3 +362,93 @@ func TestSeveralNFPMsWithTheSameID(t *testing.T) {
 	}
 	require.EqualError(t, Pipe{}.Default(ctx), "found 2 nfpms with the ID 'a', please fix your config")
 }
+
+func TestMeta(t *testing.T) {
+	folder, err := ioutil.TempDir("", "archivetest")
+	require.NoError(t, err)
+	var dist = filepath.Join(folder, "dist")
+	require.NoError(t, os.Mkdir(dist, 0755))
+	require.NoError(t, os.Mkdir(filepath.Join(dist, "mybin"), 0755))
+	var binPath = filepath.Join(dist, "mybin", "mybin")
+	_, err = os.Create(binPath)
+	require.NoError(t, err)
+	var ctx = context.New(config.Project{
+		ProjectName: "mybin",
+		Dist:        dist,
+		NFPMs: []config.NFPM{
+			{
+				ID:          "someid",
+				Bindir:      "/usr/bin",
+				Builds:      []string{"default"},
+				Formats:     []string{"deb", "rpm"},
+				Description: "Some description",
+				License:     "MIT",
+				Maintainer:  "me@me",
+				Vendor:      "asdf",
+				Homepage:    "https://goreleaser.github.io",
+				Meta:        true,
+				NFPMOverridables: config.NFPMOverridables{
+					FileNameTemplate: defaultNameTemplate + "-{{ .Release }}-{{ .Epoch }}",
+					PackageName:      "foo",
+					Dependencies:     []string{"make"},
+					Recommends:       []string{"svn"},
+					Suggests:         []string{"bzr"},
+					Conflicts:        []string{"git"},
+					EmptyFolders:     []string{"/var/log/foobar"},
+					Release:          "10",
+					Epoch:            "20",
+					Files: map[string]string{
+						"./testdata/testfile.txt": "/usr/share/testfile.txt",
+					},
+					ConfigFiles: map[string]string{
+						"./testdata/testfile.txt": "/etc/nope.conf",
+					},
+					Replacements: map[string]string{
+						"linux": "Tux",
+					},
+				},
+				Overrides: map[string]config.NFPMOverridables{
+					"rpm": {
+						ConfigFiles: map[string]string{
+							"./testdata/testfile.txt": "/etc/nope-rpm.conf",
+						},
+					},
+				},
+			},
+		},
+	})
+	ctx.Version = "1.0.0"
+	ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
+	for _, goos := range []string{"linux", "darwin"} {
+		for _, goarch := range []string{"amd64", "386"} {
+			ctx.Artifacts.Add(&artifact.Artifact{
+				Name:   "mybin",
+				Path:   binPath,
+				Goarch: goarch,
+				Goos:   goos,
+				Type:   artifact.Binary,
+				Extra: map[string]interface{}{
+					"ID": "default",
+				},
+			})
+		}
+	}
+	require.NoError(t, Pipe{}.Run(ctx))
+	var packages = ctx.Artifacts.Filter(artifact.ByType(artifact.LinuxPackage)).List()
+	require.Len(t, packages, 4)
+	for _, pkg := range packages {
+		var format = pkg.ExtraOr("Format", "").(string)
+		require.NotEmpty(t, format)
+		require.Equal(t, pkg.Name, "mybin_1.0.0_Tux_"+pkg.Goarch+"-10-20."+format)
+		require.Equal(t, pkg.ExtraOr("ID", ""), "someid")
+	}
+	require.Len(t, ctx.Config.NFPMs[0].Files, 1, "should not modify the config file list")
+
+	// ensure that no binaries added
+	for _, pkg := range packages {
+		files := pkg.ExtraOr("Files", map[string]string{}).(map[string]string)
+		for _, dest := range files {
+			require.NotEqual(t, "/usr/bin/mybin", dest, "binary file should not be added")
+		}
+	}
+}