1mock(1)                             Vidal"                             mock(1)
2
3
4

NAME

6       mock - build SRPMs in a chroot
7

SYNTAX

9       mock  [options] --rebuild SRPM [SRPM...]
10
11       mock  [options] --chain SRPM [SRPM...]
12
13       mock  [options] --buildsrpm {--spec spec --sources src --symlink-deref‐
14       erence | --scm-enable}
15
16       mock  [options] --chroot <cmd>
17
18       mock  [options] {--init|clean|shell}
19
20       mock  [options] --installdeps {SRPM|RPM|SPEC}
21
22       mock  [options] -i, --install PACKAGE [PACKAGE...]
23
24       mock  [options] --update [PACKAGE...]
25
26       mock  [options] --remove PACKAGE [PACKAGE...]
27
28       mock  [options] --orphanskill
29
30       mock  [options] -p, --print-root-path
31
32       mock  [options] --copyin path [path...] destination
33
34       mock  [options] --copyout path [path...] destination
35
36       mock  [options] --scm-enable [--scm-option key=value ...]
37
38       mock  [options] -l, --list-snapshots
39
40       mock  [options] --snapshot [snapshot-name]
41
42       mock  [options] --rollback-to [snapshot-name]
43
44       mock  [options] --remove-snapshot [snapshot-name]
45
46       mock  [options] --umount
47
48       mock  [options] --pm-cmd [arguments ...]
49
50       mock  [options] --yum-cmd [arguments ...]
51
52       mock  [options] --dnf-cmd [arguments ...]
53
54
55

DESCRIPTION

57       Mock is a simple program that will build source RPMs inside  a  chroot.
58       It  doesn't  do  anything fancy other than populating a chroot with the
59       contents specified by  a  configuration  file,  then  build  any  input
60       SRPM(s) in that chroot.
61
62       The  content  of  a  chroot is specified by the configuration specified
63       with   the   -r   option.   The   default   configuration    file    is
64       /etc/mock/default.cfg,  which  is  usually  a  symlink  to  one  of the
65       installed configurations.
66
67       There is a site-wide configuration  file,  /etc/mock/site-defaults.cfg,
68       which  can be used to specify site-wide options. The shipped version of
69       this file has no active options, but does have a list  of  all  of  the
70       configuration  options  examples  of how to set them, and their default
71       values.
72
73       To change configuration only for the current user  please  use  ~/.con‐
74       fig/mock.cfg configuration file.
75
76       For  backward  compatibility,  old-style  commands, ("rebuild", "init",
77       "clean", etc.) without leading '--' are still accepted, but are  depre‐
78       cated.  See  COMMANDS  section,  below, for the detailed listing of all
79       commands.
80
81       To use mock, a user should become a member of the mock group by  adding
82       their  username  to  the mock line in /etc/group. This can be done with
83       the following command:
84
85               sudo /usr/sbin/usermod -a -G mock $USER
86
87       Note that mock is not intended to be run directly as root.
88
89       Warning: Mock is running some parts  of  code  under  root  privileges.
90       There  are  known  ways  how  to get root access once a user is in mock
91       group (and once he can to run mock).  This  is  possible  when  a  user
92       abuses  the mock configuration options. Please do not add anyone who is
93       not trustworthy to the mock group!
94
95
96

COMMANDS

98       --buildsrpm
99              Build the specified SRPM either from  a  spec  file  and  source
100              file/directory  or SCM. The chroot (including the results direc‐
101              tory) is cleaned first, unless --no-clean is specified.
102
103       --chain
104              When passing more than one SRPM, it will  try  to  build  failed
105              builds  if  at least one subsequent SRPM succeed. This mimic the
106              behaviour of deprecated mockchain.
107
108       --clean
109              Purge the chroot tree.
110
111       --copyin
112              Copies the source paths (files  or  directory  trees)  into  the
113              chroot at the specified destination path.
114
115       --copyout
116              Copies  the  source  paths  (files  or directory trees) from the
117              chroot to the specified destination path.
118
119       --chroot COMMAND [ARGS...]
120              Run the specified command non-interactively  within  the  chroot
121              (no  'clean'  is  performed). Command output will be sent to the
122              log files. Note that COMMAND is shell expanded only if there are
123              no ARGS. Otherwise, there is no shell expansion.
124
125       --debug-config
126              Print all options in config_opts.
127
128       --dnf-cmd
129              Execute following arguments with DNF with installroot set to the
130              chroot path. DNF must be installed on the system.  It  will  use
131              the  binary  which is specified in 'dnf_command' option in site-
132              defaults.cfg config, which by  default  is  /usr/bin/dnf.   This
133              option will enforce --dnf.
134
135       --init Initialize a chroot (clean, install chroot packages, etc.).
136
137       -i, --install
138              Do  a  yum install PACKAGE inside the chroot. No 'clean' is per‐
139              formed.
140
141       --installdeps
142              Find out deps for SRPM or RPM, and do a yum install to put  them
143              in the chroot. No 'clean' is performed
144
145       -l, --list-snapshots
146              List  all existing snapshots of the chroot belonging to the cur‐
147              rent configuration.  Current base snapshot  is  marked  with  an
148              asterisk (*)
149
150       --mount
151              Mount  all  everything  mounted in the chroot path including the
152              root itself that might have been an LVM volume, TMPFS  or  over‐
153              layfs.
154
155       --orphanskill
156              No-op  mode  that simply checks that no stray processes are run‐
157              ning in the chroot. Kills any processes that it finds using  the
158              specified root.
159
160       --pm-cmd
161              Execute  following  arguments  with  the current package manager
162              with installroot set to the chroot path.
163
164       -p, --print-root-path
165              Prints a path to the currently used chroot directory.
166
167       --rebuild
168              If no command is specified,  rebuild  is  assumed.  Rebuild  the
169              specified  SRPM(s). The chroot (including the results directory)
170              is cleaned first, unless --no-clean is specified.
171
172       --remove
173              Do a yum remove PACKAGE inside the chroot. No  'clean'  is  per‐
174              formed.
175
176       --remove-snapshot
177              Remove given snapshot freeing the space it occupied. This action
178              cannot be undone.  This feature is available only when  lvm_root
179              or overlayfs plugin is installed and enabled.
180
181       --rollback-to
182              Return  chroot to the state in the specified snapshot and set it
183              as the current base to which clean actions will return. It won't
184              delete  nor modify the snapshot that was set as base previously.
185              This feature is available only when the  lvm_root  or  overlayfs
186              plugin is installed and enabled.
187
188       --scm-enable
189              Enable  building  from  an  SCM  (CVS/Git/SVN/DistGit).  The SCM
190              repository must be configured in  site-defaults.cfg  before  SCM
191              checkouts  are  possible.  SCM package and branch can be defined
192              with --scm-option  arguments,  see  site-defaults.cfg  for  more
193              information.
194
195       --scrub=TYPE
196              Completely  remove  the  specified chroot or cache dir or all of
197              the chroot and cache.   TYPE  is  one  of  all,  chroot,  cache,
198              root-cache,  c-cache, yum-cache or dnf-cache. In fact, dnf-cache
199              is just alias for yum-cache, and both remove Dnf and Yum cache.
200
201       --shell [COMMAND [ARGS...]]
202              Run the specified command interactively within  the  chroot  (no
203              'clean'  is performed). If no command specified, /bin/sh is run.
204              Note that COMMAND is shell expanded using the shell  in  chroot.
205              Note that this command does not produce logs.
206
207       --sources=SOURCES
208              Specifies sources (either a single file or a directory of files)
209              to use to build an SRPM (used only with --buildsrpm).
210
211       --spec=SPEC
212              Specifies spec file to use to build an SRPM.
213
214       --update [PACKAGE...]
215              Do a package update inside  the  chroot.  The  package  list  is
216              optional,  if  omitted, all packages will be updated. No 'clean'
217              is performed.
218
219       --snapshot
220              Make a snapshot of the current state of the chroot.  That  snap‐
221              shot  will  be  set  as  the  current  base to which --clean and
222              implicit clean happening during  rebuild  command  will  return.
223              This  feature  is  available only when the lvm_root or overlayfs
224              plugin is installed and enabled.
225
226       --umount
227              Umount all everything mounted in the chroot path  including  the
228              root  itself that might have been an LVM volume, TMPFS or overa‐
229              lyfs.
230
231       --yum-cmd
232              Execute following arguments with YUM with installroot set to the
233              chroot  path.  Yum must be installed on the system.  It will use
234              the binary which is specified in 'yum_command' option  in  site-
235              defaults.cfg  config,  which  by  default is /usr/bin/yum.  Note
236              that in config files for Fedora 22+ this value is overwritten in
237              chroot  config  to  default  to  /usr/bin/yum-deprecated.   This
238              option will enforce --yum.
239
240       Note: While you can specify more commands on a command line,  only  one
241       can be executed. The last command will win.
242
243
244

OPTIONS

246       -a, --addrepo=REPO
247              Add  this repo baseurl to the yumconfig for the chroot. This can
248              be specified multiple times. Let's you point to  multiple  paths
249              beyond the default to pull build deps from.
250
251       --arch=ARCH
252              Calls the Linux personality() syscall to tell the kernel to emu‐
253              late a secondary architecture. For example, building i386  pack‐
254              ages on an x86_64 buildhost.
255
256       --forcearch=ARCH
257              Pass  --forcearch  to  DNF. This will enable to install packages
258              for different architecture. Works only for DNF and you  have  to
259              have package qemu-user-static installed.
260
261       --cache-alterations
262              Rebuild  the  root  cache after making alterations to the chroot
263              (i.e. --install). This option is useful only  when  using  tmpfs
264              plugin.
265
266       --cleanup-after
267              Clean  chroot  after building. Use with --resultdir. Only active
268              for '--rebuild'.
269
270       --configdir=CONFIGDIR
271              Change directory where config files are found
272
273       --config-opts=KEY=VALUE
274              Override configuration option. Can be used multiple times.  When
275              used  multiple  times for the same key, it will create an array.
276              This is evaluated first (after parsing configs) so any  special‐
277              ized  command  line  option  can override values defined in this
278              option.
279
280       --continue
281              If a pkg fails to build, continue to the next one, default is to
282              stop.
283
284       --cwd=DIR
285              Change  to  the  specified  directory  (relative  to the chroot)
286              before running command when using --chroot
287
288       -D "MACRO EXPR", --define="MACRO EXPR"
289              Specify macro definitions used for the build.  This  option  may
290              be used multiple times, just as the rpmbuild --define option can
291              be.  For example:
292
293              --define "with_extra_cheese 1" --define="packager Monkey"
294
295       --disable-plugin=PLUGIN
296              Disable the specified plugin.  This option may be used  multiple
297              times.
298
299       --disablerepo=REPO
300              Pass --disablerepo option to package manager to disable a repos‐
301              itory.  It can be specified multiple times.
302
303       --dnf  Use DNF as the current package manager. You should have DNF (and
304              dnf-plugins-core) installed on your system.
305
306       --enable-plugin=PLUGIN
307              Enable  the  specified plugin.  This option may be used multiple
308              times.
309
310       --enablerepo=REPO
311              Pass --enablerepo option to package manager to enable a  reposi‐
312              tory.  It can be specified multiple times.
313
314       --enable-network
315              Enable  networking. If you want to have reproducible builds then
316              your builds should run without a network.  This option overrides
317              config_opts['rpmbuild_networking']            and           con‐
318              fig_opts['use_host_resolv'], setting both True.
319
320       --localrepo=REPO
321              Set the path to put the results/repo in. This path needs  to  be
322              somewhere  accessible to users other than you for reading as the
323              mock process doesn't run as you. Will make a tempdir if not set.
324
325       -h, --help
326              Show usage information and exit.
327
328       --macro-file=FILE
329              Use pre-defined rpm macro  file.  Macros  passed  to  '--define'
330              override macros of the same name from FILE.
331
332       --new-chroot
333              Use new chroot (systemd-nspawn). This is the default.
334
335       -n, --no-clean
336              Do not clean chroot before building a package.
337
338       --nocheck
339              Pass --nocheck to rpmbuild to skip 'make check' tests.
340
341       -N, --no-cleanup-after
342              Don't  clean  chroot  after  building.  If  automatic cleanup is
343              enabled, use this to disable.
344
345       --offline
346              Run in an 'offline' mode where we tell 'yum' to  run  completely
347              from  the  local cache. Also, disables cache expiry for the mock
348              yum cache.
349
350       --old-chroot
351              use old chroot instead of systemd-nspawn.
352
353       --plugin-option PLUGIN:KEY=VALUE
354              Set plugin specific parameter. This option may be used  multiple
355              times.  Examples:
356
357              --plugin-option=root_cache:age_check=False
358
359              --plugin-option=mount:dirs=("/dev/device",
360              "/mount/path/in/chroot/", "vfstype", "mount_options")
361
362       --postinstall
363              Try to install built packages in the same buildroot right  after
364              the build.
365
366       -q, --quiet
367              Be quiet.
368
369       --recurse
370              Build  all  pkgs,  record  the  failures and try to rebuild them
371              again and again until everything gets built (or until the set of
372              pkgs failing to build are the same over) sets --continue.
373
374       -r CONFIG, --root=CONFIG
375              Uses  specified  chroot  configuration  as  defined  in  ~/.con‐
376              fig/mock/<CONFIG>.cfg or /etc/mock/<CONFIG>.cfg.  Optionally  if
377              CONFIG  ends in '.cfg', it is interpreted as full path to config
378              file. If none specified, uses the chroot  config  linked  to  by
379              /etc/mock/default.cfg.
380
381       --resultdir=RESULTDIR
382              Change directory where resulting files (RPMs and build logs) are
383              written. Resultdir can contain python-string  substitutions  for
384              any variable in the chroot config. For example:
385
386              --resultdir=./my/"%(dist)s"/"%(target_arch)s"/
387
388              This  option  enables  automatic cleanup, this can be changed in
389              config file (by cleanup_on_success, cleanup_on_failure  configu‐
390              ration         options)         or         overridden         by
391              --no-cleanup-after/--cleanup-after arguments.
392
393              Note that this option does not have an effect for  --chain  com‐
394              mand. You can use --localrepo instead.
395
396       --rootdir=ROOTDIR
397              The  path for where the chroot should be built. By default it is
398              created in /var/lib/mock/<CONFIG>/root/.
399
400       --rpmbuild-opts=OPTIONS
401              Pass additional options to rpmbuild. To pass more  options,  put
402              them in quotes.
403
404       --rpmbuild_timeout=SECONDS
405              Fail build if rpmbuild takes longer than 'timeout' seconds
406
407       --scm-option=OPTIONS
408              define an SCM option (may be used more than once).
409
410       --short-circuit=STAGE
411              Use  rpmbuild's short-circuit mechanism to skip already executed
412              stages of the build.  It doesn't produce RPMs, and  it's  useful
413              only  for  debugging packaging. Implies --no-clean. STAGE speci‐
414              fies which stage will be executed as the first.  Available  val‐
415              ues: prep, build, install, binary.
416
417       --symlink-dereference
418              Follow symlinks in sources (used only with --buildsrpm).
419
420       --target=ARCH
421              This  argument  is passed to rpmbuild to specify the target arch
422              to build. It defaults to whatever is specified  for  --arch,  or
423              whatever  is  specified  in the config file as config_opts['tar‐
424              get_arch'].
425
426       --tmp_prefix=PREFIX
427              Tmp dir prefix - will default to username-pid if not specified.
428
429       --trace
430              Enables verbose tracing of  function  enter/exit  with  function
431              arguments and return codes. Useful for debugging mock itself.
432
433       --uniqueext=text
434              Arbitrary, unique extension to append to chroot directory name
435
436       --unpriv
437              Drop privileges before running command when using --chroot
438
439       -v, --verbose
440              Output verbose progress information.
441
442       --version
443              Show version number and exit.
444
445       --with=OPTION
446              Enable  configure OPTION for the build.  This option may be used
447              multiple times.  For example:
448
449              --with=extra_cheese
450
451       --without=OPTION
452              Disable configure OPTION for the build.  This option may be used
453              multiple times.  For example:
454
455              --without=anchovies
456
457       --yum  Use yum as the current package manager. This is the default.
458
459
460       --bootstrap-chroot
461              build  in  two  stages,  using chroot rpm for creating the build
462              chroot
463
464       --no-bootstrap-chroot
465              build in a single stage, using system rpm for creating the build
466              chroot
467
468
469       --use-bootstrap-image
470              Instead  of  creating a bootstrap chroot from scrath, use podman
471              image specified in config_opts['bootstrap_image'],  extract  it,
472              and  use it as a cache for the bootstrap chroot.  This is useful
473              when host rpm version is not compatible with the target  system,
474              or when using mock on non-RPM distributions.
475
476
477       --no-bootstrap-image
478              don't create bootstrap chroot from container image
479
480

FILES

482       /etc/mock/ - default configuration directory
483
484       /var/lib/mock  -  directory  where chroots and results are created. You
485       should not put there your input files.
486

EXAMPLES

488       To rebuild test.src.rpm using the Fedora 14 configuration for x86_64
489
490            mock -r fedora-14-x86_64 --rebuild /path/to/test.src.rpm
491
492       Note that the available  configurations  are  found  in  the  /etc/mock
493       directory  with  the extension .cfg. To specify a configuration use the
494       filename without the trailing .cfg extension.
495
496       To place the output RPMs and logs in a specified location.
497
498            mock       -r       fedora-14-i386        --resultdir=./my-results
499            /path/to/your.src.rpm
500
501       To  build  a  package  from  the  default  SCM repository configured in
502       site-defaults.cfg use the following arguments.
503
504            mock -r fedora-14-i386 --scm-enable --scm-option package=pkg
505
506       To execute a command inside of chroot.
507
508            mock -r fedora-21-x86_64 --chroot -- rpm --eval %dist
509
510            mock -r fedora-21-x86_64 --chroot 'rpm --eval %dist'
511
512       To build rawhide package using yum:
513
514            mock -r fedora-rawhide-x86_64 --yum --rebuild your.src.rpm
515
516       Query rpm database inside chroot using Yum:
517
518            mock -r fedora-rawhide-x86_64 --yum-cmd whatprovides foo
519
520       List package manager history using package manager which is  configured
521       in chroot config (can be either DNF or YUM):
522
523            mock -r fedora-rawhide-x86_64 --pm-cmd history list
524
525

BUGS

527       To report bugs in mock, go to:
528
529            https://apps.fedoraproject.org/packages/mock/.
530
531       Select  the Bugs tab. If there is a bug similar to the one you are see‐
532       ing, add your information to the comments. If not, press Open A New Bug
533       and fill in the form.
534

AUTHORS

536       Michael Brown <mebrown@michaels-house.net>
537
538       Clark Williams <williams@redhat.com>
539
540       Seth Vidal
541
542       and a cast of...tens
543

SEE ALSO

545       rpmbuild(8),  yum(8),  dnf(8),  https://github.com/rpm-software-manage
546       ment/mock/wiki
547
548
549
550Seth                               1.4.21"                             mock(1)
Impressum