enhance: Add comprehensive .gitignore for deb-mock project
Some checks failed
Build Deb-Mock Package / build (push) Successful in 54s
Lint Code / Lint All Code (push) Failing after 1s
Test Deb-Mock Build / test (push) Failing after 36s

- Add mock-specific build artifacts (chroot/, mock-*, mockroot/)
- Include package build files (*.deb, *.changes, *.buildinfo)
- Add development tools (.coverage, .pytest_cache, .tox)
- Include system files (.DS_Store, Thumbs.db, ._*)
- Add temporary and backup files (*.tmp, *.bak, *.backup)
- Include local configuration overrides (config.local.yaml, .env.local)
- Add test artifacts and documentation builds
- Comprehensive coverage for Python build system project

This ensures build artifacts, chroot environments, and development
tools are properly ignored in version control.
This commit is contained in:
robojerk 2025-08-18 23:37:49 -07:00
parent 1a559245ea
commit 4c0dcb2522
329 changed files with 27394 additions and 965 deletions

View file

@ -0,0 +1,102 @@
{
"$id": "https://raw.githubusercontent.com/rpm-software-management/mock/main/mock/docs/buildroot-lock-schema-1.0.0.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"title": "Mock buildroot_lock.json file specification",
"description": "Version 1.0.0; last updated 2024-09-02",
"additionalProperties": false,
"properties": {
"version": {
"description": "Version of the https://raw.githubusercontent.com/rpm-software-management/mock/main/mock/docs/buildroot-lock-schema.json schema the document conforms to. Semantic versioned. Mock that implements v2.Y.Z versions no longer reads v1.Y.Z.",
"const": "1.0.0"
},
"buildroot": {
"description": "The object that describes the Mock buildroot",
"type": "object",
"additionalProperties": false,
"properties": {
"rpms": {
"description": "List of RPM packages installed in the buildroot",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"arch": {
"description": "Architecture for which the package was built, 'noarch' for arch agnostic packages",
"type": "string"
},
"epoch": {
"description": "Epoch number of the package",
"type": ["string", "null"]
},
"license": {
"description": "The distribution license(s) of the package",
"type": "string"
},
"name": {
"description": "Name of the package",
"type": "string"
},
"release": {
"description": "Release (downstream) number of the package",
"type": "string"
},
"sigmd5": {
"description": "The SIGMD5 tag from the rpm header.",
"type": "string"
},
"signature": {
"description": "The signature used to sign the rpm (if any), last 8 characters from the \"rpm -q --qf '%{sigpgp:pgpsig}\n'\" output",
"type": ["string", "null"]
},
"url": {
"description": "Uniform Resource Locator that points to additional information on the packaged software",
"type": "string"
},
"version": {
"description": "Version (upstream) of the package",
"type": "string"
}
},
"required": [
"arch",
"epoch",
"license",
"name",
"release",
"sigmd5",
"signature",
"url",
"version"
]
}
}
},
"required": [
"rpms"
]
},
"bootstrap": {
"description": "The object that describes the Mock bootstrap chroot. Optional, only provided when bootstrap (image) is used.",
"type": "object",
"additionalProperties": false,
"properties": {
"image_digest": {
"description": "SHA256 digest concatenated RootFS layer digests and Config section from 'podman image inspect' command, sha256 string",
"type": "string"
}
}
},
"config": {
"description": "A set of important Mock configuration options used when the buildroot was generated (Mock's internal)",
"type": "object",
"properties": {}
}
},
"required": [
"buildroot",
"config",
"version"
]
}

View file

@ -0,0 +1,120 @@
{
"$id": "https://raw.githubusercontent.com/rpm-software-management/mock/main/mock/docs/buildroot-lock-schema-1.1.0.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"title": "Mock buildroot_lock.json file specification",
"description": "Version 1.1.0; last updated 2025-02-03",
"additionalProperties": false,
"properties": {
"version": {
"description": "Version of the https://raw.githubusercontent.com/rpm-software-management/mock/main/mock/docs/buildroot-lock-schema.json schema the document conforms to. Semantic versioned. Mock that implements v2.Y.Z versions no longer reads v1.Y.Z.",
"const": "1.1.0"
},
"buildroot": {
"description": "The object that describes the Mock buildroot",
"type": "object",
"additionalProperties": false,
"properties": {
"rpms": {
"description": "List of RPM packages installed in the buildroot",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"arch": {
"description": "Architecture for which the package was built, 'noarch' for arch agnostic packages",
"type": "string"
},
"epoch": {
"description": "Epoch number of the package",
"type": ["string", "null"]
},
"license": {
"description": "The distribution license(s) of the package",
"type": "string"
},
"name": {
"description": "Name of the package",
"type": "string"
},
"release": {
"description": "Release (downstream) number of the package",
"type": "string"
},
"sigmd5": {
"description": "The SIGMD5 tag from the rpm header.",
"type": "string"
},
"signature": {
"description": "The signature used to sign the rpm (if any), last 8 characters from the \"rpm -q --qf '%{sigpgp:pgpsig}\n'\" output",
"type": ["string", "null"]
},
"url": {
"description": "Uniform Resource Locator that points to additional information on the packaged software",
"type": "string"
},
"version": {
"description": "Version (upstream) of the package",
"type": "string"
}
},
"required": [
"arch",
"epoch",
"license",
"name",
"release",
"sigmd5",
"signature",
"url",
"version"
]
}
}
},
"required": [
"rpms"
]
},
"bootstrap": {
"description": "The object that describes the Mock bootstrap chroot. Optional, only provided when bootstrap (image) is used.",
"type": "object",
"additionalProperties": false,
"required": [
"image_digest",
"pull_digest",
"architecture",
"id"
],
"properties": {
"image_digest": {
"description": "SHA256 digest concatenated RootFS layer digests and Config section from 'podman image inspect' command, sha256 string",
"type": "string"
},
"pull_digest": {
"description": "Image digest, as reported by podman inspect, can be used for podman pull.",
"type": "string"
},
"architecture": {
"description": "OCI architecture string, as reported by podman inspect .Architecture field.",
"type": "string"
},
"id": {
"type": "string",
"description": "Image ID, as reported by podman inspect .Id"
}
}
},
"config": {
"description": "A set of important Mock configuration options used when the buildroot was generated (Mock's internal)",
"type": "object",
"properties": {}
}
},
"required": [
"buildroot",
"config",
"version"
]
}

588
mock/docs/mock.1 Normal file
View file

@ -0,0 +1,588 @@
.TH "mock" "1" "@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\-\-chain\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<cmd>\fR
.LP
mock [options] {\fB\-\-init\fR|\fBclean\fR|\fBshell\fR}
.LP
mock [options] \fB\-\-installdeps\fR {SRPM|RPM|SPEC}
.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]
.LP
mock [options] \fB\-\-calculate\-build\-dependencies\fR \fISRPM\fR
.LP
mock [options] \fB\-\-hermetic\-build \fILOCKFILE\fR \fIREPO\fR \fISRPM\fR
.LP
mock [options] {\fB\-\-scrub\fR=\fITYPE\fP,\fB\-\-scrub\-all\-chroots\fR}
.SH "DESCRIPTION"
.LP
Mock is a simple program that will build source RPMs inside a chroot. It
doesn't do anything fancy other than populating 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
To change configuration only for the current user please use ~/.config/mock.cfg
configuration file.
.LP
For backward compatibility, old\-style commands, ("rebuild", "init", "clean",
etc.) without leading '\-\-' are still accepted, but are deprecated. See
COMMANDS section, below, for the 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 with root privileges. There are known ways to get root access once a user is in mock group (and once he is able to run mock). This is possible when a user abuses the mock configuration options. Please do not add anyone who is not trustworthy to the mock group!
.SH "COMMANDS"
.LP
.TP
\fB\-\-buildsrpm\fP
Build the specified SRPM either from a spec file and source file/directory or SCM. The chroot (including the results directory) is cleaned first, unless \-\-no\-clean is specified.
.TP
\fB\-\-calculate\-build\-dependencies\fR \fISRPM\fR
Evaluate and install all the \fISRPM\fR (= file name, path on your system) build
dependencies, including dynamic dependencies in \fI%generate_buildrequires\fR.
This is similar to the \fB\-\-installdeps\fR option which only installs the
static \fIBuildRequires\fR.
Build chroot-native \fI*.src.rpm\fR and \fI*.nosrc.rpm\fR files (the later only
when \fI%generate_buildrequires\fR is in use!). The \fI*.src.rpm\fR records the
corresponding static list of build dependencies (= \fIBuildRequires\fR). The
\fI*.nosrc.rpm\fR records a full list of build dependencies (static + dynamic).
Test with \fIrpm -qpR [*.src.rpm|*.nosrc.rpm]\fR.
Additionally, provide a \fIbuildroot_lock.json\fR file; this records the
metadata needed for a hermetic build (see also \fB\-\-hermetic\-build\fR).
.TP
\fB\-\-chain\fR
When passing more than one SRPM, it will try to build failed builds if at least one subsequent SRPM succeed. This mimic the behaviour of deprecated mockchain.
.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 [\fI\-\-\fR] \fICOMMAND\fR [\fIARGS...\fR]
Run the specified command non\-interactively within the chroot (no
\fB\-\-clean\fR is performed).
This mode is similar to \fishell\fR mode, except that the output \fBis logged\fR
and the \fICOMMAND\fR and \fIARGS\fR arguments are not shell expanded in chroot
when the variant with \fICMD+ARGS\fR is used, see the difference in mock output:
\fBmock --quiet --chroot -- echo '*'\fR
*
\fBmock --quiet --chroot -- 'echo *'\fR
bin boot builddir dev etc home lib lib64 media mnt opt ...
See also \fB\-\-shell\fR.
.TP
\fB\-\-debug-config\fP
Print all options in config_opts.
.TP
\fB\-\-debug-config-expanded\fP
Prints all options in config_opts with jinja template values already expanded.
.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 "static" deps for SRPM or RPM, and do a \fIdnf install\fR to put them
into the buildroot. No 'cleanup' is performed.
Dynamic build dependencies (\fI%generate_buildrequires\fR specfile section) are
not installed, see \fB\-\-calculate\-build\-dependencies\fR.
.TP
\fB\-\-hermetic\-build \fILOCKFILE\fR \fIREPO\fR \fISRPM\fR
Perform a hermetic RPM build (i.e., an offline build without the need to access
the Internet at all) from the given \fISRPM\fR (= file name, path on your
system). After running Mock with the \fB\-\-calculate\-build\-dependencies\fR
option to generate the \fILOCKFILE\fR file (typically named
\fIbuildroot_lock.json\fR in the result directory), and then running the
\fImock\-hermetic\-repo(1)\fR helper to generate \fIREPO\fR (a directory on the
host that provides RPMs with metadata and a bootstrap image tarball), Mock has
all the necessary information to build RPMs from the given \fISRPM\fR fully
offline. More info in the feature page:
\fIhttps://rpm-software-management.github.io/mock/feature-hermetic-builds\fR
.TP
\fB\-\-list-chroots\fP
List all available chroots names and their description - both system-wide and user ones.
.TP
\fB\-l\fR, \fB\-\-list\-snapshots\fP
List all existing snapshots of the chroot belonging to the 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 an LVM volume, TMPFS or overlayfs.
.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 the specified root.
.TP
\fB\-\-pm\-cmd\fP
Execute following arguments with the 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. Rebuild the specified SRPM(s). The chroot (including the results directory) 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 or overlayfs plugin is installed and enabled.
.TP
\fB\-\-rollback\-to\fP
Return chroot to the state in the 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 the lvm_root or overlayfs plugin is installed and enabled.
.TP
\fB\-\-scm\-enable\fP
Enable building from an SCM (CVS/Git/SVN/DistGit). 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, bootstrap, cache, root\-cache, c\-cache, yum\-cache or dnf\-cache. In fact, dnf\-cache is just alias for yum\-cache, and both remove Dnf and Yum cache.
.TP
\fB\-\-scrub\-all\-chroots\fP
Run \fBmock \-\-scrub=all \-r <\fIchroot\fB>\fR for all chroots that appear to
have been used previously (some leftovers in \fB/var/lib/mock\fR or
\fB/var/cache/mock\fR were detected by the heuristic). This option cannot clean
leftovers for chroots with configurations in non-standard locations, or if the
configuration is no longer available. It also attempts to detect previous use
of \fB\-\-uniqueext\fR and adjusts the corresponding \fB\-\-scrub=all\fR call
accordingly.
.TP
\fB\-\-shell\fP [\fI\-\-\fR] [\fICOMMAND\fR [\fIARGS...\fR]]
Shell mode. Run the specified command interactively within the chroot (no
\fB\-\-clean\fR is performed). If no command specified, \fB/bin/sh\fR is run
and prompt is provided.
Be aware that mock first parses all the command-line arguments, so the
\fIARGS\fR could be mistakenly evaluated as mock's options. Thats why you
almost always want to use the \fI\-\-\fR separator.
This mode does not produce logs (nothing is appended to \fBroot.log\fR in
\fB\-\-resultdir\fR).
The \fICOMMAND\fR and \fIARGS\fR are shell expanded using the shell in chroot
(unless they mistakenly expand in host's terminal shell). E.g. the following
two commands are equivalent:
\fBmock \-\-shell \-\- ls \-l '*'\fR
\fBmock \-\-shell 'ls \-l *'\fR
.br
But the following is something entierly different:
\fBmock \-\-shell \-\- ls \-l *\fR
.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.
.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 the lvm_root or overlayfs 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 an LVM volume, TMPFS or overalyfs.
.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 overwritten in chroot config to default to /usr/bin/yum-deprecated.
This option will enforce \-\-yum.
.TP
Note: While you can specify more commands on a command line, only one can be executed. The last command will win.
.SH "OPTIONS"
.LP
.TP
\fB\-a\fR, \fB\-\-addrepo\fR=\fIREPO\fP
Add a repo baseurl to the DNF/YUM configuration for both the build chroot and
the bootstrap chroot. This option can be specified multiple times, allowing you
to reference multiple repositories in addition to the default repository set.
.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\-\-additional\-package\fR=\fIPACKAGE\fP
An additional package (on top of in-package specified BuildRequires) to be
installed into the buildroot before the build is done. Can be specified
multiple times. Works only with \fB\-\-rebuild\fR.
.TP
\fB\-\-forcearch\fR=\fIARCH\fP
Pass \-\-forcearch to DNF. This will enable to install packages for different architecture. Works only for DNF and you have to have package qemu-user-static installed.
.TP
\fB\-\-cache\-alterations\fR
Rebuild the root cache after making alterations to the chroot (i.e. \-\-install). This option is useful only 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\-\-config-opts\fR=\fIKEY=VALUE\fP
Override configuration option. Can be used multiple times.
When used multiple times for the same key, it will create an array (if you need
to specify an array value with just a single item, e.g.
\fIconfig_opts["foo"] = ["baz"]\fR, specify it as array of two items with the
empty string as the second item, e.g. \fI--config-opts=foo=baz
--config-opts=foo=\fR).
This is evaluated after parsing configs, so command line options override
previously defined options.
.TP
\fB\-\-continue\fR
If a pkg fails to build, continue to the next one, default is to stop.
Works only with \fB\-\-chain\fR.
.TP
\fB\-\-cwd\fR=\fIDIR\fP
Change to the specified directory (relative to the chroot) before running command when using \-\-chroot or \-\-shell.
.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. This is the default.
.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\-\-enable\-network\fR
Enable networking. If you want to have reproducible builds then your builds should run without a network.
This option overrides config_opts['rpmbuild_networking'] and config_opts['use_host_resolv'], setting both True.
.TP
\fB\-\-isolation\fR={\fIauto\fR|\fInspawn\fR|\fIsimple\fR}
What should be used for isolation of chroot. The \fIsimple\fR method uses
chroot() call. The \fInspawn\fR method utilizes systemd-nspawn(1) and runs the
commands inside container. The \fIauto\fR tries to use \fInspawn\fR, and falls
back to \fIsimple\fR if system-nspawn can not be used (e.g. if mock is run in
container). The default is \fIauto\fR.
.TP
\fB\-\-localrepo\fR=\fIREPO\fR\fR
Set the path to put the results/repo in (works only in \fB\-\-chain\fR mode).
Will make a tempdir if not set.
.TP
\fB\-c\fR
If package fails, continue to the next one (works only in \fB\-\-chain\fR mode).
.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
Deprecated. Use \fV\-\-isolation=nspawn\fP.
.TP
\fB\-n\fR, \fB\-\-no\-clean\fR
Do not clean chroot before building a package.
.TP
\fB\-\-nocheck\fR
Pass \-\-nocheck to rpmbuild to skip 'make check' tests.
.TP
\fB\-N\fR, \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 an 'offline' mode where we tell 'yum' to run completely from the local cache. Also, disables cache expiry for the mock yum cache.
.TP
\fB\-\-old\-chroot\fR
Deprecated. Use \fV\-\-isolation=simple\fP.
.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.
Examples:
\fB\-\-plugin\-option=root_cache:age_check=False\fR
\fB\-\-plugin\-option=mount:dirs=("/dev/device", "/mount/path/in/chroot/", "vfstype", "mount_options")\fR
.TP
\fB\-\-postinstall\fR
Try to install built packages in the same buildroot right after the build.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Be quiet.
.TP
\fB\-\-recurse\fR
Build all pkgs, record the failures and try to rebuild them again and again
until everything gets built (or until the set of pkgs failing to build are the
same over) sets \fB\-\-continue\fR. Works only with \fB\-\-chain\fR.
.TP
\fB\-r\fR \fICONFIG\fP, \fB\-\-root\fR=\fICONFIG\fP
Uses specified chroot configuration as defined in
~/.config/mock/<\fICONFIG\fP>.cfg or /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}}"/"{{target_arch}}"/\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.
Note that this option does not have an effect for \-\-chain command. You can use \-\-localrepo instead.
.TP
\fB\-\-rootdir\fR=\fIROOTDIR\fP
The 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 the build.
It doesn't produce RPMs, and 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\-\-tmp_prefix\fR=\fIPREFIX\fP
Tmp dir prefix - will default to username-pid if not specified.
.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 the 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 the 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.
.TP
\fB\-\-bootstrap-chroot\fR
build in two stages, using chroot rpm for creating the build chroot
.TP
\fB\-\-no-bootstrap-chroot\fR
build in a single stage, using system rpm for creating the build chroot
.TP
\fB\-\-use-bootstrap-image\fR
Instead of creating a bootstrap chroot from scratch, use podman image specified in
\fBconfig_opts['bootstrap_image']\fR, extract it, and use it as a cache for the bootstrap chroot.
This is useful when host \fBrpm\fR version is not compatible with the target system, or when using mock
on non-RPM distributions. This option turns \fB\-\-bootstrap\-chroot\fR on.
.TP
\fB\-\-no-bootstrap-image\fR
don't create bootstrap chroot from container image
.TP
\fB\-\-buildroot\-image\fR \fIBUILDROOT_IMAGE\fR
Use an OCI image (or a local file containing an OCI image as a tarball) as the
base for the buildroot. The image must contain a compatible distribution.
.SH "FILES"
.LP
\fI/etc/mock/\fP \- default configuration directory
.LP
\fI/var/lib/mock\fP \- directory where chroots and results are created. You should not put there your input files.
.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 execute a 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 an issue with Mock, go to:
.LP
.RS 5
\fIhttps://github.com/rpm-software-management/mock/issues\fR
.RE
.LP
Search through the list of existing issues. If there is a similar
issue to the one you are seeing, add your information in new comments.
If not, press \fBNew issue\fR and fill in the form.
.SH "AUTHORS"
.LP
Michael Brown <mebrown\@michaels\-house.net>
.LP
Clark Williams <williams\@redhat.com>
.LP
Seth Vidal
.LP
and a cast of...tens
.SH "SEE ALSO"
.LP
rpmbuild(8),
yum(8),
dnf(8),
https://rpm-software-management.github.io/mock/

14
mock/docs/mock.cheat Normal file
View file

@ -0,0 +1,14 @@
# to build a package
mock -r fedora-30-x86_64 foo.src.rpm
# to enter shell in different distribution
mock -r epel-7-x86_64 --shell
# to run command in different distribution
mock -r epel-7-x86_64 --chroot cat /etc/os-release
# to build for different architecture
mock -r fedora-30-s390x --forcearch=s390x foo.src.rpm
# to clean everything
mock -r fedora-30-x86_64 --scrub=all

759
mock/docs/site-defaults.cfg Normal file
View file

@ -0,0 +1,759 @@
# mock defaults
# vim:tw=0:ts=4:sw=4:et:
#
# If you want to alter just some setting for one user, you can put the
# configuration in:
# ~/.config/mock.cfg
#
# This config file is for site-specific default values that apply across all
# configurations. Options specified in this config file can be overridden in
# the individual mock config files.
#
# The site-defaults.cfg delivered by default has NO options set. Only set
# options here if you want to override the defaults.
#
# It's possible to use include statement in order to make one config included to another:
# include('/path/to/included/config.cfg')
#
# Entries in this file follow the same format as other mock config files.
# config_opts['foo'] = 'bar'
#
# You can use jinja templates, e.g.:
# config_opts['foobar'] = '{{ foo }} bar'
# which will result in 'bar bar' (using value defined few lines above)
# more complicated example:
# config_opts['foo'] = "{{ plugin_conf['package_state_enable'] }}"
# which will result in "True"
#############################################################################
#
# Things that we recommend you set in site-defaults.cfg:
#
# config_opts['basedir'] = '/var/lib/mock/'
# config_opts['cache_topdir'] = '/var/cache/mock'
# Note: the path pointed to by basedir and cache_topdir must be owned
# by group 'mock' and must have mode: g+rws
# config_opts['rpmbuild_timeout'] = 0
# Using --enable-network sets use_host_resolv True, overriding the value set here.
# config_opts['use_host_resolv'] = False
# You can configure log format to pull from logging.ini formats of these names:
# config_opts['build_log_fmt_name'] = "unadorned"
# config_opts['root_log_fmt_name'] = "detailed"
# config_opts['state_log_fmt_name'] = "state"
#
# By default, mock only prints the build log to stderr if it is a tty. You can
# force it on here (for CI builds where there is no tty, for example) by
# setting this to True, or force it off by setting it to False. Setting it to
# None or leaving it undefined uses the default behavior.
# config_opts['print_main_output'] = None
#
# This option sets the beginning of the line with stderr output in build.log file.
# By default it's an empty string.
# config_opts['stderr_line_prefix'] = ""
#
# mock will normally set up a minimal chroot /dev.
# If you want to use a pre-configured /dev, disable this and use the bind-mount
# plugin to mount your special /dev
# config_opts['internal_dev_setup'] = True
#
# the cleanup_on_* options allow you to automatically clean and remove the
# mock build directory, but only take effect if --resultdir is used.
# config_opts provides fine-grained control. cmdline only has big hammer
#
# config_opts['cleanup_on_success'] = True
# config_opts['cleanup_on_failure'] = True
# The build user's homedir is partially cleaned up even when --no-clean is
# specified in order to prevent garbage from previous builds from altering
# successive builds. Mock can be configured to exclude certain files/directories
# from this. Default is SOURCES directory to support nosrc rpms. Paths are
# relative to build user's homedir
# config_opts['exclude_from_homedir_cleanup'] = ['build/SOURCES']
# Choose the isolation method for running commands in buildroot. Possible
# values are 'nspawn' (mock uses systemd-nspawn(1)), 'simple' (simple
# os.chroot() is used) or 'auto' (use 'nspawn' when possible, and fallback to
# 'chroot').
#config_opts['isolation'] = 'auto'
# If you're using isolation='nspawn', then by default networking will be turned
# off for rpmbuild. This helps ensure more reproducible builds.
#config_opts['rpmbuild_networking'] = False
# Additional args for nspawn
# config_opts['nspawn_args'] = ['--capability=cap_ipc_lock']
## When RPM is build in container then build hostname is set to name of
## container. This sets the build hostname to name of container's host.
## Works only in F25+ chroots
# config_opts['use_container_host_hostname'] = True
# This works unconditionally by calling sethostname(), however
# variable use_container_host_hostname or %_buildhost macro can override this
# config_opts['hostname'] = 'my.own.hostname'
# The default package manager is DNF4. The options are:
# - 'dnf4' for DNF4 (Python) https://github.com/rpm-software-management/dnf
# - 'dnf5' for DNF5 (C++) https://github.com/rpm-software-management/dnf5
# The major version of DNF5 will remain '5' indefinitely, see #1271.
# - 'yum' for YUM https://github.com/rpm-software-management/yum
#config_opts['package_manager'] = 'dnf4'
# Number of attempts to execute package manager's action, and delay between
# attempts (seconds). This is useful e.g. if the build is done against
# non-reliable mirrors (downloading of metadata failed, package download
# failed, ...).
#config_opts['package_manager_max_attempts'] = 1
#config_opts['package_manager_attempt_delay'] = 10
# Dynamic BuildRequires, available since RPM 4.15
# config_opts['dynamic_buildrequires'] = True
# config_opts['dynamic_buildrequires_max_loops'] = 10
# Allows use of external buildrequires. I.e. when dependencies are installed
# from PyPI, Rubygems...
# config_opts['external_buildrequires'] = False
# Default maximum number of dev loops in chroot is 12
# config_opts['dev_loop_count'] = 12
# rpmbuild/rpm executable path if you need to use different version that the
#config_opts['rpmbuild_command'] = '/usr/bin/rpmbuild'
#config_opts['rpm_command'] = '/bin/rpm'
# By default a Yum/DNF update is performed before each rebuild
# config_opts['update_before_build'] = True
# Sometimes the rpm/yum/dnf ecosystem on the host machine isn't really
# compatible with the rpm/yum/dnf ecosystem in mock chroot (the system we
# build for). Typically when host is yum-based and target system is dnf-based.
# Such scenario may cause an error when preparing the target mock buildroot, or
# even worse an unexpected install transaction that is hard to detect.
# Therefore, with `use_bootstrap=True` default, we first install a minimal
# "bootstrap" chroot that only contains rpm/yum/dnf stack, and from that
# "bootstrap" chroot we initialize the target chroot.
#config_opts['use_bootstrap'] = True
# The bootstrap chroot is normally installed using a package manager from host,
# but in some cases even this isn't possible (e.g. installing rather new ZSTD
# compressed dnf.rpm package by 'dnf4_install_command' on epel-7 host). In such
# case, you may need to have "bootstrap" chroot pre-populated from a container
# image first (where the package manager stack is already pre-installed, so
# mock doesn't have to).
#config_opts['use_bootstrap_image'] = True
#config_opts['bootstrap_image'] = 'fedora:latest'
# Mock in a nutshell needs to have the selected config_opts["package_manager"]
# executable in bootstrap, and "builddep" command working. That's why Mock
# automatically installs appropriate packages (e.g. dnf5/dnf5-plugins, if
# package_manager==dnf5). If the config_opts["bootstrap_image"] though points
# to a well-prepared image (no additional packages need to be installed), we
# can set bootstrap_image_ready to True and Mock then avoids installing
# packages into the bootstrap chroot. The initial package manager operation is
# very expensive (downloading metadata, initializing caches, ...) so setting
# this to True significantly speeds the bootstrap-from-bootstrap_image
# preparation. This can also help work-around some preparation issues, see
# https://github.com/rpm-software-management/mock/issues/1088
# "bootstrap_module_setup_commands" and "bootstrap_chroot_additional_packages"
# options invalidate the effect of this option.
#config_opts['bootstrap_image_ready'] = False
# If 'use_bootstrap_image' is True, Mock is instructed download the configured
# container image from image registry. This option controls the behavior when
# the image can not be downloaded. When set to False, Mock fails hard. When
# set to True, Mock falls-back to normal bootstrap chroot installation using
# package manager (e.g. using dnf --installroot).
#config_opts['bootstrap_image_fallback'] = True
# When 'use_bootstrap_image' is True, bootstrap image must be downloaded and it
# may fail. Mock's logic is to retry downloads, using this option you can
# configure how long should Mock keep trying (using exponential algorithm with
# full jitter, see python-backoff docs for more info).
#config_opts['bootstrap_image_keep_getting'] = 120 # seconds
# Skip the "podman pull" and rely on the image already being in the local cache.
#config_opts["bootstrap_image_skip_pull"] = False
# If provided, Mock performs a 'podman image inspect --format {{ .Digest }}'
# call and asserts that the downloaded/imported bootstrap_image has expected
# Digest (SHA256 string).
#config_opts["bootstrap_image_assert_digest"] = None
# anything you specify with 'bootstrap_*' will be copied to bootstrap config
# e.g. config_opts['bootstrap_system_yum_command'] = '/usr/bin/yum-deprecated' will become
# config_opts['system_yum_command'] = '/usr/bin/yum-deprecated' for bootstrap config
# These three are overrided in bootstrap by default as we usually do not want additional packages
# and modules in bootstrap chroot.
#config_opts['bootstrap_chroot_additional_packages'] = []
#config_opts['bootstrap_module_setup_commands'] = []
# if you want mock to automatically run createrepo on the rpms in your
# resultdir.
# config_opts['createrepo_on_rpms'] = False
# config_opts['createrepo_command'] = '/usr/bin/createrepo_c -d -q -x *.src.rpm'
# What tar binary should be used by Mock.
#config_opts['tar_binary'] = "/bin/tar"
# You can configure what is the tar implementation stored on the
# config_opts['tar_binary'] path. Depending on this, Mock will use a different
# set of command-line options for tar commands. Valid options are "gnutar" or
# "bsdtar" (used by root cache and SCM plugin, but also by core Mock for
# unpacking Podman container file-systems with --use-bootstrap-image option).
#config_opts['tar'] = "gnutar"
# if you want mock to backup the contents of a result dir before clean
# config_opts['backup_on_clean'] = False
# config_opts['backup_base_dir'] = "{{basedir}}/backup"
# if you want to speed up the package installation and the build process, mock
# can use nosync library to skip fsync and related calls from programs called
# from within mock. It needs nosync library to be installed and for multilib
# target, it requires both architectures of nosync to be present. If these
# conditions aren't met, it won't be enabled
# config_opts['nosync'] = False
# if you cannot or don't want to install both architectures of nosync and still
# want mock to use it, you can force it, but then expect a lot of (generally
# harmless) error messages from ld.so when a 32bit program is executed
# config_opts['nosync_force'] = False
# By default Mock unshare namespace so it is different from your other application
# in unpriviliged container, this is skipped. We will warn you that running mock
# and some other applications in the same container is not good idea and
# can be security risk. If you are fully aware of this risk or mock is your
# only one application in that container you can disable the warning here.
# config_opts['docker_unshare_warning'] = True
# Change directory where resulting files (RPMs and build logs) are written.
# Resultdir can contain python-string substitutions for any variable in the chroot config.
# config_opts["resultdir"] = "{{basedir}}/{{root}}/result"
#############################################################################
#
# plugin related. Below are the defaults. Change to suit your site
# policy. site-defaults.cfg is a good place to do this.
#
# NOTE: Some of the caching options can theoretically affect build
# reproducability. Change with care.
#
# config_opts['plugin_conf']['package_state_enable'] = True
# config_opts['plugin_conf']['package_state_opts'] = {}
# config_opts['plugin_conf']['package_state_opts']['available_pkgs'] = False
# config_opts['plugin_conf']['package_state_opts']['installed_pkgs'] = True
# config_opts['plugin_conf']['ccache_enable'] = False
# config_opts['plugin_conf']['ccache_opts'] = {}
# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G'
# config_opts['plugin_conf']['ccache_opts']['compress'] = None
# config_opts['plugin_conf']['ccache_opts']['dir'] = "{{cache_topdir}}/{{root}}/ccache/u{{chrootuid}}/"
# config_opts['plugin_conf']['ccache_opts']['hashdir'] = True
# config_opts['plugin_conf']['ccache_opts']['show_stats'] = False
# config_opts['plugin_conf']['ccache_opts']['debug'] = False
# config_opts['plugin_conf']['yum_cache_enable'] = True
# config_opts['plugin_conf']['yum_cache_opts'] = {}
# config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30
# config_opts['plugin_conf']['yum_cache_opts']['max_metadata_age_days'] = 30
# config_opts['plugin_conf']['yum_cache_opts']['online'] = True
# config_opts['plugin_conf']['root_cache_enable'] = True
# config_opts['plugin_conf']['root_cache_opts'] = {}
# config_opts['plugin_conf']['root_cache_opts']['age_check'] = True
# config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15
# config_opts['plugin_conf']['root_cache_opts']['dir'] = "{{cache_topdir}}/{{root}}/root_cache/"
# config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "pigz"
## decompress_program is needed only for bsdtar, otherwise `compress_program` with `-d` is used
## for bsdtar use "unpigz" or "gunzip"
# config_opts['plugin_conf']['root_cache_opts']['decompress_program'] = "pigz"
# config_opts['plugin_conf']['root_cache_opts']['extension'] = ".gz"
# config_opts['plugin_conf']['root_cache_opts']['exclude_dirs'] = ["./proc", "./sys", "./dev",
# "./var/tmp/ccache", "./var/cache/yum",
# "./var/cache/dnf", "./var/log" ]
# config_opts['plugin_conf']['hw_info_enable'] = True
# config_opts['plugin_conf']['hw_info_opts'] = {}
#
# config_opts['plugin_conf']['procenv_enable'] = False
# config_opts['plugin_conf']['procenv_opts'] = {}
#
# config_opts['plugin_conf']['showrc'] = False
# config_opts['plugin_conf']['showrc'] = {}
#
#
# bind mount plugin is enabled by default but has no configured directories to
# mount
# config_opts['plugin_conf']['bind_mount_enable'] = True
# config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' ))
#
# config_opts['plugin_conf']['tmpfs_enable'] = False
# config_opts['plugin_conf']['tmpfs_opts'] = {}
# config_opts['plugin_conf']['tmpfs_opts']['required_ram_mb'] = 1024
# config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '768m'
# config_opts['plugin_conf']['tmpfs_opts']['mode'] = '0755'
# config_opts['plugin_conf']['tmpfs_opts']['keep_mounted'] = False
#
# https://rpm-software-management.github.io/mock/Plugin-ChrootScan
# config_opts['plugin_conf']['chroot_scan_enable'] = False
# config_opts['plugin_conf']['chroot_scan_opts'] = {
## Regexp of files which should be copied from buildroot to resultdir.
# 'regexes': [ "^[^k]?core(\.\d+)?", "\.log$",],
## If set to True files are copied only if build failed.
# 'only_failed': True,
## If set to True, tarball is created instead of directory.
# 'write_tar': False,
#}
#
# lvm_root plugin is not enabled by default and is distributed in separate
# subpackage mock-lvm. If you want to use it, it's recommended to disable the
# root_cache plugin, otherwise you'd be caching twice.
# config_opts['plugin_conf']['lvm_root_enable'] = False
# config_opts['plugin_conf']['lvm_root_opts'] = {}
# You need to give it a volume group with sufficient space. It won't touch any
# of the existing logical volumes, so you can use the same volume group you use
# for other purposes. It requires a name of the VG (not device path).
# config_opts['plugin_conf']['lvm_root_opts']['volume_group'] = 'my_vg'
# You need to specify the size that will mock's thinpool occupy. For regular
# packages with small set of dependencies, 2G should suffice. For large packages
# such as libreoffice, you should set it to at least 5 GB otherwise you may run
# out of space and the build process will be blocked
# config_opts['plugin_conf']['lvm_root_opts']['size'] = '2G'
# You can specify alternative pool metadata size, format is the same as size.
# Default value is determined by lvcreate based on size
# config_opts['plugin_conf']['lvm_root_opts']['poolmetadatasize'] = None
# When thin pool utilization is over 90% mock will refuse to continue.
# Because once it reach 100% utilization weird things will happens.
# config_opts['plugin_conf']['lvm_root_opts']['check_size'] = True
# Specifying whether the buildroot volume should stay mounted after mock exits.
# config_opts['plugin_conf']['lvm_root_opts']['umount_root'] = False
# Filesystem name that will be used for the volume. It will use mkfs.$filesystem binary to create it.
# config_opts['plugin_conf']['lvm_root_opts']['filesystem'] = "ext4"
# The whole command for creating the filesystem that will get the volume path as an argument. When set, overrides above
# option.
# config_opts['plugin_conf']['lvm_root_opts']['mkfs_command'] = None
# Additional arguments passed to mkfs command.
# config_opts['plugin_conf']['lvm_root_opts']['mkfs_args'] = []
# Will be passed to -o option of mount when mounting the volume. String or None.
# config_opts['plugin_conf']['lvm_root_opts']['mount_opts'] = None
# How long to sleep when waiting for concurrent LVM initialization.
# config_opts['plugin_conf']['lvm_root_opts']['sleep_time'] = 1
#
# overlayfs plugin
# It is recomended to disable root_cache plugin, when overlayfs plugin
# is enabled since overlayfs plugin implicitly creates postinit snapshot
# ( similary to lvm_root plugin), which makes root cache pointless.
# ( Recomended with: config_opts['plugin_conf']['root_cache_enable'] = False )
# config_opts['plugin_conf']['overlayfs_enable'] = False
# config_opts['plugin_conf']['overlayfs_opts']['base_dir'] = /some/directory
# config_opts['plugin_conf']['overlayfs_opts']['touch_rpmdb'] = False
### pm_request plugin can install packages requested from within the buildroot
# It is disabled by default, as it affects build reproducibility. It can be enabled
# by setting the following to True, but it's not advised to have it enabled globally.
# It's better to enable it per build by using --enable-plugin pm_request
# config_opts['plugin_conf']['pm_request_enable'] = False
# config_opts['plugin_conf']['pm_request_opts'] = {}
### If you want to compress mock logs, enable this plugin
# config_opts['plugin_conf']['compress_logs_enable'] = False
### Command used to compress logs - e.g. "/usr/bin/xz -9 --force"
# config_opts['plugin_conf']['compress_logs_opts']['command'] = "gzip"
# Configuration options for the sign plugin:
# config_opts['plugin_conf']['sign_enable'] = False
# config_opts['plugin_conf']['sign_opts'] = {}
# config_opts['plugin_conf']['sign_opts']['cmd'] = 'rpmsign'
# The options to pass to the signing command. %(rpms)s will be expanded to
# the rpms in the results folder.
# config_opts['plugin_conf']['sign_opts']['opts'] = '--addsign %(rpms)s -D "%%_gpg_name your_name" -D "%%_gpg_path /home/your_name/.gnupg"'
# Enable preprocessing step before srpm build by using rpkg utilities
# config_opts['plugin_conf']['rpkg_preprocessor_enable'] = False
# config_opts['plugin_conf']['rpkg_preprocessor_opts']['requires'] = ['preproc-rpmspec']
# config_opts['plugin_conf']['rpkg_preprocessor_opts']['cmd'] = '/usr/bin/preproc-rpmspec %(source_spec)s --output %(target_spec)s'
# The rpmautospec plugin is disabled by default and distributed in the separate
# subpackage mock-rpmautospec.
# config_opts['plugin_conf']['rpmautospec_enable'] = True
# config_opts['plugin_conf']['rpmautospec_opts'] = {
# 'requires': ['rpmautospec'],
# 'cmd_base': ['/usr/bin/rpmautospec', 'process-distgit'],
# }
#############################################################################
#
# environment for chroot
#
# config_opts['environment']['TERM'] = 'vt100'
# config_opts['environment']['SHELL'] = '/bin/bash'
# config_opts['environment']['HOME'] = '/builddir'
# config_opts['environment']['HOSTNAME'] = 'mock'
# config_opts['environment']['PATH'] = '/usr/bin:/bin:/usr/sbin:/sbin'
# config_opts['environment']['PROMPT_COMMAND'] = r'printf "\033]0;<mock-chroot>\007"'
# config_opts['environment']['PS1'] = r'<mock-chroot> \s-\v\$ '
# config_opts['environment']['LANG'] = 'C.UTF-8'
#
## other example for PS1
# config_opts['environment']['PS1'] = r'[\u@\h<mock-chroot>/\w]\[\033[01;31m\]${?/#0/}\[\033[00m\]\$'
# feel free to craft your own at: http://bashrcgenerator.com/
#############################################################################
#
# Things that you can change, but we dont recommend it:
#
# config_opts['chroothome'] = '/builddir'
# config_opts['clean'] = True
## you could not really use substitution here so it will not work if overridden:
# config['rootdir'] = '/var/lib/mock/<CONFIG>/root/'
## This works in F25+ chroots. This overrides 'use_container_host_hostname' option
# config_opts['macros']['%_buildhost'] = 'my.own.hostname'
#
# Each Mock run has a unique UUID
#config_opts["mock_run_uuid"] = str(uuid.uuid4())
#
# These OCI buildroot related options are set&used automatically by
# --buildroot-image option logic. The semantics are similar to the *bootstrap*
# counterparts above, e.g., see `config_opts['bootstrap_image']`.
#
# Use OCI image for build chroot initialization. Requires 'buildroot_image' to be set.
#config_opts['use_buildroot_image'] = False
# Initialize buildroot from this OCI image (image reference).
#config_opts['buildroot_image'] = None
# Mock normally tries to pull up2date buildroot image. Set to True if
# you want to use the local image.
#config_opts['buildroot_image_skip_pull'] = False
# No need to intsall any package into the buildroot extracted from an OCI
# image. TODO: not implemented.
#config_opts['buildroot_image_ready'] = False
# If the 'buildroot_image' above can not be used for any reason, fallback to a
# normal DNF installation. If set to False, it leads to hard failure.
#config_opts['buildroot_image_fallback'] = False
# Keep trying 'podman pull' for at most 120s.
#config_opts['buildroot_image_keep_getting'] = 120
# If set, mock compares the OCI image digest with the one specified here.
#config_opts['buildroot_image_assert_digest'] = None
#############################################################################
#
# Things that must be adjusted if SCM integration is used:
#
# config_opts['scm'] = True
# config_opts['scm_opts']['method'] = 'git'
# config_opts['scm_opts']['cvs_get'] = 'cvs -d /srv/cvs co SCM_BRN SCM_PKG'
# if there is "--recurse-submodules" or "--recursive" then git submodules are checkout too
# config_opts['scm_opts']['git_get'] = 'git clone SCM_BRN git://localhost/SCM_PKG.git SCM_PKG'
# config_opts['scm_opts']['svn_get'] = 'svn co file:///srv/svn/SCM_PKG/SCM_BRN SCM_PKG'
# config_opts['scm_opts']['distgit_get'] = 'rpkg clone -a --branch SCM_BRN SCM_PKG SCM_PKG'
# config_opts['scm_opts']['distgit_src_get'] = 'rpkg sources'
# config_opts['scm_opts']['spec'] = 'SCM_PKG.spec'
# config_opts['scm_opts']['int_src_dir'] = None
# config_opts['scm_opts']['ext_src_dir'] = '/dev/null'
# config_opts['scm_opts']['write_tar'] = True
# config_opts['scm_opts']['git_timestamps'] = True
# config_opts['scm_opts']['exclude_vcs'] = True
# These options are also recognized but usually defined in cmd line
# with --scm-option package=<pkg> --scm-option branch=<branch>
# config_opts['scm_opts']['package'] = 'mypkg'
# config_opts['scm_opts']['branch'] = 'main'
#############################################################################
#
# Things that are best suited for individual chroot config files:
#
# MUST SET (in individual chroot cfg file):
# config_opts['root'] = 'name-of-yum-build-dir'
# Mock will set architecture to 'target_arch' using personality(2) syscall.
# config_opts['target_arch'] = 'i386'
# When host system architecture is not in 'legal_host_arches' list, mock will refuse to switch to
# 'target_arch' and will raise error.
# config_opts['legal_host_arches'] = ('i386', 'i586', 'i686', 'x86_64')
# Contains content of $CHROOT/etc/yum/yum.conf or $CHROOT/etc/dnf/dnf.conf. If DNF is used and
# 'dnf.conf' is not set, then content of 'yum.conf' is used to populate $CHROOT/etc/dnf/dnf.conf
# and vice versa. But only one of those two can be specified.
# config_opts['yum.conf'] = ''
# or
# config_opts['dnf.conf'] = ''
# Important! You must use 'assumeyes=1' in yum/dnf.conf otherwise Mock will fail.
#
# This is used by DNF and can be used in dnf.conf as $key and will be replaced by its value
# config_opts['dnf_vars'] = { 'key': 'value', 'key2': 'value2' }
#
# Flip this if you want to get rid of warning message on systems which do not
# support the desired package manager (e.g. when only Yum is available on host,
# but the chosen buildroot expects to be installed via Dnf).
# Warning! Setting this to False will automatically use Yum on RHEL{6,7} platforms.
# config_opts['dnf_warning'] = True
#
# CAN SET, defaults usually work ok:
# config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
# @buildsys-build is comps group defined by Fedora
# for chroot_setup_cmd we actually need those packages:
# * rpm-build - mock needs /usr/bin/rpmbuild
# * glibc-minimal-langpack - this is optional, but helps to avoid
# installation of huge glibc-all-langpacks.
# config_opts['chroot_additional_packages'] = []
# config_opts['log_config_file'] = 'logging.ini'
# config_opts['more_buildreqs']['srpm_name-version-release'] = 'dependency'
# config_opts['more_buildreqs']['srpm_name-version-release'] = ['dependency1', 'dependency2']
# config_opts['macros']['%Add_your_macro_name_here'] = "add macro value here"
# config_opts['files']['path/name/no/leading/slash'] = "put file contents here."
# config_opts['chrootuid'] = os.getuid()
# config_opts['releasever'] = '20'
# Configuration options related to specific package managers.
#
# You can configure how DNF (and other packager managers) will be used with
# Mock. Each option is specific to a concrete package manager, and then it
# is appropriately prefixed by <pm_pfx>, namely `dnf5_`, `dnf4_`, `yum_` or
# `microdnf_`. Mock attempts to use appropriate package manager depending on
# the `package_manager` configuration option.
#
# Currently there are several options to set (override only if you need to
# use something non-standard).
#
# '<pm_pfx>_command' (e.g. dnf5_command) - the package manager executable
# path, searched both on host (to install bootstrap chroot) or in
# bootstrap chroot (to install buildroot)
#
# '<pm_pfx>_system_command' (e.g. yum_system_command) - the package manager
# executable searched on host only in case of <pm_pfx>_command not found.
# This may be useful for "bootstrap=off" scenarios with the package
# manager installed in a custom location.
#
# '<pm_pfx>_common_opts' (e.g. dnf5_common_opts) - options that are passed to
# every single command execution of the '<pm_pfx>_command' by Mock, minus
# '_avoid_opts', see below
#
# '<pm_pfx>_avoid_opts" (e.g. dnf5_common_opts) - a dictionary where key
# matches a sub-command of the '<pm_pfx>_command', and value is a list[]
# of options that are going to be filtered out (from _common_opts) and
# newer used for a particular sub-command.
#
# '<pm_pfx>_install_command' (e.g. dnf5_install_command) - when
# 'use_bootstrap' is enabled, these commands are used to install the
# desired package manager (providing the '<pm_pfx>_command' file) into
# the "bootstrap" chroot; for installing it, Mock first tries to find
# '<pm_pfx>_command' on host, and then if not found there is a
# pre-defined fallback so Mock tries other host's managers (dn5
# => dnf => yum, etc.). But installing the bootstrap chroot might not
# be an easy task in some cases (e.g. installing modern Fedora bootstrap
# where packages are Zstd-compressed with the old Yum from RHEL 7). You
# might want to use 'use_bootstrap_image' instead (then bootstrap chroot
# is just "downloaded", not installed).
#
# '<pm_pfx>_disable_plugins (e.g. dnf4_disable_plugins) - list of package
# manager plugins that should be always disabled when Mock executes the
# '<pm_pfx>_command' (e.g. versionlock, with Mock we always want to build
# against the latest package versions available in buildroot)
#
# '<pm_pfx>_builddep_command (e.g. yum_builddep_command) - normally,
# the '<pm_pfx>_command builddep' command is used by default to install
# build dependencies. There's no 'yum builddep' (sub)command though,
# but /bin/yum-builddep. Use this option to override the default.
#
# '<pm_pfx>_builddep_opts (e.g. dnf5_builddep_opts) - list of additional
# options to always use with the builddep command
# DNF4 specific options (Fedora <= 39, EL 8, 9 and 10)
#
# Don't be confused by the '-3' suffix in the DNF4 script. This is a
# historical artifact from when it was necessary to differentiate between
# 'Python 3' and 'Python 2' scripts.
#config_opts['dnf4_command'] = '/usr/bin/dnf-3'
#config_opts['dnf4_system_command'] = '/usr/bin/dnf'
#config_opts['dnf4_common_opts'] = ['--setopt=deltarpm=False', '--setopt=allow_vendor_change=yes', '--allowerasing']
#config_opts['dnf4_install_command'] = 'install python3-dnf python3-dnf-plugins-core'
#config_opts['dnf4_disable_plugins'] = ['local', 'spacewalk', 'versionlock']
#config_opts['dnf4_builddep_opts'] = []
# DNF5 specific options (Fedora 40+ https://fedoraproject.org/wiki/Changes/BuildWithDNF5)
#
#config_opts['dnf5_command'] = '/usr/bin/dnf5'
#config_opts['dnf5_system_command'] = '/usr/bin/dnf5'
#config_opts['dnf5_common_opts'] = ['--setopt=deltarpm=False', '--setopt=allow_vendor_change=yes', '--allowerasing']
#config_opts['dnf5_install_command'] = 'install dnf5 dnf5-plugins'
#config_opts['dnf5_disable_plugins'] = []
# DF5 sub-command 'builddep' doesn't support the '--allowerasing' option:
# https://github.com/rpm-software-management/dnf5/issues/461
#config_opts["dnf5_avoid_opts"] = {"builddep": ["--allowerasing"]}
# YUM (for RHEL7 and older) - https://github.com/rpm-software-management/yum
#
#config_opts['yum_command'] = '/usr/bin/yum'
#config_opts['yum_system_command'] = '/usr/bin/yum'
#config_opts['yum_common_opts'] = []
#config_opts['yum_install_command'] = 'install yum yum-utils'
#config_opts['yum_builddep_command'] = '/usr/bin/yum-builddep'
#config_opts['yum_builddep_opts'] = []
# microdnf (limited DNF functionality for containers) - https://github.com/rpm-software-management/microdnf
## "dnf-install" is special keyword which tells mock to use install but with DNF
#config_opts['microdnf_command'] = '/usr/bin/microdnf'
#config_opts['microdnf_common_opts'] = []
#config_opts['microdnf_install_command'] = 'dnf-install microdnf dnf dnf-plugins-core'
#config_opts['microdnf_builddep_command'] = '/usr/bin/dnf'
#config_opts['microdnf_builddep_opts'] = []
# config_opts['priorities.conf'] = 'put file contents here.'
# config_opts['rhnplugin.conf'] = 'put file contents here.'
## Important! You should register your host machine first!
# config_opts['subscription-manager.conf'] = 'put file contents here.'
## This will only work with DNF and when repo is configured with modules=1 for repo in dnf.conf.
# List of module commands to be executed when initializing chroot, before
# `chroot_setup_cmd`. Each command is a pair like `(action, module_specs)`
# where `module_specs` is a comma-separated list of module specifications.
# The commands are executed in order they are configured here, and each
# `action` can be executed multiple times.
#
## Artificial example: (a) Disable any potentially enabled postgresql module
## stream, (b) enable _specific_ postgresql and ruby module streams,
## (c) install the development nodejs profile and (d) disable it immediately.
#config_opts['module_setup_commands'] = [
# ('disable', 'postgresql'),
# ('enable', 'postgresql:12, ruby:2.6'),
# ('install', 'nodejs:13/development'),
# ('disable', 'nodejs'),
#]
## Use this to force foreing architecture (requires qemu-user-static)
# config_opts['forcearch'] = None
## mapping from target_arch (or forcearch) to arch in /usr/bin/qemu-*-static
# config_opts['qemu_user_static_mapping'] = {
# 'aarch64': 'aarch64',
# 'armv7hl': 'arm',
# 'i386': 'i386',
# 'i686': 'i386',
# 'ppc64': 'ppc64',
# 'ppc64le': 'ppc64le',
# 's390x': 's390x',
# 'x86_64': 'x86_64',
# }
#
## Emulating architecture results in slower builds. Expose it to packagers
## This is set to 1 normally. And to 10 when forcearch is in play.
# config_opts['macros']['%_platform_multiplier'] = 1
#
# If you change chrootgid, you must also change "mock" to the correct group
# name in this line of the mock PAM config:
# auth sufficient pam_succeed_if.so user ingroup mock use_uid quiet
# config_opts['chrootgid'] = grp.getgrnam("mock")[2]
# name of user that is used when executing commands inside the chroot
# config_opts['chrootuser'] = 'mockbuild'
# name of the group inside of chroot
# config_opts['chrootgroup'] = 'mock'
# Security related
# config_opts['no_root_shells'] = False
#
# Proxy settings (https_proxy, ftp_proxy, and no_proxy can also be set)
# You can set a specific proxy: 'http://localhost:3128'
# But by default, the existing environment variables are re-used
# config_opts['http_proxy'] = os.getenv("http_proxy")
# config_opts['ftp_proxy'] = os.getenv("ftp_proxy")
# config_opts['https_proxy'] = os.getenv("https_proxy")
# config_opts['no_proxy'] = os.getenv("no_proxy")
#
# Extra dirs to be created when the chroot is initialized
# This is just a list of strings representing chroot paths such as:
# [ '/run/lock', ]
# config_opts['extra_chroot_dirs'] = []
#
# Set timeout in seconds for common mock operations
# if 0 is set, then no time limit is used
# config_opts['opstimeout'] = 0
# Copy host's ca-trust directories into the specified locations inside the
# chroot. Each item in the list is a pair of (host, chroot) paths for the
# directories to be copied, since some hosts and some destination chroots
# may use different paths. The directories are copied recursively.
#config_opts['ssl_copied_ca_trust_dirs'] = None
# Example:
#config_opts['ssl_copied_ca_trust_dirs'] = [
# ('/etc/pki/ca-trust', '/etc/pki/ca-trust'),
# ('/usr/share/pki/ca-trust-source', '/usr/share/pki/ca-trust-source')
#]
# Copy host's SSL certificate bundle ('/etc/pki/tls/certs/ca-bundle.crt') into
# specified location inside chroot. This usually isn't needed because we copy
# the whole /etc/pki/ca-trust/extracted directory recursively by default, and
# Fedora or EL systems work with that. But some destination chroots can have
# different configuration, and copying the bundle helps.
#config_opts['ssl_ca_bundle_path'] = None
# Copy host's SSL certificates into a specified location inside the chroot if
# mock needs access to repositories which require client certificate
# authentication. Specify the full path to the public certificate on the host
# and the destination directory in the chroot. Do the same for the private key.
# The private key should not be password-protected if you want mock to run
# unattended.
#config_opts['ssl_extra_certs'] = None
# Example:
#config_opts['ssl_extra_certs'] = ['/etc/pki/tls/certs/client.crt', '/etc/pki/tls/certs/',
# '/etc/pki/tls/private/client_nopass.key.crt', '/etc/pki/tls/private/']
# user_agent string to identify HTTP request to repositories
# config_opts['user_agent'] = "Mock ({{ root }}; {{ target_arch }})"
# Seccomp (Linux kernel security facility) isn't utilized by Mock, but is
# utilized by systemd-nspawn and Podman (both tools are used by Mock in
# multiple places). The list of seccomp rules (syscall allow-lists) maintained
# in those tools is often different across distributions or even versions.
# Because Mock does cross-distribution builds, "host" distro rules are not
# often applicable on the "target" distribution. To not complicate things, and
# because by design Mock doesn't have to fully isolate, we disable seccomp for
# those containerization tools by default.
#config_opts["seccomp"] = False
# Mock code can go into a relatively deep recursion (e.g. when doing chroot
# cleanup via the recursive rmtree() calls). Use this config option to
# override the default Mock's stack call limit (5000).
#config_opts["recursion_limit"] = 5000
# Mock internals used by the --calculated-build-dependencies and
# --hermetic-build options. Please do not set these options in Mock
# configuration files.
# config_opts["calculatedeps"] = None
# config_opts["hermetic_build"] = False
# List of usernames (strings) that will be pre-created in buildroot. The UID
# and GID in-chroot is going to be the same as on-host. This option is for
# example useful for the 'pesign' use-cases that both (a) bind-mount
# pesign-owned socket-files into the chroot and (b) install the
# 'BuildRequires: pesign' package which would overwrite the ownership of the
# socket file. See https://github.com/rpm-software-management/mock/issues/1091
#config_opts["copy_host_users"] = []
# Whether to use host's shadow-utils to provision users and groups in the
# buildroot, which we normally want to do because host shadow-utils are
# newer and more flexible than buildroot ones. However, there is an issue in shadow-utils
# where even using the --prefix (or, even --root if we did it that way) option, the host
# config will "leak" into the chroot. This is not an issue if the configs are
# effectively the same between host and buildroot, but will cause problems if, for
# example, the host is configured to use FreeIPA-provided subids.
# See https://github.com/shadow-maint/shadow/issues/897
# config_opts["use_host_shadow_utils"] = True
# The `repo_arch` (read-only) option simplifies DNF configuration with Mock for
# non-trivial architecture selection decisions. Typically, we want to use the
# DNF-native `$basearch` variable to instruct DNF to use the appropriate RPM
# architecture for a given Mock config (for cross-arch builds, bootstrap uses a
# different architecture than the target chroot!). However, `$basearch` often
# doesn't work correctly — some distributions do not align the mirror URLs with
# the `$basearch` content (as known by DNF), causing problems with
# cross-distro/cross-architecture builds. The `repo_arch` internal is then
# exported as a `{{ repo_arch }}` Jinja2 placeholder, aiming to help with this
# problem. Simply replace `$basearch` with `{{ repo_arch }}` in your config.
#
# The `repo_arch` thing is not really an "option" but rather a Mock internal
# exported for read-only use-cases. However, the `repo_arch_map` dictionary
# can be used to affect Mock's background decisions. For example, when
# the configuration claims `target_arch=armv7hnl`, but the repo URLs look like
# 'example.com/arm32/', one can use
# `baseurl=example.com/{{ repo_arch }}/` instead of
# `baseurl=example.com/$basearch/`, together with
# `config_opts["repo_arch_map"] = {"armv7hnl": "arm32"}`.
# In such a case, builds on `x86_64` hosts will expand to `example.com/x86_64`
# URL for the bootstrap (native) chroot installation, but also to
# `example.com/arm32` for the target (cross-arch, emulated) chroot
# installation.
#config_opts["repo_arch"] = "Mock internal, e.g. 'x86_64'"
#config_opts["repo_arch_map"] = {}