Remi's RPM repository - Blog - Mot-clé - mock
Remi's RPM repository blog Information about RPM PHP Fedora RHEL and CentOS
2024-03-28T14:46:28+01:00
Remi Collet
urn:md5:04ca934806743f3bda12513f927cafa9
Dotclear
new builder, new mock configuration
urn:md5:a226b7df5d58e756b580a08380e5dc8a
2011-01-11T20:21:00+01:00
2023-09-15T09:13:17+02:00
Remi
General
builder
Contributeur
mock
<p>As I have a <a href="https://blog.remirepo.net/post/2011/01/08/New-Computer">new builder</a>, I spend some time to optimize my configuration.</p> <p>Mainly to use the space available in <a href="http://en.wikipedia.org/wiki/Tmpfs" hreflang="en">tpmfs</a> (up to 6Gio), rather than some disk space (which is slow and noisy).</p>
<p>Before, <a href="http://fedoraproject.org/wiki/Projects/Mock" hreflang="en">mock</a> launch the build using space (<strong>basedir</strong>) in /var/lib/mock (a stripped LV for me).</p>
<p>To free the build space used as soon as possible, I use the <strong>cleanup_on_success</strong> option. But this doesn't work because of <a href="https://bugzilla.redhat.com/668222" hreflang="en">a little bug in mock (#668222)</a>, until I find a simple workaround patch (which need to be improved).</p>
<p>I also use the<strong> createrepo_on_rpms</strong> option and configure the <strong>resultdir</strong> 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).</p>
<p>There is also <a href="https://bugzilla.redhat.com/668278" hreflang="en">another little bug in mock (#668278)</a>, which impose me to use the root account to clean the <strong>resultdir</strong> (I hope this will be fixed by upstream).</p>
<p>So, here is one of my mock configuration file (for fedora 14 x86_64) :</p>
<pre>
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/
"""</pre>
<p>I hopes it could help others, as it seems to work really well.</p>
<p>Here is an exemple :</p>
<pre>
$ 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</pre>
<p>Yes, only 13" :)</p>
<p>This is a small and simple package, <strong>rpmbuild</strong> take around 4", so I can say that <strong>mock</strong> 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.</p>