How To Install mock on Fedora 34

mock is Builds packages inside chroots

Introduction

In this tutorial we learn how to install mock on Fedora 34.

What is mock

Mock takes an SRPM and builds it in a chroot.

We can use yum or dnf to install mock on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install mock.

Install mock on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install mock using dnf by running the following command:

sudo dnf -y install mock

Install mock on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install mock using yum by running the following command:

sudo yum -y install mock

How To Uninstall mock on Fedora 34

To uninstall only the mock package we can use the following command:

sudo dnf remove mock

mock Package Contents on Fedora 34

/etc/mock/logging.ini
/etc/pam.d/mock
/etc/pki/mock
/etc/pki/mock/README.txt
/etc/security/console.apps/mock
/usr/bin/mock
/usr/bin/mock-parse-buildlog
/usr/bin/mockchain
/usr/lib/python3.9/site-packages/mockbuild
/usr/lib/python3.9/site-packages/mockbuild/__init__.py
/usr/lib/python3.9/site-packages/mockbuild/__pycache__
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/__init__.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/__init__.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/backend.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/backend.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/buildroot.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/buildroot.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/config.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/config.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/exception.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/exception.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/external.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/external.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/file_downloader.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/file_downloader.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/file_util.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/file_util.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/mounts.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/mounts.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/package_manager.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/package_manager.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/plugin.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/plugin.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/podman.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/podman.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/rebuild.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/rebuild.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/state.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/state.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/text.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/text.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/trace_decorator.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/trace_decorator.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/uid.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/uid.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/util.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/__pycache__/util.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/backend.py
/usr/lib/python3.9/site-packages/mockbuild/buildroot.py
/usr/lib/python3.9/site-packages/mockbuild/config.py
/usr/lib/python3.9/site-packages/mockbuild/exception.py
/usr/lib/python3.9/site-packages/mockbuild/external.py
/usr/lib/python3.9/site-packages/mockbuild/file_downloader.py
/usr/lib/python3.9/site-packages/mockbuild/file_util.py
/usr/lib/python3.9/site-packages/mockbuild/mounts.py
/usr/lib/python3.9/site-packages/mockbuild/package_manager.py
/usr/lib/python3.9/site-packages/mockbuild/plugin.py
/usr/lib/python3.9/site-packages/mockbuild/plugins
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/bind_mount.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/bind_mount.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/ccache.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/ccache.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/chroot_scan.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/chroot_scan.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/compress_logs.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/compress_logs.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/hw_info.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/hw_info.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/mount.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/mount.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/overlayfs.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/overlayfs.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/package_state.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/package_state.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/pm_request.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/pm_request.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/procenv.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/procenv.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/root_cache.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/root_cache.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/rpkg_preprocessor.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/rpkg_preprocessor.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/selinux.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/selinux.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/showrc.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/showrc.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/sign.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/sign.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/tmpfs.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/tmpfs.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/yum_cache.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/__pycache__/yum_cache.cpython-39.pyc
/usr/lib/python3.9/site-packages/mockbuild/plugins/bind_mount.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/ccache.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/chroot_scan.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/compress_logs.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/hw_info.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/mount.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/overlayfs.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/package_state.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/pm_request.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/procenv.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/root_cache.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/rpkg_preprocessor.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/selinux.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/showrc.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/sign.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/tmpfs.py
/usr/lib/python3.9/site-packages/mockbuild/plugins/yum_cache.py
/usr/lib/python3.9/site-packages/mockbuild/podman.py
/usr/lib/python3.9/site-packages/mockbuild/rebuild.py
/usr/lib/python3.9/site-packages/mockbuild/state.py
/usr/lib/python3.9/site-packages/mockbuild/text.py
/usr/lib/python3.9/site-packages/mockbuild/trace_decorator.py
/usr/lib/python3.9/site-packages/mockbuild/uid.py
/usr/lib/python3.9/site-packages/mockbuild/util.py
/usr/libexec/mock
/usr/libexec/mock/create_default_route_in_container.sh
/usr/libexec/mock/mock
/usr/share/bash-completion/completions/mock
/usr/share/bash-completion/completions/mock-parse-buildlog
/usr/share/cheat/mock
/usr/share/doc/mock/site-defaults.cfg
/usr/share/man/man1/mock-parse-buildlog.1.gz
/usr/share/man/man1/mock.1.gz
/var/cache/mock
/var/lib/mock

References

Summary

In this tutorial we learn how to install mock on Fedora 34 using yum and dnf.