From f32e0cf000825167c0cfb186b88891b6576bf034 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 19 Sep 2024 13:45:57 +0200 Subject: [PATCH] The --scrub= and --clean affects bootstrap, too Relates: #1289 --- mock/py/mockbuild/backend.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mock/py/mockbuild/backend.py b/mock/py/mockbuild/backend.py index 9649529d3..dc940f54a 100644 --- a/mock/py/mockbuild/backend.py +++ b/mock/py/mockbuild/backend.py @@ -41,7 +41,6 @@ def __init__(self, config, uid_manager, plugins, state, buildroot, bootstrap_bui self.external = ExternalDeps(buildroot, bootstrap_buildroot, uid_manager) self.rpmbuild_arch = config['rpmbuild_arch'] - self.clean_the_chroot = config['clean'] self.build_results = [] @@ -91,6 +90,8 @@ def clean(self): self.backup_results() self.state.start("clean chroot") self.buildroot.delete() + if self.bootstrap_buildroot is not None: + self.bootstrap_buildroot.delete() self.state.finish("clean chroot") @traceLog() @@ -120,6 +121,8 @@ def scrub(self, scrub_opts): elif scrub == 'chroot': self.buildroot.root_log.info("scrubbing chroot for %s", self.config_name) self.buildroot.delete() + if self.bootstrap_buildroot is not None: + self.bootstrap_buildroot.delete() elif scrub == 'cache': self.buildroot.root_log.info("scrubbing cache for %s", self.config_name) file_util.rmtree(self.buildroot.cachedir, selinux=self.buildroot.selinux) @@ -131,6 +134,11 @@ def scrub(self, scrub_opts): self.buildroot.root_log.info("scrubbing root-cache for %s", self.config_name) file_util.rmtree(os.path.join(self.buildroot.cachedir, 'root_cache'), selinux=self.buildroot.selinux) + if self.bootstrap_buildroot is not None: + file_util.rmtree(os.path.join(self.bootstrap_buildroot.cachedir, + 'root_cache'), + selinux=self.buildroot.selinux) + elif scrub in ['yum-cache', 'dnf-cache']: self.buildroot.root_log.info("scrubbing yum-cache and dnf-cache for %s", self.config_name) file_util.rmtree(os.path.join(self.buildroot.cachedir, 'yum_cache'),