From 788dddc693ca56ac439ef5f5cbb36558ae4bbf98 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 16 Feb 2024 08:12:49 +0100 Subject: [PATCH] Avoid Traceback for resultdir ENOSPC Resolves: rhbz#2261758 --- mock/py/mockbuild/backend.py | 9 ++++++--- releng/release-notes-next/rhbz-2254328.bugfix | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 releng/release-notes-next/rhbz-2254328.bugfix diff --git a/mock/py/mockbuild/backend.py b/mock/py/mockbuild/backend.py index 9eaf871fb..94d436a56 100644 --- a/mock/py/mockbuild/backend.py +++ b/mock/py/mockbuild/backend.py @@ -820,9 +820,12 @@ def get_command(mode, checkdeps=False): def copy_build_results(self, results): self.buildroot.root_log.debug("Copying packages to result dir") ret = [] - for item in results: - shutil.copy2(item, self.buildroot.resultdir) - ret.append(os.path.join(self.buildroot.resultdir, os.path.split(item)[1])) + try: + for item in results: + shutil.copy2(item, self.buildroot.resultdir) + ret.append(os.path.join(self.buildroot.resultdir, os.path.split(item)[1])) + except OSError as err: + raise Error(f"Can not copy {item} into resultdir {self.buildroot.resultdir}: {err}") from err return ret @traceLog() diff --git a/releng/release-notes-next/rhbz-2254328.bugfix b/releng/release-notes-next/rhbz-2254328.bugfix new file mode 100644 index 000000000..4dbd48d73 --- /dev/null +++ b/releng/release-notes-next/rhbz-2254328.bugfix @@ -0,0 +1,3 @@ +No more ugly tracebacks for "no space left on device" (and similar +`OSError`s) related to copying built artifacts to `--resultdir`, +[rhbz#2261758][].