Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:dilfridge-containers commit in: catalyst/base/, containers/config/
Date: Fri, 24 Dec 2021 23:56:38
Message-Id: 1640390179.e28156df62eb77b89822e88eba9099a5b1ce229a.dilfridge@gentoo
1 commit: e28156df62eb77b89822e88eba9099a5b1ce229a
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 24 23:53:51 2021 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 24 23:56:19 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e28156df
7
8 Add some markers in the code for myself
9
10 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
11
12 catalyst/base/stagebase.py | 17 +++++++++++++++++
13 containers/config/chroot.toml | 3 ++-
14 2 files changed, 19 insertions(+), 1 deletion(-)
15
16 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
17 index 4a1b4eb6..a1042182 100644
18 --- a/catalyst/base/stagebase.py
19 +++ b/catalyst/base/stagebase.py
20 @@ -67,6 +67,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
21 "cflags",
22 "common_flags",
23 "compression_mode",
24 + "container",
25 "cxxflags",
26 "decompressor_search_order",
27 "fcflags",
28 @@ -87,6 +88,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
29 self.setup_confdir,
30 self.process_repos,
31 ]
32 +
33 + # CO-MARK
34 + # we need to make self.bind configurable here
35 self.build_sequence = [
36 self.bind,
37 self.chroot_setup,
38 @@ -139,6 +143,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
39 else:
40 raise CatalystError("Unknown host machine type " + host)
41
42 + ## CO-MARK
43 if setarch.get('if_build', '') == platform.machine():
44 chroot = f'setarch {setarch["arch"]} chroot'
45 else:
46 @@ -468,6 +473,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
47 "/tmp/*",
48 ]
49
50 + # CO-MARK
51 def set_chroot_path(self):
52 """
53 NOTE: the trailing slash has been removed
54 @@ -895,6 +901,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
55 env=self.env)
56
57 def bind(self):
58 + # CO-MARK
59 + # we need to be able to disable this step completely (e.g. bubblewrap, qemu-system)
60 + #
61 for x in [x for x in self.mount if self.mount[x]['enable']]:
62 if str(self.mount[x]['source']) == 'config':
63 raise CatalystError(f'"{x}" bind mount source is not configured')
64 @@ -1012,6 +1021,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
65 raise CatalystError('Could not write %s: %s' % (
66 normpath(self.settings["chroot_path"] +
67 self.settings["make_conf"]), e)) from e
68 +
69 + # CO-MARK
70 + # here we need to copy in additional required files
71 +
72 self.resume.enable("chroot_setup")
73
74 def write_make_conf(self, setup=True):
75 @@ -1165,6 +1178,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
76 log.notice("Clearing portage_prefix target: %s", target)
77 clear_path(target)
78
79 + # CO-MARK
80 + # clean up here additional support files (e.g. /linuxrc)
81 +
82 # Remove hacks that should *never* go into stages
83 target = pjoin(self.settings["stage_path"], "etc/portage/patches")
84 if os.path.exists(target):
85 @@ -1353,6 +1369,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
86 chroot = command('chroot')
87 bash = command('bash')
88
89 + # CO-MARK
90 log.notice("Entering chroot")
91 try:
92 cmd([chroot, self.settings['chroot_path'], bash, '-l'],
93
94 diff --git a/containers/config/chroot.toml b/containers/config/chroot.toml
95 index a766069c..b53d0648 100644
96 --- a/containers/config/chroot.toml
97 +++ b/containers/config/chroot.toml
98 @@ -10,12 +10,13 @@ setup_mounts = true
99 # does catalyst have to provide process isolation (i.e. unshare)?
100 # setup_namespaces = false
101
102 -
103 # do we need to copy files *beyond* the stage definition specific
104 # ones into the isolated filesystem (e.g. /linuxrc)?
105 # support_files =
106
107 # do we need to convert the filesystem into an image file and back?
108 +# note that making catalyst work with an image-based container /
109 +# emulator will be very, very hard
110 setup_image = false
111
112 # image pack and unpack commands, if setup_image = true