new builder, new mock configuration
+
Par Remi le mardi 11 janvier 2011, 20:21 - General - Lien permanent
As I have a new builder, I spend some time to optimize my configuration.
Mainly to use the space available in tpmfs (up to 6Gio), rather than some disk space (which is slow and noisy).
Before, mock launch the build using space (basedir) in /var/lib/mock (a stripped LV for me).
To free the build space used as soon as possible, I use the cleanup_on_success option. But this doesn't work because of a little bug in mock (#668222), until I find a simple workaround patch (which need to be improved).
I also use the createrepo_on_rpms option and configure the resultdir as a repository which will be used by next build. This is really useful, as this avoid to update my main repository (which is quite big, so quite long to update).
There is also another little bug in mock (#668278), which impose me to use the root account to clean the resultdir (I hope this will be fixed by upstream).
So, here is one of my mock configuration file (for fedora 14 x86_64) :
config_opts['root'] = 'fc14x' config_opts['target_arch'] = 'x86_64' config_opts['chroot_setup_cmd'] = 'groupinstall buildsys-build' config_opts['dist'] = 'fc14' # only useful for --resultdir variable subst config_opts['plugin_conf']['ccache_enable'] = True config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '1G' config_opts['plugin_conf']['ccache_opts']['dir'] = "/dev/shm/ccache.fc14x/" config_opts['basedir'] = '/dev/shm/' config_opts['resultdir'] = "/var/lib/mock/fc14x" config_opts['cleanup_on_success'] = True config_opts['cleanup_on_failure'] = False config_opts['createrepo_on_rpms'] = True config_opts['createrepo_command'] = '/usr/bin/createrepo -d -q -x *.src.rpm' config_opts['macros']['%_topdir']="/builddir/build" config_opts['macros']['%_smp_mflags']="-j3" config_opts['macros']['%vendor']="Remi Collet" config_opts['macros']['%packager']="http://blog.famillecollet.com/" config_opts['macros']['%dist']=".fc14.remi" config_opts['macros']['%fedora']="14" config_opts['macros']['%_with_ibase']="1" config_opts['macros']['%_with_oci8']="1" config_opts['macros']['%runselftest']="1" config_opts['yum.conf'] = """ [main] cachedir=/var/cache/yum debuglevel=1 reposdir=/dev/null logfile=/var/log/yum.log retries=20 obsoletes=1 gpgcheck=0 assumeyes=1 # repositories [fedora] name=fedora mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-14&arch=x86_64 [updates-released] name=updates mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f14&arch=x86_64 [remi] name=remi public baseurl=file:/home/rpmbuild/site/rpms/fedora/14/remi/x86_64/ [remi-priv] name=remi prive baseurl=file:/home/rpmbuild/site/rpms/priv/x86_64/ [result] name=result baseurl=file:/var/lib/mock/fc14x/ """
I hopes it could help others, as it seems to work really well.
Here is an exemple :
$ mock --configdir=/var/lib/mock/etc -r fc14x rebuild php-phpunit-PHPUnit-3.5.7-1.remi.src.rpm INFO: mock.py version 1.1.7 starting... State Changed: init plugins INFO: selinux enabled State Changed: start INFO: Start(/home/extras/SRPMS/php-phpunit-PHPUnit-3.5.7-1.remi.src.rpm) Config(fc14x) State Changed: lock buildroot State Changed: clean State Changed: init State Changed: lock buildroot Mock Version: 1.1.7 INFO: Mock Version: 1.1.7 INFO: enabled root cache State Changed: unpacking root cache INFO: enabled yum cache State Changed: cleaning yum metadata INFO: enabled ccache State Changed: running yum State Changed: setup State Changed: build INFO: Done(/home/extras/SRPMS/php-phpunit-PHPUnit-3.5.7-1.remi.src.rpm) Config(fc14x) 0 minutes 13 seconds INFO: Results and/or logs in: /var/lib/mock/fc14x INFO: Cleaning up build root ('clean_on_success=True') State Changed: lock buildroot State Changed: clean INFO: chroot (/dev/shm/fc14x) unlocked and deleted INFO: Running createrepo on binary rpms in resultdir
Yes, only 13" :)
This is a small and simple package, rpmbuild take around 4", so I can say that mock overhead is only 9" with this configuration. Really acceptable. No reason to keep using rpmbuild and definitively prefer the sane build environment provided by mock.
Commentaires
Since Fedora 16, by default, /dev/shm is mount with (rw,nosuid,nodev,seclabel) options which are not compatible for this use.
You need to edit your fstab, p.e.:
And then to switch to the new options
And, it will be mount with (rw,relatime,seclabel,size=12582912k) which is ok.