From Fedora Project Wiki

No edit summary
Line 22: Line 22:


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.
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.
== Plugins ==
* [[Projects/Mock/Plugin/LvmRoot|lvm_root]] - caching buildroots using LVM
* [[Projects/Mock/Plugin/CompressLogs|compress_logs]] - compress logs


== Using Mock outside your git sandbox ==
== Using Mock outside your git sandbox ==
Line 42: Line 47:
Of course you may copy one and edit it manually, however if koji is already using such an config?
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. E.g.:
Then you can use  '''mock-config --help''' for information how to generate one. E.g.:
  * koji mock-config --tag f21-build --arch=aarch64  f21
  koji mock-config --tag f21-build --arch=aarch64  f21


== See Also ==
== See Also ==

Revision as of 12:05, 24 October 2014

Mock

Mock is a tool for building packages. It can build packages for different architectures and different Fedora or RHEL versions than the build host has. 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.

Status

Mock is currently being used for all Fedora builds. It is called by Koji and Copr to build chroots and packages.

Download

If you want to contribute to code, please checkout https://fedorahosted.org/mock/ for more inforations.

Otherwise just run "yum install mock".

Setup

All users that are to use mock must be added to the 'mock' group.

usermod -a -G mock [User name] && newgrp mock

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.

Plugins

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

mock -r <configname> rebuild package-1.2-3.src.rpm

where <configname> is the name of a configuration from /etc/mock/, without the /etc/mock path prefix and without the .cfg suffix.

Note that you can track the progress of mock using the logs stored in /var/lib/mock/<configfile>/result

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. E.g.:

koji mock-config --tag f21-build --arch=aarch64  f21

See Also