Released on 2023-08-09.
Mock v5.0 new features:
-
The
use_bootstrap_image
feature has been turned on as it was stabilized in this release and it speeds up the bootstrap chroot preparation a lot (by not installing potentially hundreds of packages into the bootstrap chroot, but just extracting thebootstrap_image
contents). For the RHEL based chroots (where UBIbootstrap_image
is in use, and wherepython3-dnf-plugins-core
is installed by default) we also turned on thebootstrap_image_ready=True
which drastically speeds the bootstrap preparation. See the explanation forbootstrap_image_ready
below. See PR#1101 for more info. -
Start using
useradd
anduserdel
utilities from the host to modify in-chrootetc/passwd
andetc/group
. This allowed us to remove theshadow-utils
package from the list of “minimal buildroot” packages (issue#1102). -
There’s a new feature
config_opts['copy_host_users'] = ['pesign', ...]
that allows users to specify a list of users to pre-create in buildroot, copying the IDs from the host. Users/groups used to be historically created by post-scriptlets from the buildroot packages, but the user/group IDs often did not match the IDs on the host - possibly causing weird and hard to fix issues similar to the Pesign one. -
Make sure the
/dev/fuse
device is available in Mock buildroot with--isolation=nspawn
. Without this device, we could not use FUSE filesystems with image builds (PR#1158 and the Fedora Infra issue). -
New option
config_opts['bootstrap_image_ready'] = True|False
was invented. When set toTrue
, Mock doesn’t try to do any package manager actions inside bootstrap (normally Mock installsdnf
tooling there). It simply assumes that the bootstrap image is ready to use (that thednf
tooling is already installed on the image). This might fix hard-to-debug/hard-to-fix issues like issue#1088 when an unexpected bootstrap image is used. This option is enabled by default for RHEL 8 and 9 chroots only. -
The Podman container environment is able to automatically pass down the Red Hat Subscription credentials anytime a RHEL-based (UBI) container is run. But the credential files are then on different path than when run natively on the host, and that used to break Mock. Newly, when Mock is run in a Podman container, the credentials passed down by Podman are automatically detected and used (PR#1130).
-
Even though the requested buildroot is cross-arch (must be initialized with cross-arch packages using the
--forcearch RPM
feature), the bootstrap chroot is newly always prepared with the native architecture. This change has been done to optimize the final buildroot installation — using the “arch natively” compiled DNF stack is much faster than cross-arch emulation usingqemu-user-static
. As a benefit, we can newly simply use the “native” Podman-pulledbootstrap_image
even for cross-arch builds (we have to play with Glibc’s “personality” a bit, but still). See issue#1110. -
The bootstrap-related logging has been changed so the corresponding log entries are now appended to the default
root.log
file. This change should lead to a better understanding what is going on in the bootstrap chroot (issue#539 and PR#1106). -
An easier way to skip Mock plugin execution in Bootstrap chroot has been invented. It is now enough to just specify
run_in_bootstrap = False
global variable in such a plugin, see PR#1116 for more info. The pluginhw_info
has been newly disabled this way. -
The bootstrap chroot installation was made smaller; newly only the
python3-dnf
andpython3-dnf-plugins-core
are installed, instead ofdnf
anddnf-plugins-core
(which used to install also unnecessary documentation files). -
Automatic file downloads (for example with
mock https://exmaple.com/src.rpm
use cases) have been changed to automatically retry the download several times to work around random network failures (PR#1132 and PR#1134). -
The
dnf
anddnf5
processes are newly always executed with the--setopt=allow_vendor_change=yes
option. This is done in belief that we don’t have to protect the Mock builds againstVendor:
changes, while overriding the distro-default RPMs is quite a common thing (mock --chain
e.g.) while mimicking the distro-defaultVendor
tag would be a painful task. The thing is that theallow_vendor_change=no
is going to be set by default in DNF5 soon and we want to prevent unnecessary surprises. Also, openSUSE has been reported to use this even with DNF4 ([PR#1160][]). -
Mock now considers DNF5 to be a valid package manager alternative. For example considering
- that Bootstrap chroot is generated from a bootstrap image,
- expected package manager is DNF4 (
package_manager == 'dnf'
) - but the selected image has only
dnf5
installed by default
then Mock properly finds the
/bin/dnf5
command in-bootstrap, uses it to install/bin/dnf-3
into the bootstrap chroot first and then it uses/bin/dnf-3
in bootstrap for the final target buildroot installation.
Mock v5.0 bugfixes:
-
The orphan-process killing feature was enhanced to also properly kill processes started by
dnf install
post-scriptles (installing from bootstrap to buildroot), see issue#1165. -
The
podman pull
logic that Mock does in the background with--use-bootstrap-image
(now by default) was fixed to not affect themock --shell
stdout. That was a bug, stdout is often parsed by callers. -
The fact that we use in-bootstrap package manager for installation stuff into the bootstrap chroot itself revealed that we have to do certain mountpoints earlier than we used to.
-
Make sure we properly unmount all the Mock mount internal points even though the Mock process was interrupted using
CTRL+C
(KeyboardInterrupt
exception). This has fixed a long-term observed bug that kept things mounted longer than necessary, eventually breaking even subsequentmock --scrub
attempts. Also, the internal directory removal method has been fixed to try its job harder under certain circumstances. Relates to rhbz#2176689, rhbz#2176691, rhbz#2177680, rhbz#2181641, etc. -
Python
imp
module was removed from Python 3.12, so the code was migrated toimportlib
, issue#1140. -
Automatic SRPM downloads from the web were handling the file names specified by HTTP headers using the long-time deprecated
cgi
module. The module is being dropped from Python v3.13 so Mock 5.0 has been fixed to useemail.message
library which now provides the same functionality (PR#1134). -
The default recursion limit for Python scripts is set to 1000 (for non-root users); this hasn’t been enough for Mock in some use-cases so the limit has been increased in v5.0+. For example, some utilities have directory-tree stress-tests their test suites, and for such cases a very large directory tree can cause too deep recursive calls of the
shutil.rmtree()
method. Users can newly also override the Mock’s default via theconfig_opts["recursion_limit"]
option. -
Mock newly never uses the
--allowerasing
option with thednf5 remove
command (this option has not been implemented in DNF5 and DNF5 simply fails, contrary to the old DNF4 code where it was implemented a no-op, issue#1149). -
The SSL certificate copying has been fixed once more to use our own
update_tree()
logic because thedistutils.copy_tree()
was removed from the Python stdlib, and the new stdlib alternativeshutil.copytree()
is not powerful enough for the Mock use-cases (issue#1107). -
Mock no longer dumps the long output of the
rpmbuild --help
command intobuild.log
, fixes issue#999.
mock-core-configs v39 changes:
-
Fedora 39 configuration is branched from Rawhide, as branching date is 2023-08-08.
-
The new
mock-core-configs
package is not compatible with older Mock versions, therefore the requirement was bumped tov5.0
or newer. -
Started using
bootstrap_image_ready = True
for RHEL-based configs as UBI images contain all the necessary DNF tooling by default (PR#1101). -
Disable
use_bootstrap_image
for the Mageia chroots; Mageia doesn’t provide an officially supported (and working) container images that we could set in thebootsrap_image
config option (issue#1111). -
Dropped the
config_opts['useradd']
option from all the configs; theuseradd
utility from now on always executed on the host (not in chroot) with the--prefix <chrootRoot>
options (issue#1102). -
Using
$releasever
in openEuler metalink URLs. -
Several configuration files were updated to work correctly with the new
use_bootstrap_image = True
in Mock 5.0. Relates to issue#1171
Following contributors contributed to this release:
- Miro Hrončok
- Miroslav Suchý
- Neal Gompa
- zengwei2000
- zengchen1024
Thank you.