6

I am trying to build and sign an RPM. I created my .rpmmacro file in the location I am building /path/to/macrodir/ Then I am using --define with _topdir referring to /path/to/macrodir/

If I build the RPM without giving --sign; its working fine.

rpmbuild --define "_topdir /path/to/macrodir" -bb spec

The .rpmmacro is in macrodir and contains

%_signature gpg
%_gpg_name Name (Comment) <emailid>
%_gpgpath pathtognupgfolder
%_gpgbin locationofgpgexec

If I include --sign then its throwing the error

rpmbuild --define "_topdir /path/to/macrodir" -bb --sign spec

error: You must set "%_gpg_name" in your macro file

I am not able to see what I am doing wrong. Any suggestions?

vpram86
  • 5,860
  • 4
  • 28
  • 40

3 Answers3

5

As the OP mentioned in a comment, setting the %gpg_name macro via a --define flag to rpm/rpmbuild/rpmsign works.

rpm --define "_gpg_name <your email or name>" --addsign <RPM to sign>

Community
  • 1
  • 1
dfarrell07
  • 2,872
  • 2
  • 21
  • 26
  • On CentOS7, passing --define "_gpg_name " --sign to rpmbuild (v4.11.3) does not work - the error is "You must set "%_gpg_name" in your macro file". – Graham Leggett Aug 03 '17 at 14:13
  • @GrahamLeggett I just tried it after setting up a second key for a different repo and I didn't get that error in the slightest. So unless that's been changed in a package there is a configuration error on your end. – Pryftan Apr 29 '18 at 17:35
4

Follow this detailed writeup on how to sign custom rpm pacakge.

I faced a different problem, when running the following command it failed complaining no rpm file found.

rpm --addsign gyum-2.0-5.FC3.i386.rpm

After installing rpmsign package everything worked.

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
ravi.chunduru
  • 196
  • 2
  • 6
2

At least on my machine the file is called .rpmmacros (with an s).

pi3
  • 1,235
  • 13
  • 15