How to use mock to build packages for SLC
Introduction
Mock project web page is here:
http://www.fedoraproject.org/wiki/Projects/Mock (mock parameters explained).
Installation of mock
You need to install mock version => 0.6 (in older there is hard to change location of directory with config files). I did it that way:
wget http://linuxsoft.cern.ch/fedora/linux/extras/5/SRPMS/mock-0.6.8-3.fc5.src.rpm
rpmbuild --rebuild mock-0.6.8-3.fc5.src.rpm
rpm -i /usr/src/redhat/RPMS/`uname -i`/mock-0.6.8-3.`uname -i`.rpm
Configuration
As it is written in documentation: "Builds are done in /var/lib/mock, so be sure you have room. It cannot really be changed, but you can bind mount another directory on top of /var/lib/mock to use a bigger filesystem if needed."
Add yourself to mock group. Setup some workspace directory and copy there config file (see -
slc-4-i386-core.cfg)
mkdir workspace
cd workspace
mkdir results
cp ?/slc-4-i386-core.cfg .
Change file
slc-4-i386-core.cfg
, following :
config_opts['buildgroup'] = 'build'
config_opts['chrootuser'] = 'mockbuild'
config_opts['chrootgroup'] = 'mockbuild'
Creation of (ch)root directory
Following command shall create directory
/var/lib/mock/slc-4-i386-core-01
mock init -r slc-4-i386-core.cfg --configdir=. --resultdir=results --uniqueext=01
Unfortunately, SLC repo doesn't contain package buildsys-build, so we need to install mock in this chroot environment manually.
/usr/sbin/mock-helper yum --installroot /var/lib/mock/slc-4-i386-core-01/root install /usr/src/redhat/RPMS/i386/mock-0.6.8-1.i386.rpm
You will also need to install following packages:
/usr/sbin/mock-helper yum --installroot /var/lib/mock/slc-4-i386-core-01/root install rpm-build
Missing packages
But there are still some packages missing:
/usr/sbin/mock-helper yum --installroot /var/lib/mock/slc-4-i386-core-01/root install make gcc bison flex diffutils bzip2 cvs automake
Building
Sample SRPMs rebuilding could be done using following command:
mock rebuild -r slc-4-i386-core.cfg --debug --no-clean --configdir=. --resultdir=results --uniqueext=01 /afs/cern.ch/project/linux/cern/slc44/SRPMS/zsh-4.2.0-3.EL.3.src.rpm
You will find final RPM packages in
results directory