rpmbuild ignoring --macros?

Greg_Swift at aotx.uscourts.gov Greg_Swift at aotx.uscourts.gov
Tue Jan 5 14:14:43 UTC 2010

> (sorry for the barrage of questions - and thanks for the answers)
> I've got a macros file that I'd like rpmbuild to use. It seems that
> rpmbuild is ignoring the --macros switch. If I
> $ rpmbuild -qa --macros=mymacros myapp.spec
> it attempts to build below /usr/src/redhat/BUILD
> If I
> $ ln -s $(pwd)/mymacros ~/.rpmmacros
> $ rpmbuild -qa myapp.spec
> I get the behaviour I'm expecting.
> I'd prefer not to have a ~/.rpmmacros and assumed that naming a
> macros file using the --macros switch would be alternative. What am I
> Thanks again.

I just skimmed through the man page for rpmbuild and --macros is not an
option, atleast not on RHEL5 or Fedora8. I dont have access to one of my
newer boxes to check otherwise at the moment.  I also did not see a way of
accessing a file other than the standard ones.

Macro Configuration Files from man page

If you have a specific set of macros per spec/project you could create a
Makefile.  Here is a small example of one of mine.

PACKAGE := $(shell basename *.spec .spec)
RPMBUILD = rpmbuild --define "_topdir %(pwd)/rpm-build" \
        --define "_builddir %{_topdir}" \
        --define "_rpmdir %(pwd)/rpms" \
        --define "_srcrpmdir %{_rpmdir}" \
        --define "_sourcedir  %{_topdir}"

all: rpms

        -rm -rf dist/ build/
        -rm -rf *~
        -rm -rf rpm-build/ rpms/

build: clean
        python setup.py build -f

        python setup.py sdist

prep_rpmbuild: build sdist
        mkdir -p rpm-build
        mkdir -p rpms
        cp dist/*.gz rpm-build/

rpms: prep_rpmbuild
        ${RPMBUILD} -ba ${PACKAGE}.spec

srpm: prep_rpmbuild
        ${RPMBUILD} -bs ${PACKAGE}.spec

All of those indents should be tabs.  Then you would just go into that
directory and type `make` and you would get your rpms.  This is for a
distutils/setuptools oriented python package, but the concept would hold.

just a thought.


More information about the Rpm-list mailing list