aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2024-08-03 12:52:38 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-08-03 12:52:38 +0200
commitd4903c231ad2b338e1cb2e2ef9d8585b68e737df (patch)
treee4512cbca7b102b07adbeb8cea3e2036634f033d
parentstage1: make sure we bind-mount within the chroot dir, try 3, now with pathlib (diff)
downloadcatalyst-d4903c231ad2b338e1cb2e2ef9d8585b68e737df.tar.gz
catalyst-d4903c231ad2b338e1cb2e2ef9d8585b68e737df.tar.bz2
catalyst-d4903c231ad2b338e1cb2e2ef9d8585b68e737df.zip
stagebase: Move ROOT repo bind mount logic to stagebase instead of stage1
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r--catalyst/base/stagebase.py21
-rw-r--r--catalyst/targets/stage1.py21
2 files changed, 20 insertions, 22 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 2975236e..a23b1d90 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -223,13 +223,32 @@ class StageBase(TargetBase, ClearBase, GenBase):
for path, name, _ in self.repos:
name = get_repo_name(path)
mount_id = f'repo_{name}'
+ root_mount_id = f'root_repo_{name}'
+ repo_loc = self.get_repo_location(name)
self.mount[mount_id] = {
'enable': True,
'source': path,
- 'target': self.get_repo_location(name)
+ 'target': repo_loc
}
+ # In e.g. 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.
+ # In the meantime we specifically fixed make.profile to point outside ROOT, so
+ # this may not be necessary at the moment anymore. Having it can prevent future
+ # surprises though.
+ # Create a second, bind mount entry for each repository. We need to
+ # take as source not the original source but the original target, since
+ # otherwise we may end up trying to mount the same squashfs twice instead
+ # of a bind mount
+ if self.settings['root_path'] != "/":
+ self.mount[root_mount_id] = {
+ 'enable': True,
+ 'source': self.settings['chroot_path'] / repo_loc.relative_to('/'),
+ 'target': self.settings['root_path'] / repo_loc.relative_to('/')
+ }
+
self.mount['distdir']['source'] = self.settings['distdir']
self.mount["distdir"]['target'] = self.settings['target_distdir']
diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index ae27cd0a..66f21a9c 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -23,27 +23,6 @@ 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. We need to
- # * take as source not the original source but the original target, since
- # otherwise we may end up trying to mount the same squashfs twice instead
- # of a bind mount
- # * take the directory inside the chroot as source, not the host directory
- # In the meantime we fixed make.profile to point outside ROOT, so this may not
- # be necessary at the moment anymore. Having it can prevent future surprises
- # though.
- self.set_chroot_path()
- for path, name, _ in self.repos:
- name = get_repo_name(path)
- mount_id = f'root_repo_{name}'
- repo_loc = self.get_repo_location(name)
- self.mount[mount_id] = {
- 'enable': True,
- 'source': self.settings['chroot_path'] / repo_loc.relative_to('/'),
- 'target': normpath("/tmp/stage1root") / repo_loc.relative_to('/')
- }
def set_root_path(self):
# sets the root path, relative to 'chroot_path', of the stage1 root