rpm nuggets

As I find out new (to me) items about building RPM’s, I’ll post them here — not that the info isn’t out there already, it is just kinda hard to find.

The first item is something that anyone who gets past the “oh I built an RPM” stage ponders: How do you pass in the version and release information so you don’t have to keep editing the .spec file.

On the @rpmbuild@ command line, you can define macros. This allows you to reference the macro values in the .spec file. For example:

bq. @rpmbuild -ba –define “name value” –define “name2 value2″ foo.spec@

and in foo.spec you can have:

bq. Version: %{name}
Release: %{name2}

That is all there is to it — now for extra credit locate any mention in the man page or any online web page of –define :)

A handy file to scan thru to see the possibilities for macros is /usr/lib/rpm/macros (well at least that’s where it is on my “ubuntu”:http://www.ubuntulinux.org server.)


Tags:

 
 
 

Comments are closed.