This page printed from: https://www.linuxmonth.com/issue4/tips/tip7.html?print=1
To build a rpm as a user and not as a root you need to setup a similar directory structure as your system requires. Under Caldera the RPMs are built under /usr/src/OpenLinux. Under Redhat it's under /usr/src/redhat.
The above directories contain the following subdirectories
./RPMS ./RPMS/i386 ./SOURCES ./SPECS ./SRPMS ./BUILD
First create a directory that will be your base RPM environment. I've set it up this way.
mkdir /home/username/myrpms
Edit the file /home/username/.rpmmacros with your favorite editor to include the line
%_topdir /home/username/myrpms
Thank to Tom Rothamel for this tip.