Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have spent around 3 hrs now. How to override a macro during rpm build ? I want to override _sbindir (/usr/sbin) to /opt/sbin I have edited rpm macro files both system and local user files nothing seems to be working for me. I'm using Fedora 12.

share|improve this question

Don't try and override _foo macros. But if you really must, add this to the top of your specfile.

%define _sbindir /foo
share|improve this answer

Have you tried defining it from the rpmbuild command-line? The --showrc switch shows you the "level" at which various macros are defined. There is a hierarchy in case something is defined in more than one place, where -8 (command-line) wins out over -14 (disk, i.e. ~/.rpmmacros file).

$ rpmbuild --showrc | grep ' _sbindir'

-14: _sbindir       %{_exec_prefix}/sbin
%global _sbindir    %{_exec_prefix}/sbin

$ rpmbuild --define "_sbindir wtf" --showrc | grep ' _sbindir'

-8: _sbindir        wtf
%global _sbindir    %{_exec_prefix}/sbin

FWIW, on my CentOD-6 host, the %global is defined in the /etc/rpm/macros.scl file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.