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)