From: Matt Turner <mattst88@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Cc: Matt Turner <mattst88@gentoo.org>
Subject: [gentoo-catalyst] [PATCH 06/12] catalyst: Split action_sequence into prepare/build/finish
Date: Thu, 29 Oct 2020 12:16:26 -0400 [thread overview]
Message-ID: <20201029161632.146732-6-mattst88@gentoo.org> (raw)
In-Reply-To: <20201029161632.146732-1-mattst88@gentoo.org>
We want to run the "build" sequence in a different mount namespace from
the "prepare" and "finish" sequences, so this splits action_sequence
into those groupings.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 24 +++++++++++++++---------
catalyst/targets/embedded.py | 6 +++++-
catalyst/targets/livecd_stage1.py | 6 +++++-
catalyst/targets/livecd_stage2.py | 10 +++++++---
catalyst/targets/netboot.py | 6 +++++-
catalyst/targets/stage1.py | 12 ++++++------
catalyst/targets/stage4.py | 6 +++++-
7 files changed, 48 insertions(+), 22 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 46b7c59c..75c84baa 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -64,7 +64,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
"portage_overlay",
"portage_prefix",
])
- self.action_sequence = []
+ self.prepare_sequence = []
+ self.build_sequence = []
+ self.finish_sequence = []
self.set_valid_build_kernel_vars(addlargs)
TargetBase.__init__(self, myspec, addlargs)
@@ -478,36 +480,40 @@ class StageBase(TargetBase, ClearBase, GenBase):
Or it calls the normal set_action_sequence() for the target stage.
"""
if "purgeonly" in self.settings["options"]:
- self.action_sequence.append("remove_chroot")
+ self.build_sequence.append("remove_chroot")
return
self.set_action_sequence()
def set_action_sequence(self):
"""Set basic stage1, 2, 3 action sequences"""
- self.action_sequence.extend([
+ self.prepare_sequence.extend([
"unpack",
"setup_confdir",
"portage_overlay",
+ ])
+ self.build_sequence.extend([
"bind",
"chroot_setup",
"setup_environment",
"run_local",
"preclean",
"unbind",
+ ])
+ self.finish_sequence.extend([
"clean",
])
self.set_completion_action_sequences()
def set_completion_action_sequences(self):
if "fetch" not in self.settings["options"]:
- self.action_sequence.append("capture")
+ self.finish_sequence.append("capture")
if "keepwork" in self.settings["options"]:
- self.action_sequence.append("clear_autoresume")
+ self.finish_sequence.append("clear_autoresume")
elif "seedcache" in self.settings["options"]:
- self.action_sequence.append("remove_autoresume")
+ self.finish_sequence.append("remove_autoresume")
else:
- self.action_sequence.append("remove_autoresume")
- self.action_sequence.append("remove_chroot")
+ self.finish_sequence.append("remove_autoresume")
+ self.finish_sequence.append("remove_chroot")
def set_use(self):
use = self.settings["spec_prefix"] + "/use"
@@ -1381,7 +1387,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.purge()
failure = False
- for x in self.action_sequence:
+ for x in self.prepare_sequence + self.build_sequence + self.finish_sequence:
log.notice('--- Running action sequence: %s', x)
sys.stdout.flush()
try:
diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 75eb68e4..1314ce7c 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,11 +41,13 @@ class embedded(StageBase):
StageBase.__init__(self, spec, addlargs)
def set_action_sequence(self):
- self.action_sequence.extend([
+ self.prepare_sequence.extend([
"unpack",
"config_profile_link",
"setup_confdir",
"portage_overlay",
+ ])
+ self.build_sequence.extend([
"bind",
"chroot_setup",
"setup_environment",
@@ -55,6 +57,8 @@ class embedded(StageBase):
"fsscript",
"unmerge",
"unbind",
+ ])
+ self.finish_sequence.extend([
"remove",
"empty",
"clean",
diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index 9dbfa506..81367053 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,16 +23,20 @@ class livecd_stage1(StageBase):
StageBase.__init__(self, spec, addlargs)
def set_action_sequence(self):
- self.action_sequence.extend([
+ self.prepare_sequence.extend([
"unpack",
"config_profile_link",
"setup_confdir",
"portage_overlay",
+ ])
+ self.build_sequence.extend([
"bind",
"chroot_setup",
"setup_environment",
"build_packages",
"unbind",
+ ])
+ self.finish_sequence.extend([
"clean",
])
self.set_completion_action_sequences()
diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index c9b5ce08..f6c14919 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -87,11 +87,13 @@ class livecd_stage2(StageBase):
print_traceback=True)
def set_action_sequence(self):
- self.action_sequence.extend([
+ self.prepare_sequence.extend([
"unpack",
"config_profile_link",
"setup_confdir",
"portage_overlay",
+ ])
+ self.build_sequence.extend([
"bind",
"chroot_setup",
"setup_environment",
@@ -99,7 +101,7 @@ class livecd_stage2(StageBase):
"build_kernel"
])
if "fetch" not in self.settings["options"]:
- self.action_sequence.extend([
+ self.build_sequence.extend([
"bootloader",
"preclean",
"livecd_update",
@@ -108,6 +110,8 @@ class livecd_stage2(StageBase):
"rcupdate",
"unmerge",
"unbind",
+ ])
+ self.finish_sequence.extend([
"remove",
"empty",
"clean",
@@ -115,4 +119,4 @@ class livecd_stage2(StageBase):
"setup_overlay",
"create_iso",
])
- self.action_sequence.append("clear_autoresume")
+ self.finish_sequence.append("clear_autoresume")
diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index e5c6d43c..9a0a4156 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -160,11 +160,13 @@ class netboot(StageBase):
self.resume.enable("empty")
def set_action_sequence(self):
- self.action_sequence.extend([
+ self.prepare_sequence.extend([
"unpack",
"config_profile_link",
"setup_confdir",
"portage_overlay",
+ ])
+ self.build_sequence.extend([
"bind",
"chroot_setup",
"setup_environment",
@@ -177,6 +179,8 @@ class netboot(StageBase):
"remove",
"empty",
"unbind",
+ ])
+ self.finish_sequence.extend([
"clean",
"clear_autoresume",
])
diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 89b30fe1..be3eae93 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -87,15 +87,15 @@ class stage1(StageBase):
chroot for re-use in stage2 without the need to unpack it.
'''
if "fetch" not in self.settings["options"]:
- self.action_sequence.append("capture")
+ self.finish_sequence.append("capture")
if "keepwork" in self.settings["options"]:
- self.action_sequence.append("clear_autoresume")
+ self.finish_sequence.append("clear_autoresume")
elif "seedcache" in self.settings["options"]:
- self.action_sequence.append("remove_autoresume")
- self.action_sequence.append("clean_stage1")
+ self.finish_sequence.append("remove_autoresume")
+ self.finish_sequence.append("clean_stage1")
else:
- self.action_sequence.append("remove_autoresume")
- self.action_sequence.append("remove_chroot")
+ self.finish_sequence.append("remove_autoresume")
+ self.finish_sequence.append("remove_chroot")
def clean_stage1(self):
'''seedcache is enabled, so salvage the /tmp/stage1root,
diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index bb20be79..78a5c780 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,11 +39,13 @@ class stage4(StageBase):
self.settings["cleanables"].remove('/etc/resolv.conf')
def set_action_sequence(self):
- self.action_sequence.extend([
+ self.prepare_sequence.extend([
"unpack",
"config_profile_link",
"setup_confdir",
"portage_overlay",
+ ])
+ self.build_sequence.extend([
"bind",
"chroot_setup",
"setup_environment",
@@ -56,6 +58,8 @@ class stage4(StageBase):
"rcupdate",
"unmerge",
"unbind",
+ ])
+ self.finish_sequence.extend([
"remove",
"empty",
"clean",
--
2.26.2
next prev parent reply other threads:[~2020-10-29 16:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 16:16 [gentoo-catalyst] [PATCH 01/12] catalyst: Replace pathcompare() Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 02/12] catalyst: Rewrite ismount() to use libmount Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 03/12] catalyst: Use libmount for handling mounts Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 04/12] catalyst: Move action_sequence out of self.settings[] Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 05/12] catalyst: Use .extend() and .append() for action_sequence Matt Turner
2020-10-29 16:16 ` Matt Turner [this message]
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 07/12] catalyst: Factor out run_sequence() Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 08/12] catalyst: Add and use namespace context manager Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 09/12] catalyst: Run the build sequence in new mount namespace Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 10/12] catalyst: Remove kill_support_pids() Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 11/12] catalyst: Remove mount_safety_check() Matt Turner
2020-10-29 16:16 ` [gentoo-catalyst] [PATCH 12/12] catalyst: Drop unbind() Matt Turner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029161632.146732-6-mattst88@gentoo.org \
--to=mattst88@gentoo.org \
--cc=gentoo-catalyst@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox