Mock, the Fedora tool for maintaining standard buildroots and building rpm’s in them, can also be used to build packages for Red Hat Enterprise Linux (RHEL).
As an example, to create a mock buildroot for RHEL4, you need to:
Create a yum repository with the RPM's for RHEL4 in them. One way to do that is to download the ISO files for RHEL4 from [RHN](http://rhn.redhat.com/) and copy the RPM's from them into a new directory and run `createrepo` on that directory. There are also tools out there to help with that, e.g. [Yam](http://dag.wieers.com/home-made/yam/).
Create a second yum repository for the mock-specific RPM's for a buildroot. These are [buildsys-build](http://watzmann.net/software/mock/rhel4/buildsys-build.spec) , which defines what RPM's make up the initial or 'minimal' build root, and [buildsys-macros](http://watzmann.net/software/mock/rhel4/buildsys-macros.spec), which defines the `%dist` and `%rhel` macros, similar to the same package for Fedora. (An unmaintained example for such a repo can be found [here](http://watzmann.net/software/mock/rhel4/yum/))
Download the [mock config file](http://watzmann.net/software/mock/rhel4/rhel-4-i386.cfg) and adapt it to your local needs, in particular adjust the URL's for the yum repos in it.
If you want to rebuild buildsys-build and buildsys-macros from their specfiles, note that you need to define the %rhel macro on the command line like
%%
rpmbuild –define ‘rhel 4’ buildsys-build.spec
%%