How to undefine macro on rpmbuild command line?

Panu Matilainen pmatilai at laiskiainen.org
Fri Apr 12 19:56:59 UTC 2013


On 04/12/2013 06:06 PM, Miroslav Suchý wrote:
> Hi,
> I'm building packages for software collection (SC). And I'm trying set
> up our environment, that we are able to build SC and regular package
> from one spec.
>
> I have 4 options how I can build package:
>
> 1) When I do not have meta-package installed (just for record meta
> package only includes one file /etc/rpm/macros.ruby193-config, which
> only contains this definition:
> %scl ruby193
> ) So when I do not have this package installed and want to build regular
> package I will run:
>    rpmbuild -ba foo.spec
> And this will probuce foo.rpm.
>
> 2) When I do not have meta package installed and I run:
>    rpmbuild -ba --define 'scl ruby193' foo.spec
> it will produce ruby193-foo.rpm
>
> 3) When I have meta package installed and I run:
>    rpmbuild -ba foo.spec
> it will produce ruby193-foo.rpm
>
> 4) And now I have meta package and despite it I want to produce regular
> package (i.e foo.rpm). How can I achieve it?
> I tried to experiment with something like:
>    rpmbuild -ba --define '%undefine scl' foo.spec
> but neither this nor everything else I tried work.
>
> So my question is: How can I undefine macro on rpmbuild command line?

Rpm >= 4.10.2 has --undefine cli switch (eg '--undefine scl'), with 
older versions you need to abuse --eval to achieve that, eg
--eval '%undefine scl'

	- Panu -


More information about the Rpm-list mailing list