.TH "mock" "1" "1.3.2-2"VERSION@" "Seth Vidal" "" .SH "NAME" .LP mock \- build SRPMs in a chroot .SH "SYNTAX" .LP mock [options] \fB\-\-rebuild\fR \fISRPM [\fISRPM...\fR] .LP mock [options] \fB\-\-buildsrpm\fR {\-\-spec \fIspec\fR \-\-sources \fIsrc\fR \-\-symlink\-dereference | \-\-scm\-enable} .LP mock [options] \fB\-\-chroot\fR \fI\fR .LP mock [options] {\fB\-\-init\fR|\fBclean\fR|\fBshell\fR} .LP mock [options] \fB\-\-installdeps\fR {SRPM|RPM} .LP mock [options] \fB\-i\fR, \fB\-\-install\fR PACKAGE [\fIPACKAGE...\fR] .LP mock [options] \fB\-\-update\fR [\fIPACKAGE...\fR] .LP mock [options] \fB\-\-remove\fR PACKAGE [\fIPACKAGE...\fR] .LP mock [options] \fB\-\-orphanskill\fR .LP mock [options] \fB\-p\fR, \fB\-\-print\-root\-path\fR .LP mock [options] \fB\-\-copyin\fR \fIpath [\fIpath...\fR] \fIdestination\fR .LP mock [options] \fB\-\-copyout\fR \fIpath [\fIpath...\fR] \fIdestination\fR .LP mock [options] \fB\-\-scm\-enable\fR [\fI\-\-scm\-option key=value ...\fR] .LP mock [options] \fB\-l\fR, \fB\-\-list\-snapshots\fR .LP mock [options] \fB\-\-snapshot\fR [\fIsnapshot\-name\fR] .LP mock [options] \fB\-\-rollback\-to\fR [\fIsnapshot\-name\fR] .LP mock [options] \fB\-\-remove\-snapshot\fR [\fIsnapshot\-name\fR] .LP mock [options] \fB\-\-umount\fR .LP mock [options] \fB\-\-pm\-cmd\fR [\fIarguments ...\fR] .LP mock [options] \fB\-\-yum\-cmd\fR [\fIarguments ...\fR] .LP mock [options] \fB\-\-dnf\-cmd\fR [\fIarguments ...\fR] .SH "DESCRIPTION" .LP Mock is a simple program that will build source RPMs inside a chroot. It doesn't do anything terribly fancy other than populate a chroot with the contents specified by a configuration file, then build any input SRPM(s) in that chroot. .LP The content of a chroot is specified by the configuration specified with the \fB\-r\fR option. The default configuration file is /etc/mock/default.cfg, which is usually a symlink to one of the installed configurations. .LP There is a site-wide configuration file, /etc/mock/site\-defaults.cfg, which can be used to specify site\-wide options. The shipped version of this file has no active options, but does have a list of all of the configuration options, examples of how to set them, and their default values. .LP For backwards compatibility, old-style commands, ("rebuild", "init", "clean", etc.) without leading '\-\-' are still accepted, but are deprecated. See COMMANDS section, below, for detailed listing of all commands. .LP To use mock, a user should become a member of the \fBmock\fR group by adding their username to the \fBmock\fR line in /etc/group. This can be done with the following command: .P \fBsudo /usr/sbin/usermod \-a \-G mock $USER\fR Note that mock is not intended to be run directly as root. .LP Warning: Mock is running some parts of code under root privileges. There are known ways how to get root access once user is in mock group (and once he is able to run mock). This is possible when user abuse the mock configuration options. Please do not add anyone who is not trustworthy to the mock group! .SH "COMMANDS" .LP .TP \fB\-\-buildsrpm\fP Builds the specified SRPM either from a spec file and source file/directory or from SCM. The chroot is cleaned first, unless \-\-no\-clean is specified. .TP \fB\-\-clean\fP Purge the chroot tree. .TP \fB\-\-copyin\fP Copies the source paths (files or directory trees) into the chroot at the specified destination path. .TP \fB\-\-copyout\fP Copies the source paths (files or directory trees) from the chroot to the specified destination path. .TP \fB\-\-chroot\fP \fICOMMAND [\fIARGS...\fR] Run the specified command non\-interactively within the chroot (no 'clean' is performed). Command output will be sent to the log files. Note that COMMAND is shell expanded only if there are no ARGS. Otherwise there is no shell expansion. .TP \fB\-\-dnf\-cmd\fP Execute following arguments with DNF with installroot set to the chroot path. DNF must be installed on the system. It will use the binary which is specified in 'dnf_command' option in site\-defaults.cfg config, which by default is /usr/bin/dnf. This option will enforce \-\-dnf. .TP \fB\-\-init\fP Initialize a chroot (clean, install chroot packages, etc.) .TP \fB\-i\fR, \fB\-\-install\fP Do a yum install PACKAGE inside the chroot. No 'clean' is performed .TP \fB\-\-installdeps\fP Find out deps for SRPM or RPM, and do a yum install to put them in the chroot. No 'clean' is performed .TP \fB\-l\fR, \fB\-\-list\-snapshots\fP List all existing snapshots of the chroot belonging to current configuration. Current base snapshot is marked with an asterisk (\fB*\fR) .TP \fB\-\-mount\fP Mount all everything mounted in the chroot path including the root itself that might have been a LVM volume or TMPFS. .TP \fB\-\-orphanskill\fP No\-op mode that simply checks that no stray processes are running in the chroot. Kills any processes that it finds using specified root. .TP \fB\-\-pm\-cmd\fP Execute following arguments with current package manager with installroot set to the chroot path. .TP \fB\-p\fR, \fB\-\-print\-root\-path\fP Prints a path to the currently used chroot directory. .TP \fB\-\-rebuild\fP If no command is specified, rebuild is assumed. Rebuilds the specified SRPM(s). The chroot is cleaned first, unless \-\-no\-clean is specified. .TP \fB\-\-remove\fP Do a yum remove PACKAGE inside the chroot. No 'clean' is performed .TP \fB\-\-remove\-snapshot\fP Remove given snapshot freeing the space it occupied. This action cannot be undone. This feature is available only when lvm_root plugin is installed and enabled. .TP \fB\-\-rollback\-to\fP Return chroot to the state in specified snapshot and set it as the current base to which clean actions will return. It won't delete nor modify the snapshot that was set as base previously. This feature is available only when lvm_root plugin is installed and enabled. .TP \fB\-\-scm\-enable\fP Enable building from an SCM (CVS/Git/SVN). The SCM repository must be configured in site\-defaults.cfg before SCM checkouts are possible. SCM package and branch can be defined with \fB\-\-scm\-option\fP arguments, see site\-defaults.cfg for more information. .TP \fB\-\-scrub\fR=\fITYPE\fP Completely remove the specified chroot or cache dir or all of the chroot and cache. \fITYPE\fR is one of all, chroot, cache, root\-cache, c\-cache, yum\-cache or dnf\-cache. In fact, dnf\-cache is just alias for yum\-cache and both removes Dnf and Yum cache. .TP \fB\-\-shell\fP [\fICOMMAND [\fIARGS...]\fR] Run the specified command interactively within the chroot (no 'clean' is performed). If no command specified, /bin/sh is run. Note that COMMAND is shell expanded using shell in chroot. .TP \fB\-\-sources\fR=\fISOURCES\fP Specifies sources (either a single file or a directory of files) to use to build an SRPM (used only with \-\-buildsrpm). .TP \fB\-\-spec\fR=\fISPEC\fP Specifies spec file to use to build an SRPM (used only with \-\-buildsrpm). .TP \fB\-\-update\fP [\fIPACKAGE...]\fR Do a package update inside the chroot. The package list is optional, if omitted, all packages will be updated. No 'clean' is performed .TP \fB\-\-snapshot\fP Make a snapshot of the current state of the chroot. That snapshot will be set as the current base to which \fV\-\-clean\fP and implicit clean happening during rebuild command will return. This feature is available only when lvm_root plugin is installed and enabled. .TP \fB\-\-umount\fP Umount all everything mounted in the chroot path including the root itself that might have been a LVM volume or TMPFS. .TP \fB\-\-yum\-cmd\fP Execute following arguments with YUM with installroot set to the chroot path. Yum must be installed on the system. It will use the binary which is specified in 'yum_command' option in site\-defaults.cfg config, which by default is /usr/bin/yum. Note that in config files for Fedora 22\+ this value is overwriten in chroot config to default to /usr/bin/yum\-deprecated. This option will enforce \-\-yum. .TP Note: While you can specify more commands on command line, only one can be executed. The last command will win. .SH "OPTIONS" .LP .TP \fB\-\-arch\fR=\fIARCH\fP Calls the linux personality() syscall to tell the kernel to emulate a secondary architecture. For example, building i386 packages on an x86_64 buildhost. .TP \fB\-\-cache\-alterations\fR Rebuild the root cache after making alterations to the chroot (i.e. \-\-install). Only useful when using tmpfs plugin. .TP \fB\-\-cleanup\-after\fR Clean chroot after building. Use with \-\-resultdir. Only active for '\-\-rebuild'. .TP \fB\-\-configdir\fR=\fICONFIGDIR\fP Change directory where config files are found .TP \fB\-\-cwd\fR=\fIDIR\fP Change to the specified directory (relative to the chroot) before running command when using \-\-chroot .TP \fB\-D \fR"\fIMACRO EXPR\fP", \fB\-\-define\fR="\fIMACRO EXPR\fP" Specify macro definitions used for the build. This option may be used multiple times, just as the rpmbuild \-\-define option can be. For example: \fB\-\-define "with_extra_cheese 1" \-\-define="packager Monkey"\fR .TP \fB\-\-disable\-plugin\fR=\fIPLUGIN\fP Disable the specified plugin. This option may be used multiple times. .TP \fB\-\-disablerepo\fR=\fIREPO\fR Pass \fB\-\-disablerepo\fR option to package manager to disable a repository. It can be specified multiple times. .TP \fB\-\-dnf\fR Use DNF as the current package manager. You should have DNF (and dnf\-plugins\-core) installed on your system. .TP \fB\-\-enable\-plugin\fR=\fIPLUGIN\fP Enable the specified plugin. This option may be used multiple times. .TP \fB\-\-enablerepo\fR=\fIREPO\fR Pass \fB\-\-enablerepo\fR option to package manager to enable a repository. It can be specified multiple times. .TP \fB\-h\fR, \fB\-\-help\fR Show usage information and exit. .TP \fB\-\-macro\-file\fR=\fIFILE\fR Use pre\-defined rpm macro file. Macros passed to '\-\-define' override macros of the same name from FILE. .TP \fB\-\-new\-chroot\fR use new chroot (systemd\-nspawn) \- this is experimental and will break existing scripts. .TP \fB\-n\fR, \fB\-\-no\-clean\fR Do not clean chroot before building package. .TP \fB\-\-nocheck\fR Pass \-\-nocheck to rpmbuild to skip 'make check' tests. .TP \fB\-\-no\-cleanup\-after\fR Don't clean chroot after building. If automatic cleanup is enabled, use this to disable. .TP \fB\-\-offline\fR Run in 'offline' mode where we tell 'yum' to run completely from local cache. Also disables cache expiry for the mock yum cache. .TP \fB\-\-old\-chroot\fR use old chroot instead of systemd\-nspawn. .TP \fB\-\-plugin\-option \fR\fIPLUGIN\fR\fB:\fR\fIKEY\fR\fB=\fR\fIVALUE\fP Set plugin specific parameter. This option may be used multiple times. .TP \fB\-\-postinstall\fR Try to install built packages in the same buildroot right after build. .TP \fB\-q\fR, \fB\-\-quiet\fR Be quiet. .TP \fB\-r\fR \fICONFIG\fP, \fB\-\-root\fR=\fICONFIG\fP Uses specified chroot configuration as defined in /etc/mock/<\fICONFIG\fP>.cfg. Optionally if CONFIG ends in '.cfg', it is interpreted as full path to config file. If none specified, uses the chroot config linked to by /etc/mock/default.cfg. .TP \fB\-\-resultdir\fR=\fIRESULTDIR\fP Change directory where resulting files (RPMs and build logs) are written. Resultdir can contain python\-string substitutions for any variable in the chroot config. For example: \fB\-\-resultdir=./my/"%(dist)s"/"%(target_arch)s"/\fR This option enables automatic cleanup, this can be changed in config file (by cleanup_on_success, cleanup_on_failure configuration options) or overridden by \-\-no\-cleanup\-after/\-\-cleanup\-after arguments. .TP \fB\-\-rootdir\fR=\fIROOTDIR\fP Path for where the chroot should be built. By default it is created in /var/lib/mock/<\fICONFIG\fP>/root/. .TP \fB\-\-rpmbuild\-opts\fR=\fIOPTIONS\fR Pass additional options to rpmbuild. To pass more options, put them in quotes. .TP \fB\-\-rpmbuild_timeout\fR=\fISECONDS\fP Fail build if rpmbuild takes longer than 'timeout' seconds .TP \fB\-\-scm\-option\fR=\fIOPTIONS\fR define an SCM option (may be used more than once). .TP \fB\-\-short\-circuit\fR=\fISTAGE\fR Use rpmbuild's short\-circuit mechanism to skip already executed stages of build. It doesn't produce RPMs, it's useful only for debugging packaging. Implies \fI\-\-no\-clean\fR. STAGE specifies which stage will be executed as the first. Available values: prep, build, install, binary. .TP \fB\-\-symlink\-dereference\fR Follow symlinks in sources (used only with \-\-buildsrpm). .TP \fB\-\-target\fR=\fIARCH\fP This argument is passed to rpmbuild to specify the target arch to build. It defaults to whatever is specified for \-\-arch, or whatever is specified in the config file as config_opts['target_arch']. .TP \fB\-\-trace\fR Enables verbose tracing of function enter/exit with function arguments and return codes. Useful for debugging mock itself. .TP \fB\-\-uniqueext\fR=\fItext\fP Arbitrary, unique extension to append to chroot directory name .TP \fB\-\-unpriv\fR Drop privileges before running command when using \-\-chroot .TP \fB\-v\fR, \fB\-\-verbose\fR Output verbose progress information. .TP \fB\-\-version\fR Show version number and exit. .TP \fB\-\-with\fR=\fIOPTION\fP Enable configure OPTION for build. This option may be used multiple times. For example: \fB\-\-with=extra_cheese\fR .TP \fB\-\-without\fR=\fIOPTION\fP Disable configure OPTION for build. This option may be used multiple times. For example: \fB\-\-without=anchovies\fR .TP \fB\-\-yum\fR Use yum as the current package manager. This is the default. .SH "FILES" .LP \fI/etc/mock/\fP \- default configuration directory .LP \fI/var/lib/mock\fP \- directory where chroots are created .SH "EXAMPLES" .LP To rebuild test.src.rpm using the Fedora 14 configuration for x86_64 .LP .RS 5 \fBmock \-r fedora\-14\-x86_64 \-\-rebuild /path/to/test.src.rpm .RE .LP Note that the available configurations are found in the /etc/mock directory with the extension .cfg. To specify a configuration use the filename without the trailing .cfg extension. .LP To place the output RPMs and logs in a specified location. .LP .RS 5 \fBmock \-r fedora\-14\-i386 \-\-resultdir=./my\-results /path/to/your.src.rpm\fR .RE .LP To build a package from the default SCM repository configured in site\-defaults.cfg use the following arguments. .LP .RS 5 \fBmock \-r fedora\-14\-i386 \-\-scm\-enable \-\-scm\-option package=pkg\fR .RE .LP To build execute command inside of chroot. .LP .RS 5 \fBmock \-r fedora\-21\-x86_64 \-\-chroot \-\- rpm \-\-eval %dist\fR .LP \fBmock \-r fedora\-21\-x86_64 \-\-chroot 'rpm \-\-eval %dist'\fR .RE .LP To build rawhide package using yum: .LP .RS 5 \fBmock \-r fedora\-rawhide\-x86_64 \-\-yum \-\-rebuild your.src.rpm\fR .RE .LP Query rpm database inside chroot using Yum: .LP .RS 5 \fBmock \-r fedora\-rawhide\-x86_64 \-\-yum\-cmd whatprovides foo\fR .RE .LP List package manager history using package manager which is configured in chroot config (can be either DNF or YUM): .LP .RS 5 \fBmock \-r fedora\-rawhide\-x86_64 \-\-pm\-cmd history list\fR .RE .SH "BUGS" .LP To report bugs in mock, go to: .LP .RS 5 \fIhttps://apps.fedoraproject.org/packages/mock/\fR. .RE .LP Select the \fBBugs\fR tab. If there is a bug similar to the one you are seeing, add your information to the comments. If not, press \fBOpen A New Bug\fR and fill in the form. .SH "AUTHORS" .LP Michael Brown .LP Clark Williams .LP Seth Vidal .LP and a cast of...tens .SH "SEE ALSO" .LP mockchain(1), rpmbuild(8), yum(8), https://fedoraproject.org/wiki/Mock