commit:     655acfcf822fd83affaa32c2bc8a4a3188850d54
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 20:27:45 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 20:27:45 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=655acfcf

targets: Mount repos also under $ROOT for stage1 builds

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

 catalyst/targets/stage1.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 0ea5f92b..42931749 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -4,10 +4,11 @@ stage1 target
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
 from catalyst import log
-from catalyst.support import normpath
+from catalyst.support import (normpath, get_repo_name)
 from catalyst.fileops import move_path
 from catalyst.base.stagebase import StageBase
 
+from pathlib import Path
 
 class stage1(StageBase):
     """
@@ -22,6 +23,18 @@ class stage1(StageBase):
 
     def __init__(self, spec, addlargs):
         StageBase.__init__(self, spec, addlargs)
+        # In the stage1 build we need to make sure that the ebuild 
repositories are
+        # accessible within $ROOT too... otherwise relative symlinks may point 
nowhere
+        # and, e.g., portageq may malfunction due to missing profile.
+        # Create a second bind mount entry for each repository
+        for path, name, _ in self.repos:
+            name = get_repo_name(path)
+            mount_id = f'root_repo_{name}'
+            self.mount[mount_id] = {
+                'enable': True,
+                'source': path,
+                'target': Path(normpath("/tmp/stage1root") + "/" + 
str(self.get_repo_location(name)))
+            }
 
     def set_root_path(self):
         # sets the root path, relative to 'chroot_path', of the stage1 root

Reply via email to