Repository: goreleaser/goreleaser
Pull request #2892 (2022-02-08 15:11:05)

feat: lintian overrides
allow to more easily set lintian overrides  

codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2892?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) Report
> Merging [#2892](https://codecov.io/gh/goreleaser/goreleaser/pull/2892?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (3f0d56b) into [main](https://codecov.io/gh/goreleaser/goreleaser/commit/c457d8fff7b24ce9f04c3c38d06e3e35af03e6c7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (c457d8f) will **decrease** coverage by `0.03%`.
> The diff coverage is `71.42%`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/goreleaser/pull/2892/graphs/tree.svg?width=650&height=150&src=pr&token=3bJvv6b7hN&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)](https://codecov.io/gh/goreleaser/goreleaser/pull/2892?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)

```diff
@@            Coverage Diff             @@
##             main    #2892      +/-   ##
==========================================
- Coverage   84.53%   84.49%   -0.04%     
==========================================
  Files         111      111              
  Lines        8882     8903      +21     
==========================================
+ Hits         7508     7523      +15     
- Misses       1105     1109       +4     
- Partials      269      271       +2     
```


| [Impacted Files](https://codecov.io/gh/goreleaser/goreleaser/pull/2892?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) | Coverage Δ | |
|---|---|---|
| [pkg/config/config.go](https://codecov.io/gh/goreleaser/goreleaser/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `87.15% <ø> (ø)` | |
| [internal/pipe/nfpm/nfpm.go](https://codecov.io/gh/goreleaser/goreleaser/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser#diff-aW50ZXJuYWwvcGlwZS9uZnBtL25mcG0uZ28=) | `93.41% <71.42%> (-1.55%)` | :arrow_down: |

------

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


Patch:
diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml
index 737500b8..46cc0c06 100644
--- a/.github/ISSUE_TEMPLATE/bug.yaml
+++ b/.github/ISSUE_TEMPLATE/bug.yaml
@@ -49,7 +49,7 @@ body:
     id: terms
     attributes:
       label: Code of Conduct
-      description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/goreleaser/goreleaser/blob/main/CODE_OF_CONDUCT.md)
+      description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md)
       options:
         - label: I agree to follow this project's Code of Conduct
           required: true
diff --git a/.github/ISSUE_TEMPLATE/feature.yaml b/.github/ISSUE_TEMPLATE/feature.yaml
index 10f7a062..01c30e0b 100644
--- a/.github/ISSUE_TEMPLATE/feature.yaml
+++ b/.github/ISSUE_TEMPLATE/feature.yaml
@@ -40,7 +40,7 @@ body:
     id: terms
     attributes:
       label: Code of Conduct
-      description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/goreleaser/goreleaser/blob/main/CODE_OF_CONDUCT.md)
+      description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md)
       options:
         - label: I agree to follow this project's Code of Conduct
           required: true
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index b1d69e5a..4a3060fb 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -240,11 +240,6 @@ nfpms:
         dst: /usr/share/doc/goreleaser/copyright
         file_info:
           mode: 0644
-      - src: .lintian-overrides
-        dst: ./usr/share/lintian/overrides/goreleaser
-        packager: deb
-        file_info:
-          mode: 0644
     formats:
     - apk
     - deb
@@ -253,6 +248,10 @@ nfpms:
     - git
     recommends:
     - golang
+    deb:
+      lintian_overrides:
+        - statically-linked-binary
+        - changelog-file-missing-in-native-package
 
 snapcrafts:
   - name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
diff --git a/.lintian-overrides b/.lintian-overrides
deleted file mode 100644
index e5fecda4..00000000
--- a/.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-goreleaser: statically-linked-binary
-goreleaser: changelog-file-missing-in-native-package
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index e9f6fc56..00000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-- Using welcoming and inclusive language
-- Being respectful of differing viewpoints and experiences
-- Gracefully accepting constructive criticism
-- Focusing on what is best for the community
-- Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-- The use of sexualized language or imagery and unwelcome sexual attention or
-  advances
-- Trolling, insulting/derogatory comments, and personal or political attacks
-- Public or private harassment
-- Publishing others' private information, such as a physical or electronic
-  address, without explicit permission
-- Other conduct which could reasonably be considered inappropriate in a
-  professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at root@carlosbecker.com. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 24e4bad7..0dc047ef 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,6 +1,6 @@
 # Contributing
 
-By participating to this project, you agree to abide our [code of conduct](https://github.com/goreleaser/goreleaser/blob/main/CODE_OF_CONDUCT.md).
+By participating to this project, you agree to abide our [code of conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md).
 
 ## Setup your machine
 
diff --git a/LICENSE.md b/LICENSE.md
index 627b19c3..ccc9c229 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2016-2021 Carlos Alexandro Becker
+Copyright (c) 2016-2022 Carlos Alexandro Becker
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 103e8dd0..1ae72edc 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,8 @@
 GoReleaser builds Go binaries for several platforms, creates a GitHub release and then
 pushes a Homebrew formula to a tap repository. All that wrapped in your favorite CI.
 
-This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
+This project adheres to the Contributor Covenant [code of conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md).
+By participating, you are expected to uphold this code.
 We appreciate your contribution. Please refer to our [contributing guidelines](CONTRIBUTING.md) for further information.
 
 For questions, support and general discussion, please use [GitHub Discussions](https://github.com/goreleaser/goreleaser/discussions);
diff --git a/USERS.md b/USERS.md
index 9d21676e..3c5083fe 100644
--- a/USERS.md
+++ b/USERS.md
@@ -9,6 +9,7 @@ Here's a running list of some organizations using GoReleaser[^1]:
 1. [Charm](https://charm.sh)
 1. [Comcast](https://comcast.github.io)
 1. [Compose Generator](https://www.compose-generator.com)
+1. [Conduit](https://www.conduit.io/)
 1. [CrowdStrike](https://www.crowdstrike.com)
 1. [DeepSource](https://deepsource.io)
 1. [EVCC](https://evcc.io)
diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go
index 586465c1..ce4aeda6 100644
--- a/internal/pipe/nfpm/nfpm.go
+++ b/internal/pipe/nfpm/nfpm.go
@@ -186,6 +186,30 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
 		})
 	}
 
+	if len(fpm.Deb.Lintian) > 0 {
+		lines := make([]string, 0, len(fpm.Deb.Lintian))
+		for _, ov := range fpm.Deb.Lintian {
+			lines = append(lines, fmt.Sprintf("%s: %s", fpm.PackageName, ov))
+		}
+		lintianPath := filepath.Join(ctx.Config.Dist, "deb", fpm.PackageName, ".lintian")
+		if err := os.MkdirAll(filepath.Dir(lintianPath), 0o755); err != nil {
+			return fmt.Errorf("failed to write lintian file: %w", err)
+		}
+		if err := os.WriteFile(lintianPath, []byte(strings.Join(lines, "\n")), 0o644); err != nil {
+			return fmt.Errorf("failed to write lintian file: %w", err)
+		}
+
+		log.Infof("creating %q", lintianPath)
+		contents = append(contents, &files.Content{
+			Source:      lintianPath,
+			Destination: filepath.Join("./usr/share/lintian/overrides", fpm.PackageName),
+			Packager:    "deb",
+			FileInfo: &files.ContentFileInfo{
+				Mode: 0o644,
+			},
+		})
+	}
+
 	log := log.WithField("package", fpm.PackageName).WithField("format", format).WithField("arch", arch)
 
 	// FPM meta package should not contain binaries at all
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 8c8e762c..8aef1b8b 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -615,6 +615,7 @@ type NFPMDeb struct {
 	Triggers  NFPMDebTriggers  `yaml:"triggers,omitempty"`
 	Breaks    []string         `yaml:"breaks,omitempty"`
 	Signature NFPMDebSignature `yaml:"signature,omitempty"`
+	Lintian   []string         `yaml:"lintian_overrides,omitempty"`
 }
 
 type NFPMAPKScripts struct {
diff --git a/www/docs/contributing.md b/www/docs/contributing.md
index 24e4bad7..0dc047ef 100644
--- a/www/docs/contributing.md
+++ b/www/docs/contributing.md
@@ -1,6 +1,6 @@
 # Contributing
 
-By participating to this project, you agree to abide our [code of conduct](https://github.com/goreleaser/goreleaser/blob/main/CODE_OF_CONDUCT.md).
+By participating to this project, you agree to abide our [code of conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md).
 
 ## Setup your machine
 
diff --git a/www/docs/customization/nfpm.md b/www/docs/customization/nfpm.md
index 8be0f3c0..6c0c2e5b 100644
--- a/www/docs/customization/nfpm.md
+++ b/www/docs/customization/nfpm.md
@@ -287,6 +287,11 @@ nfpms:
 
     # Custom configuration applied only to the Deb packager.
     deb:
+      # Lintian overrides
+      lintian_overrides:
+        - statically-linked-binary
+        - changelog-file-missing-in-native-package
+
       # Custom deb special files.
       scripts:
         # Deb rules script.
diff --git a/www/docs/links.md b/www/docs/links.md
index 1c4abfe0..7b6dacdc 100644
--- a/www/docs/links.md
+++ b/www/docs/links.md
@@ -9,5 +9,5 @@
 - [Contributing Guidelines](https://github.com/goreleaser/goreleaser/blob/main/CONTRIBUTING.md)
 
 This project adheres to the Contributor Covenant
-[code of conduct](https://github.com/goreleaser/goreleaser/blob/main/CODE_OF_CONDUCT.md).
+[code of conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md).
 By participating, you are expected to uphold this code.
diff --git a/www/docs/users.md b/www/docs/users.md
index 9d21676e..3c5083fe 100644
--- a/www/docs/users.md
+++ b/www/docs/users.md
@@ -9,6 +9,7 @@ Here's a running list of some organizations using GoReleaser[^1]:
 1. [Charm](https://charm.sh)
 1. [Comcast](https://comcast.github.io)
 1. [Compose Generator](https://www.compose-generator.com)
+1. [Conduit](https://www.conduit.io/)
 1. [CrowdStrike](https://www.crowdstrike.com)
 1. [DeepSource](https://deepsource.io)
 1. [EVCC](https://evcc.io)


Test patch:
diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go
index 6e1078a4..1eb33f33 100644
--- a/internal/pipe/nfpm/nfpm_test.go
+++ b/internal/pipe/nfpm/nfpm_test.go
@@ -598,6 +598,10 @@ func TestDebSpecificConfig(t *testing.T) {
 						Signature: config.NFPMDebSignature{
 							KeyFile: "./testdata/privkey.gpg",
 						},
+						Lintian: []string{
+							"statically-linked-binary",
+							"changelog-file-missing-in-native-package",
+						},
 					},
 				},
 			},
@@ -633,6 +637,10 @@ func TestDebSpecificConfig(t *testing.T) {
 			"NFPM_SOMEID_PASSPHRASE": "hunter2",
 		}
 		require.NoError(t, Pipe{}.Run(ctx))
+
+		bts, err := os.ReadFile(filepath.Join(dist, "deb/foo/.lintian"))
+		require.NoError(t, err)
+		require.Equal(t, "foo: statically-linked-binary\nfoo: changelog-file-missing-in-native-package", string(bts))
 	})
 
 	t.Run("packager specific passphrase set", func(t *testing.T) {