Error trying to sign RPM
Asked Answered
G

3

8

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?

Gutbucket answered 10/8, 2012 at 14:23 Comment(3)
what was the exact solution @vpram86?Brigham
I ended up avoiding macro file and pass all arguments to rpmbuild through multiple --define.Gutbucket
ah okay. I must have something else wrong then because I tried that as well and i am still getting errors. thanks for the responseBrigham
T
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.

Titivate answered 28/8, 2012 at 19:36 Comment(0)
N
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>

Neckwear answered 14/7, 2015 at 22:43 Comment(2)
On CentOS7, passing --define "_gpg_name <your email or name>" --sign to rpmbuild (v4.11.3) does not work - the error is "You must set "%_gpg_name" in your macro file".Dhruv
@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.Crosspollinate
T
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.

Titivate answered 28/8, 2012 at 19:36 Comment(0)
T
2

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

Talkfest answered 22/8, 2016 at 8:28 Comment(1)
According to the doc: Defining any new macros in the ~/.rpmmacros file is not recommended. Such macros would not be present on other machines, where users may want to try to rebuild your package.Griffy

© 2022 - 2024 — McMap. All rights reserved.