Installation and configuration
- Download the latest mock rpm from http://pkgs.repoforge.org/mock/
- Install the rpm on your build host
- After the installation is finished, create a new build user
- Now we are ready to create chroots for the different distributions
Create build chroot
To create a new build chroot, use the following command:
In the directory /etc/mock you can find all available distributions.
su build /usr/bin/mock -r <distro name> --init
/usr/bin/mock -r <distro name> --shell
mock-shell> chmod u+s bin/bash
Build packages
Make sure you have src rpm before you build the packages.
Build for EL6
To start a build for EL6 distributions, use:
su build /usr/bin/mock -r epel-6-i386 <path_to_srpm>
After the build is successfully finished, the rpm can be found in /var/lib/mock/epel-6-i386/results/.
Build for EL5
To start a build for EL5 distributions, you have to use some different steps as the older EL5 packages are signed in different format.
When you don't follow these steps, you will get an error like described below:
error: unpacking of archive failed on file /builddir/build/SOURCES/packagename;4a2d234: cpio: MD5 sum mismatch Error installing srpm: packagename.src.rpm
su build /usr/bin/mock -r epel-5-i386 --copyin <path_to_srpm> /tmp /usr/bin/mock -r epel-5-i386 --shell mock-shell> cd /tmp mock-shell> rpm -ihv <srpm> --nomd5 mock-shell> cd /builddir/build/SPECS mock-shell> rpmbuild -bs package.spec mock-shell> exit cp /var/lib/mock/epel-5-i386/root/builddir/build/SRPMS/packagename.el5.src.rpm /home/build /usr/bin/mock -r epel-5-i386 /home/build/packagename.el5.src.rpm
After the build is successfully finished, the rpm can be found in /var/lib/mock/epel-5-i386/results/.