From Fedora Project Wiki

(mentioned cfg generation)
(delete this page)
(46 intermediate revisions by 6 users not shown)
Line 1: Line 1:
= Mock =
Mock creates chroots and builds packages in them. Its only task is to reliably populate a chroot and attempt to build a package in that chroot.
= This page is not maintained anymore. It has been moved to =
== Status ==
Mock is currently being used for all Fedora builds. It is called by [[Koji]] to build chroots and packages.
== Download == has all the latest builds.  It can be installed with "yum install mock".
To check out the current code:
* <code>git clone git:// mock</code>
== Setup ==
All users that are to use mock must be added to the 'mock' group.
<code>usermod -a -G mock [User name] && newgrp mock</code>
Configuration files are in /etc/mock.  Mock versions 0.8.0 and higher cache the downloaded rpm packages (via the yum_cache plugin), which speeds up subsequent builds by a considerable margin. Nevertheless, you may wish to change the default configuration to point to local repositories to speed up builds.
By default, builds are done in /var/lib/mock, so be sure you have room. Starting with mock 0.8.0 and higher, you can change this via the 'basedir' config option.
== Using Mock outside your git sandbox ==
Create your SRPM using 'rpmbuild -bs'. Then change to the directory where your srpm was created.
Now you can start mock with
<code>mock -r <configname> rebuild package-1.2-3.src.rpm</code>
where <configname> is the name of a configuration from /etc/mock/, without the /etc/mock path prefix and without the .cfg suffix.
If using mock version older than 0.8.8 or on a system with python 2.4, and building i386 packages on x86_64, prepend setarch i386 to the mock command line: setarch i386 mock -r <configfile> rebuild package-1.2-3.src.rpm. Newer versions of mock no longer need the setarch command, although it does not hurt anything if it is there.
Note that you can track the progress of mock using the logs stored in <code>/var/lib/mock/<configfile>/result</code>
== Problems ==
If you encounter a bug running mock, please file it in [ Bugzilla], product "Fedora", component mock ([ Open Bugs]).
If your problem is specific to EPEL, then [ file it] against the "Fedora EPEL" product instead ([ Open Bugs]).
== Generate custom config file ==
Of course you may copy one and edit it manually, however if koji is already using such an config?
Then you can use  '''mock-config --help''' for information how to generate one.
* eg koji mock-config --tag f21-build --arch=aarch64  f21
== See Also ==
* [[Using_Mock_to_test_package_builds]]  has some useful tips for using mock.
* [[Docs/Drafts/MockSetupUsingLocalMirror]]  Setting up a local mirror using Mock.
* [[Legacy/Mock]]  has some useful tips for building packages in mock for older Fedora and Red Hat Linux releases.

Latest revision as of 11:36, 11 October 2016

This page is not maintained anymore. It has been moved to