Repository: goreleaser/nfpm
Pull request #266 (2020-12-21 18:12:38)

Fix RPM Verify signature: BAD PARAMETERS when installing from a repo, but not a local file
I have been able to reproduce issue #265 in the acceptance tests. I will work on a fix.

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 below or on the icon next to each commit.

🔍 Inspect: [https://vercel.com/goreleaser/nfpm/fm9qropr0](https://vercel.com/goreleaser/nfpm/fm9qropr0)  
✅ Preview: [https://nfpm-git-issue-265.goreleaser.vercel.app](https://nfpm-git-issue-265.goreleaser.vercel.app)


codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/nfpm/pull/266?src=pr&el=h1) Report
> Merging [#266](https://codecov.io/gh/goreleaser/nfpm/pull/266?src=pr&el=desc) (bfa290e) into [master](https://codecov.io/gh/goreleaser/nfpm/commit/c4ae30d7495b391ffd383de6b96ebd2159b25a6a?el=desc) (c4ae30d) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master     #266   +/-   ##
=======================================
  Coverage   70.38%   70.38%           
=======================================
  Files           9        9           
  Lines        1138     1138           
=======================================
  Hits          801      801           
  Misses        209      209           
  Partials      128      128           
```



------

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


Patch:
diff --git a/go.mod b/go.mod
index 9f00832..228edab 100644
--- a/go.mod
+++ b/go.mod
@@ -45,3 +45,5 @@ require (
 	gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
 	mvdan.cc/gofumpt v0.0.0-20201129102820-5c11c50e9475 // indirect
 )
+
+replace github.com/google/rpmpack => github.com/djgilcrease/rpmpack v0.0.0-20201221224521-5ac1d3b45cee
diff --git a/go.sum b/go.sum
index 204e1c4..30a96b1 100644
--- a/go.sum
+++ b/go.sum
@@ -87,6 +87,8 @@ github.com/denis-tingajkin/go-header v0.3.1 h1:ymEpSiFjeItCy1FOP+x0M2KdCELdEAHUs
 github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0=
 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
+github.com/djgilcrease/rpmpack v0.0.0-20201221224521-5ac1d3b45cee h1:2u15NiDCpocHztN+7rvPuklKbmzeZDXmRu6qk49bll8=
+github.com/djgilcrease/rpmpack v0.0.0-20201221224521-5ac1d3b45cee/go.mod h1:+y9lKiqDhR4zkLl+V9h4q0rdyrYVsWWm6LLCQP33DIk=
 github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
 github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
@@ -208,8 +210,6 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi
 github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
 github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
-github.com/google/rpmpack v0.0.0-20201206194719-59e495f2b7e1 h1:BRIy5qQZKSC/nthA5ueW547F73BV5hMoIoxhPfhxa3k=
-github.com/google/rpmpack v0.0.0-20201206194719-59e495f2b7e1/go.mod h1:+y9lKiqDhR4zkLl+V9h4q0rdyrYVsWWm6LLCQP33DIk=
 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=


Test patch:
diff --git a/rpm/rpm_test.go b/rpm/rpm_test.go
index a3ddfd2..7915b8f 100644
--- a/rpm/rpm_test.go
+++ b/rpm/rpm_test.go
@@ -606,7 +606,7 @@ func TestRPMSignature(t *testing.T) {
 
 	_, sigs, err := rpmutils.Verify(bytes.NewReader(rpmBuffer.Bytes()), keyring)
 	require.NoError(t, err)
-	require.Len(t, sigs, 1)
+	require.Len(t, sigs, 2)
 }
 
 func TestRPMSignatureError(t *testing.T) {
diff --git a/testdata/acceptance/keys/test.rpm.repo b/testdata/acceptance/keys/test.rpm.repo
new file mode 100644
index 0000000..f4ffb17
--- /dev/null
+++ b/testdata/acceptance/keys/test.rpm.repo
@@ -0,0 +1,7 @@
+[nfpm-test]
+name=NFPM Testing
+baseurl=file:///tmp
+enabled=1
+gpgcheck=1
+gpgkey = file:///tmp/pubkey.asc
+sslverify=0
\ No newline at end of file
diff --git a/testdata/acceptance/rpm.signed.dockerfile b/testdata/acceptance/rpm.signed.dockerfile
index 0eb30ec..2965deb 100644
--- a/testdata/acceptance/rpm.signed.dockerfile
+++ b/testdata/acceptance/rpm.signed.dockerfile
@@ -1,10 +1,15 @@
-FROM fedora
+FROM centos:7
 ARG package
 COPY keys/pubkey.asc /tmp/pubkey.asc
 COPY ${package} /tmp/foo.rpm
 
 RUN rpm --import /tmp/pubkey.asc
-RUN rpm -K /tmp/foo.rpm | grep ": digests signatures OK"
+RUN rpm -K /tmp/foo.rpm | grep "pgp OK"
 RUN rpm -K /tmp/foo.rpm -v | grep "RSA/SHA256 Signature, key ID 15bd80b3: OK"
 
-RUN rpm -i /tmp/foo.rpm
+# Test with a repo
+RUN yum install -y createrepo yum-utils
+RUN rm -rf /etc/yum.repos.d/*.repo
+COPY keys/test.rpm.repo /etc/yum.repos.d/test.rpm.repo
+RUN createrepo /tmp
+RUN yum install -y foo