Released on 2023-08-09.
Mock v5.0 new features:
-
The
use_bootstrap_imagefeature 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_imagecontents). For the RHEL based chroots (where UBIbootstrap_imageis in use, and wherepython3-dnf-plugins-coreis installed by default) we also turned on thebootstrap_image_ready=Truewhich drastically speeds the bootstrap preparation. See the explanation forbootstrap_image_readybelow. See PR#1101 for more info. -
Start using
useraddanduserdelutilities from the host to modify in-chrootetc/passwdandetc/group. This allowed us to remove theshadow-utilspackage 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/fusedevice 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|Falsewas invented. When set toTrue, Mock doesn’t try to do any package manager actions inside bootstrap (normally Mock installsdnftooling there). It simply assumes that the bootstrap image is ready to use (that thednftooling 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 RPMfeature), 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_imageeven 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.logfile. 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 = Falseglobal variable in such a plugin, see PR#1116 for more info. The pluginhw_infohas been newly disabled this way. -
The bootstrap chroot installation was made smaller; newly only the
python3-dnfandpython3-dnf-plugins-coreare installed, instead ofdnfanddnf-plugins-core(which used to install also unnecessary documentation files). -
Automatic file downloads (for example with
mock https://exmaple.com/src.rpmuse cases) have been changed to automatically retry the download several times to work around random network failures (PR#1132 and PR#1134). -
The
dnfanddnf5processes are newly always executed with the--setopt=allow_vendor_change=yesoption. 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 --chaine.g.) while mimicking the distro-defaultVendortag would be a painful task. The thing is that theallow_vendor_change=nois 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
dnf5installed by default
then Mock properly finds the
/bin/dnf5command in-bootstrap, uses it to install/bin/dnf-3into the bootstrap chroot first and then it uses/bin/dnf-3in 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 installpost-scriptles (installing from bootstrap to buildroot), see issue#1165. -
The
podman pulllogic that Mock does in the background with--use-bootstrap-image(now by default) was fixed to not affect themock --shellstdout. 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(KeyboardInterruptexception). This has fixed a long-term observed bug that kept things mounted longer than necessary, eventually breaking even subsequentmock --scrubattempts. 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
impmodule 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
cgimodule. The module is being dropped from Python v3.13 so Mock 5.0 has been fixed to useemail.messagelibrary 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
--allowerasingoption with thednf5 removecommand (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 --helpcommand 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-configspackage is not compatible with older Mock versions, therefore the requirement was bumped tov5.0or newer. -
Started using
bootstrap_image_ready = Truefor RHEL-based configs as UBI images contain all the necessary DNF tooling by default (PR#1101). -
Disable
use_bootstrap_imagefor the Mageia chroots; Mageia doesn’t provide an officially supported (and working) container images that we could set in thebootsrap_imageconfig option (issue#1111). -
Dropped the
config_opts['useradd']option from all the configs; theuseraddutility from now on always executed on the host (not in chroot) with the--prefix <chrootRoot>options (issue#1102). -
Using
$releaseverin openEuler metalink URLs. -
Several configuration files were updated to work correctly with the new
use_bootstrap_image = Truein Mock 5.0. Relates to issue#1171
Following contributors contributed to this release:
- Miro Hrončok
- Miroslav Suchý
- Neal Gompa
- zengwei2000
- zengchen1024
Thank you.