From 98c5c7024621f146efabde41c85c5b8a4d2e344a Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Tue, 12 Mar 2024 15:00:20 +0100 Subject: [PATCH] rpmbuild: don't clean after builds with user ssh access Fix #3181 --- rpmbuild/copr_rpmbuild/builders/mock.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rpmbuild/copr_rpmbuild/builders/mock.py b/rpmbuild/copr_rpmbuild/builders/mock.py index eb90d280a..b3cc31461 100644 --- a/rpmbuild/copr_rpmbuild/builders/mock.py +++ b/rpmbuild/copr_rpmbuild/builders/mock.py @@ -41,6 +41,7 @@ def __init__(self, task, sourcedir, resultdir, config): self.isolation = task.get("isolation") self.macros = macros_for_task(task, config) self.uniqueext = get_mock_uniqueext() + self.allow_user_ssh = task.get("allow_user_ssh") def run(self): open(self.logfile, 'w').close() # truncate logfile @@ -113,6 +114,9 @@ def produce_srpm(self, spec, sources, resultdir): def mock_clean(self): """ Do a best effort Mock cleanup. """ + if self.allow_user_ssh: + return + cmd = MOCK_CALL + [ "-r", self.mock_config_file, "--uniqueext", self.uniqueext, @@ -175,6 +179,12 @@ def produce_rpm(self, spec, sources, resultdir): for without_opt in self.without_opts: cmd += ["--without", without_opt] + # This is safe because builds that allow user SSH access are run in + # a separate sandbox which is not shared with any other build (not even + # from the same user) + if self.allow_user_ssh: + cmd += ["--no-cleanup-after"] + process = GentlyTimeoutedPopen(cmd, stdin=subprocess.PIPE, timeout=self.timeout)