Re: How can I change some values within the spec file during rpmbuild?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 5 Mar 2004 barry@xxxxxxxxxxxxxxxxxxx wrote:

> All,
> 
> How can I change something within the spec file while building the 
> rpm package using rpmbuild command?
> 
> For example, if I have a build number that I need to reflect it in 
> the "release:" field, then can I say something like:
> 
> %define buildnumber 111
> ...
> Release: %{buildnumber}
>
One approach, of which their are many variants are to use the %() macro.
This is very simular to using backticks (i.e. `ls`) in shell or in bash
$().  So here is a variant.  Your wrapper script that calls rpmbuild
writes to a file the build number and your relase line looks like:

	Release:  %(cat /some/file)

Sometimes what goes in %() is a command:

	Release:  %(getBuildNumber)

 
> and when execute rpmbuild, then I type "rpmbuild -bb specfile --
> define 'buildnumber 222'  ???
>
And I think that works too.

Oh, and another thing you can do is write a file that defines the 
macro, you end up with something like this in said file:

	%define buildnumber 222

And then you do this at the top of your spec file:

	%{expr: %(cat /some/file.macro)}

Which gets the contents of the macro file, and then evaluates via 
the macro processor.

I am sure there are other ways...james 


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux