Skip to content

Commit

Permalink
rpmbuild: don't clean after builds with user ssh access
Browse files Browse the repository at this point in the history
Fix #3181
  • Loading branch information
FrostyX committed Mar 12, 2024
1 parent a22af0a commit 98c5c70
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rpmbuild/copr_rpmbuild/builders/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 98c5c70

Please sign in to comment.