1mock(1) mock(1)
2
3
4
6 mock - build SRPMs in a chroot
7
9 mock [options] --rebuild SRPM [SRPM...]
10
11 mock [options] --buildsrpm {--spec spec --sources src | --scm-enable}
12
13 mock [options] --chroot <cmd>
14
15 mock [options] {--init|clean|shell}
16
17 mock [options] --installdeps {SRPM|RPM}
18
19 mock [options] --install PACKAGE
20
21 mock [options] --update
22
23 mock [options] --orphanskill
24
25 mock [options] --copyin path [path...] destination
26
27 mock [options] --copyout path [path...] destination
28
29 mock [options] --scm-enable [--scm-option key=value ...]
30
31
33 Mock is a simple program that will build source RPMs inside a chroot.
34 It doesn't do anything terribly fancy other than populate a chroot with
35 the contents specified by a configuration file, then build any input
36 SRPM(s) in that chroot.
37
38 The content of a chroot is specified by the configuration specified
39 with the -r option. The default configuration file is
40 /etc/mock/default.cfg, which is usually a symlink to one of the
41 installed configurations.
42
43 There is a site-wide configuration file, /etc/mock/site-defaults.cfg,
44 which can be used to specify site-wide options. The shipped version of
45 this file has no active options, but does have a list of all of the
46 configuration options, examples of how to set them, and their default
47 values.
48
49 For backwards compatibility, old-style commands, ("rebuild", "init",
50 "clean", etc.) without leading '--' are still accepted, but are depre‐
51 cated. See COMMANDS section, below, for detailed listing of all com‐
52 mands.
53
54 To use mock, a user should become a member of the mock group by adding
55 their username to the mock line in /etc/group. This can be done with
56 the following command:
57
58 sudo /usr/sbin/usermod -a -G mock $USER
59
60 Note that mock is not intended to be run directly as root.
61
62
64 --clean
65 Purge the chroot tree.
66
67 --scrub=TYPE
68 Completely remove the specified chroot or cache dir or all of
69 the chroot and cache. TYPE is one of all, chroot, cache, root-
70 cache, c-cache, or yum-cache.
71
72 --init Initialize a chroot (clean, install chroot packages, etc.)
73
74 --rebuild
75 If no command is specified, rebuild is assumed. Rebuilds the
76 specified SRPM(s). The buildroot is cleaned first, unless --no-
77 clean is specified.
78
79 --buildsrpm
80 Builds the specified SRPM either from a spec file and source
81 file/directory or from SCM. The buildroot is cleaned first,
82 unless --no-clean is specified.
83
84 --shell
85 Run the specified command interactively within the chroot (which
86 must already be initialized -- no 'clean' is performed). If no
87 command specified, /bin/sh is run.
88
89 --chroot
90 Run the specified command non-interactively within the chroot
91 (which must already be initialized -- no 'clean' is performed).
92 Command output will be sent to the log files.
93
94 --installdeps
95 Find out deps for SRPM or RPM, and do a yum install to put them
96 in the buildroot. Buildroot must already be initialized -- no
97 'clean' is performed
98
99 --install
100 Do a yum install PACKAGE inside the buildroot. Buildroot must
101 already be initialized -- no 'clean' is performed
102
103 --update
104 Do a yum update inside the buildroot. Buildroot must already be
105 initialized -- no 'clean' is performed
106
107 --orphanskill
108 No-op mode that simply checks that no stray processes are run‐
109 ning in the chroot. Kills any processes that it finds using
110 specified root.
111
112 --copyin
113 Copies the source paths (files or directory trees) into the
114 chroot at the specified destination path.
115
116 --copyout
117 Copies the source paths (files or directory trees) from the
118 chroot to the specified destination path.
119
120 --scm-enable
121 Enable building from an SCM (CVS/Git/SVN). The SCM repository
122 must be configured in site-defaults.cfg before SCM checkouts are
123 possible. SCM package and branch can be defined with --scm-
124 option arguments, see site-defaults.cfg for more information.
125
126
127
129 -r CHROOT, --root=CHROOT
130 Uses specified chroot configuration as defined in
131 /etc/mock/<chroot>.cfg. If none specified, uses the chroot
132 linked to by /etc/mock/default.cfg
133
134 --offline
135 Run in 'offline' mode where we tell 'yum' to run completely from
136 local cache. Also disables cache expiry for the mock yum cache.
137
138 --no-clean
139 Do not clean chroot before building package.
140
141 --cleanup-after
142 Clean chroot after building. Use with --resultdir. Only active
143 for '--rebuild'.
144
145 --no-cleanup-after
146 Don't clean chroot after building. If automatic cleanup is
147 enabled, use this to disable.
148
149 --target=ARCH
150 This argument is passed to rpmbuild to specify the target arch
151 to build. It defaults to whatever is specified for --arch, or
152 whatever is specified in the config file as config_opts['tar‐
153 get_arch'].
154
155 --arch=ARCH
156 Calls the linux personality() syscall to tell the kernel to emu‐
157 late a secondary architecture. For example, building i386 pack‐
158 ages on an x86_64 buildhost.
159
160 -D "MACRO EXPR", --define="MACRO EXPR"
161 Specify macro definitions used for the build. This option may
162 be used multiple times, just as the rpmbuild --define option can
163 be. For example:
164
165 --define "with_extra_cheese 1" --define="packager Monkey"
166
167 --with=OPTION
168 Enable configure OPTION for build. This option may be used mul‐
169 tiple times. For example:
170
171 --with=extra_cheese
172
173 --without=OPTION
174 Disable configure OPTION for build. This option may be used
175 multiple times. For example:
176
177 --without=anchovies
178
179 --resultdir=RESULTDIR
180 Change directory where resulting files (RPMs and build logs) are
181 written. Resultdir can contain python-string substitutions for
182 any variable in the chroot config. For example:
183
184 --resultdir=./my/"%(dist)s"/"%(target_arch)s"/
185
186 --uniqueext=text
187 Arbitrary, unique extension to append to buildroot directory
188 name
189
190 --configdir=CONFIGDIR
191 Change directory where config files are found
192
193 --rpmbuild_timeout=SECONDS
194 Fail build if rpmbuild takes longer than 'timeout' seconds
195
196 --unpriv
197 Drop privileges before running command when using --chroot
198
199 --cwd=DIR
200 Change to the specified directory (relative to the chroot)
201 before running command when using --chroot
202
203 -q, --quiet
204 Be quiet.
205
206 -v, --verbose
207 Output verbose progress information.
208
209 --trace
210 Enables verbose tracing of function enter/exit with function
211 arguments and return codes. Useful for debugging mock itself.
212
213 --enable-plugin=PLUGIN
214 Enable the specified plugin. This option may be used multiple
215 times.
216
217 --disable-plugin=PLUGIN
218 Disable the specified plugin. This option may be used multiple
219 times.
220
221 -h, --help
222 Show usage information and exit.
223
224 --version
225 Show version number and exit.
226
227
228
230 /etc/mock/ - default configuration directory
231
232 /var/lib/mock - directory where chroots are created
233
235 To rebuild test.src.rpm using the Fedora 14 configuration for x86_64
236
237 mock -r fedora-14-x86_64 --rebuild /path/to/test.src.rpm
238
239 Note that the available configurations are found in the /etc/mock
240 directory with the extension .cfg. To specify a configuration use the
241 filename without the trailing .cfg extension.
242
243 To place the output RPMs and logs in a specified location.
244
245 mock -r fedora-14-i386 --resultdir=./my-results
246 /path/to/your.src.rpm
247
248 To build a package from the default SCM repository configured in site-
249 defaults.cfg use the following arguments.
250
251 mock -r fedora-14-i386 --scm-enable --scm-option package=pkg
252
254 To report bugs in mock, go to:
255
256 http://bugzilla.redhat.com/bugzilla.
257
258 Select the query option, using product Fedora Hosted Projects and com‐
259 ponent mock and press the Start Search button. If there is a bug simi‐
260 lar to the one you are seeing, add your information to the comments. If
261 not, go to the new bug page using the same product and component and
262 fill in the form.
263
265 Michael Brown <mebrown@michaels-house.net>
266
267 Clark Williams <williams@redhat.com>
268
269 Seth Vidal <skvidal@linux.duke.edu>
270
271 and a cast of...tens
272
274 yum(8) rpmbuild(8) http://fedoraproject.org/wiki/Projects/Mock
275
276
277
278Seth Vidal 0.7 mock(1)