O'Reilly logo
  • Jason Korpics thinks this is interesting:

# ~/.rpmmacros file
# This gets all necessary information from environment variables and 
# system utilities. The first e-mail address on your gnupg keyring 
# should be your own.

%packager               %(finger -l $LOGNAME|sed -n "s/.*Name: //p")
%distribution           Fedora Core %(tr -dc [0-9] </etc/fedora-release)

# The vendor here is the same as the packager. Use a company or
# organization if appropriate.
%vendor                 %{packager}

%_home                  %(echo $HOME)
%_topdir                %{_home}/rpm
%_tmppath               %{_topdir}/tmp
%_builddir              %{_tmppath}

%_rpmtopdir             %{_topdir}/%{name}
%_sourcedir             %{_rpmtopdir}
%_specdir             ...


Cover of Fedora Linux


This does NOT work, the correct syntax is: %_home %{expand:%%(echo $HOME)} or you could do %{expand:%%(cd; pwd)} or finally, you can use %(cd; pwd). Note that the use of he cd command will not result in you being in your home directory when the rpm or rpmbuild programs end.