diff --git a/mock/py/mockbuild/buildroot.py b/mock/py/mockbuild/buildroot.py index fa331f66b..71f5a3392 100644 --- a/mock/py/mockbuild/buildroot.py +++ b/mock/py/mockbuild/buildroot.py @@ -877,6 +877,9 @@ def _setup_files_postinstall(self): @traceLog() def _setup_nosync(self): + if not self.config['nosync']: + return + multilib = ('x86_64', 's390x') # ld_preload need to be same as in bootstrap because we call DNF in bootstrap, but # but it will load nosync from the final chroot @@ -903,20 +906,19 @@ def resolve(path): shutil.copy2(nosync, dst) return True - if self.config['nosync']: - target_arch = self.config['target_arch'] - copied_lib = copy_nosync() - copied_lib64 = copy_nosync(lib64=True) - if not copied_lib and not copied_lib64: - self.root_log.warning("nosync is enabled but the library " - "wasn't found on the system") - return - if (target_arch in multilib and not self.config['nosync_force'] - and copied_lib != copied_lib64): - self.root_log.warning("For multilib systems, both architectures" - " of nosync library need to be installed") - return - self.nosync_path = os.path.join(tmp_libdir, 'nosync.so') + target_arch = self.config['target_arch'] + copied_lib = copy_nosync() + copied_lib64 = copy_nosync(lib64=True) + if not copied_lib and not copied_lib64: + self.root_log.warning("nosync is enabled but the library " + "wasn't found on the system") + return + if (target_arch in multilib and not self.config['nosync_force'] and + copied_lib != copied_lib64): + self.root_log.warning("For multilib systems, both architectures" + " of nosync library need to be installed") + return + self.nosync_path = os.path.join(tmp_libdir, 'nosync.so') @traceLog() def finalize(self): diff --git a/releng/release-notes-next/no-tmpdir-for-no-nosync.bugfix b/releng/release-notes-next/no-tmpdir-for-no-nosync.bugfix new file mode 100644 index 000000000..0bcf1622e --- /dev/null +++ b/releng/release-notes-next/no-tmpdir-for-no-nosync.bugfix @@ -0,0 +1,3 @@ +The `nosync` logic was preparing temporary directories even when +`config_opts["nosync"] = False` (meaning nosync was disabled). This logic has +been optimized out. Works around [issue#1351][].