commit:     61a50a816a3327cd95d7e617974f7abaf750e8ec
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  7 19:18:53 2026 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan  7 20:15:50 2026 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=61a50a81

Auto-add sandbox control file for jobserver

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/base/stagebase.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index cbf78d28..882731a0 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -501,6 +501,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
         self.settings['cleanables'] = [
             "/etc/machine-id",
             "/etc/resolv.conf",
+            "/etc/sandbox.d/99catalyst",
             "/var/tmp/*",
             "/tmp/*",
         ]
@@ -1179,6 +1180,20 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
         self.resume.enable("chroot_setup")
 
+        # ensure that code running in the chroot can access the jobserver
+        if "jobserver-fifo" in self.settings:
+            sandbox_fifo = normpath(self.settings["chroot_path"] + 
"/etc/sandbox.d/99catalyst")
+            Path(sandbox_fifo).parent.mkdir(mode=0o755, parents=True, 
exist_ok=True)
+
+            log.info('Creating sandbox config %s.', sandbox_fifo)
+
+            try:
+                with open(sandbox_fifo, 'w') as f:
+                    f.write("SANDBOX_WRITE=\"%s\"" % 
self.settings["jobserver-fifo"])
+                    f.close
+            except OSError as e:
+                raise CatalystError(f'Could not write {sandbox_fifo}: {e}') 
from e
+
     def write_make_conf(self, setup=True):
         # Modify and write out make.conf (for the chroot)
         makepath = normpath(self.settings["chroot_path"] +

Reply via email to