Skip to content

Commit

Permalink
Do not create temporary Buildroot.tmpdir for disabled nosync
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Apr 23, 2024
1 parent 96dd10f commit d44864e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
30 changes: 16 additions & 14 deletions mock/py/mockbuild/buildroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions releng/release-notes-next/no-tmpdir-for-no-nosync.bugfix
Original file line number Diff line number Diff line change
@@ -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][].

0 comments on commit d44864e

Please sign in to comment.