public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29  3:33 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29  3:33 UTC (permalink / raw
  To: gentoo-commits

commit:     d6e7a23bf366eab5c86a3f867bdd7a55325a41fa
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 29 00:28:24 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 00:28:24 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d6e7a23b

catalyst: Move action_sequence out of self.settings[]

This self.settings[] dictionary is very similar to the god object
anti-pattern.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 17 +++++++++--------
 catalyst/targets/embedded.py      |  2 +-
 catalyst/targets/livecd_stage1.py |  2 +-
 catalyst/targets/livecd_stage2.py |  6 +++---
 catalyst/targets/netboot.py       |  2 +-
 catalyst/targets/stage1.py        | 12 ++++++------
 catalyst/targets/stage4.py        |  2 +-
 7 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index e71ce344..19c248e3 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -63,6 +63,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "portage_overlay",
             "portage_prefix",
         ])
+        self.action_sequence = []
 
         self.set_valid_build_kernel_vars(addlargs)
         TargetBase.__init__(self, myspec, addlargs)
@@ -476,13 +477,13 @@ class StageBase(TargetBase, ClearBase, GenBase):
         Or it calls the normal set_action_sequence() for the target stage.
         """
         if "purgeonly" in self.settings["options"]:
-            self.settings["action_sequence"] = ["remove_chroot"]
+            self.action_sequence = ["remove_chroot"]
             return
         self.set_action_sequence()
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
-        self.settings['action_sequence'] = [
+        self.action_sequence = [
             "unpack",
             "setup_confdir",
             "portage_overlay",
@@ -498,14 +499,14 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
     def set_completion_action_sequences(self):
         if "fetch" not in self.settings["options"]:
-            self.settings["action_sequence"].append("capture")
+            self.action_sequence.append("capture")
         if "keepwork" in self.settings["options"]:
-            self.settings["action_sequence"].append("clear_autoresume")
+            self.action_sequence.append("clear_autoresume")
         elif "seedcache" in self.settings["options"]:
-            self.settings["action_sequence"].append("remove_autoresume")
+            self.action_sequence.append("remove_autoresume")
         else:
-            self.settings["action_sequence"].append("remove_autoresume")
-            self.settings["action_sequence"].append("remove_chroot")
+            self.action_sequence.append("remove_autoresume")
+            self.action_sequence.append("remove_chroot")
 
     def set_use(self):
         use = self.settings["spec_prefix"] + "/use"
@@ -1367,7 +1368,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
             self.purge()
 
         failure = False
-        for x in self.settings["action_sequence"]:
+        for x in self.action_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 99739512..3899cf1b 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,7 +41,7 @@ class embedded(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.settings['action_sequence'] = [
+        self.action_sequence = [
             "unpack",
             "config_profile_link",
             "setup_confdir",

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index f0b6be8b..b8c26cb1 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,7 +23,7 @@ class livecd_stage1(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.settings['action_sequence'] = [
+        self.action_sequence = [
             "unpack",
             "config_profile_link",
             "setup_confdir",

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 88c0d95c..cac16b6e 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -87,7 +87,7 @@ class livecd_stage2(StageBase):
                                     print_traceback=True)
 
     def set_action_sequence(self):
-        self.settings['action_sequence'] = [
+        self.action_sequence = [
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -99,7 +99,7 @@ class livecd_stage2(StageBase):
             "build_kernel"
         ]
         if "fetch" not in self.settings["options"]:
-            self.settings['action_sequence'] += [
+            self.action_sequence += [
                 "bootloader",
                 "preclean",
                 "livecd_update",
@@ -115,4 +115,4 @@ class livecd_stage2(StageBase):
                 "setup_overlay",
                 "create_iso",
             ]
-        self.settings["action_sequence"].append("clear_autoresume")
+        self.action_sequence.append("clear_autoresume")

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 5620e0d3..61583f0d 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -160,7 +160,7 @@ class netboot(StageBase):
         self.resume.enable("empty")
 
     def set_action_sequence(self):
-        self.settings['action_sequence'] = [
+        self.action_sequence = [
             "unpack",
             "config_profile_link",
             "setup_confdir",

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 2c09a41f..89b30fe1 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.settings["action_sequence"].append("capture")
+            self.action_sequence.append("capture")
         if "keepwork" in self.settings["options"]:
-            self.settings["action_sequence"].append("clear_autoresume")
+            self.action_sequence.append("clear_autoresume")
         elif "seedcache" in self.settings["options"]:
-            self.settings["action_sequence"].append("remove_autoresume")
-            self.settings["action_sequence"].append("clean_stage1")
+            self.action_sequence.append("remove_autoresume")
+            self.action_sequence.append("clean_stage1")
         else:
-            self.settings["action_sequence"].append("remove_autoresume")
-            self.settings["action_sequence"].append("remove_chroot")
+            self.action_sequence.append("remove_autoresume")
+            self.action_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 346c0845..eef24a73 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,7 +39,7 @@ class stage4(StageBase):
         self.settings["cleanables"].remove('/etc/resolv.conf')
 
     def set_action_sequence(self):
-        self.settings['action_sequence'] = [
+        self.action_sequence = [
             "unpack",
             "config_profile_link",
             "setup_confdir",


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29 15:47 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29 15:47 UTC (permalink / raw
  To: gentoo-commits

commit:     fc30c03cbcd113efc6e32aa4539ec9a859a4dc50
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 22 20:37:54 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 15:46:16 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=fc30c03c

catalyst: Drop unbind()

mount_namespaces(7) says

	A mount ceases to be a member of a peer group when either the
	mount is explicitly unmounted, or when the mount is implicitly
	unmounted because a mount namespace is removed (because it has
	no more member processes).

As a result, we can rely on exiting the mount namespace to unmount the
bind mounts.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 45 +--------------------------------------
 catalyst/targets/embedded.py      |  1 -
 catalyst/targets/livecd_stage1.py |  1 -
 catalyst/targets/livecd_stage2.py |  2 --
 catalyst/targets/netboot.py       |  3 ---
 catalyst/targets/stage4.py        |  1 -
 6 files changed, 1 insertion(+), 52 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index e9cf04c6..4ed1d240 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -498,7 +498,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "setup_environment",
             "run_local",
             "preclean",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "clean",
@@ -853,40 +852,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                        fstype=fstype, options=options)
                 cxt.mount()
             except OSError as e:
-                self.unbind()
                 raise CatalystError(f"Counldn't mount: {source}, {e.strerror}")
 
-    def unbind(self):
-        chroot_path = self.settings["chroot_path"]
-        umount_failed = False
-
-        # Unmount in reverse order
-        for target in [Path(chroot_path + self.mount[x]['target'])
-                       for x in reversed(self.mount)
-                       if self.mount[x]['enable']]:
-            if not target.exists():
-                log.debug('%s does not exist. Skipping', target)
-                continue
-
-            if not ismount(target):
-                log.debug('%s is not a mount point. Skipping', target)
-                continue
-
-            try:
-                cxt = libmount.Context(target=str(target))
-                cxt.umount()
-            except OSError as e:
-                log.warning("Couldn't umount: %s, %s", target,
-                            e.strerror)
-                umount_failed = True
-
-        if umount_failed:
-            # if any bind mounts really failed, then we need to raise
-            # this to potentially prevent an upcoming bash stage cleanup script
-            # from wiping our bind mounts.
-            raise CatalystError(
-                "Couldn't umount one or more bind-mounts; aborting for safety.")
-
     def chroot_setup(self):
         self.makeconf = read_makeconf(normpath(self.settings["chroot_path"] +
                                                self.settings["make_conf"]))
@@ -1190,7 +1157,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                         env=self.env)
                     self.resume.enable("remove")
             except:
-                self.unbind()
                 raise
 
     def preclean(self):
@@ -1206,7 +1172,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 self.resume.enable("preclean")
 
         except:
-            self.unbind()
             raise CatalystError("Build failed, could not execute preclean")
 
     def capture(self):
@@ -1269,7 +1234,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                          self.settings['controller_file'])
 
         except CatalystError:
-            self.unbind()
             raise CatalystError("Stage build aborting due to error.",
                                 print_traceback=False)
 
@@ -1349,7 +1313,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
         with namespace(mount=True):
             if not self.run_sequence(self.build_sequence):
-                self.unbind()
                 return False
 
         if not self.run_sequence(self.finish_sequence):
@@ -1375,7 +1338,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     env=self.env)
                 log.info('unmerge shell script')
             except CatalystError:
-                self.unbind()
                 raise
             self.resume.enable("unmerge")
 
@@ -1450,7 +1412,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     fileutils.touch(build_packages_resume)
                     self.resume.enable("build_packages")
                 except CatalystError:
-                    self.unbind()
                     raise CatalystError(
                         self.settings["spec_prefix"] +
                         "build aborting due to error.")
@@ -1474,7 +1435,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     self._build_kernel(kname=kname)
                 self.resume.enable("build_kernel")
             except CatalystError:
-                self.unbind()
                 raise CatalystError(
                     "build aborting due to kernel build error.",
                     print_traceback=True)
@@ -1518,7 +1478,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
         key = 'boot/kernel/' + kname + '/config'
         if key in self.settings:
             if not os.path.exists(self.settings[key]):
-                self.unbind()
                 raise CatalystError("Can't find kernel config: %s" %
                                     self.settings[key])
 
@@ -1527,7 +1486,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                             self.settings['chroot_path'] + '/var/tmp/' + kname + '.config')
 
             except IOError:
-                self.unbind()
+                raise
 
     def _copy_initramfs_overlay(self, kname):
         key = 'boot/kernel/' + kname + '/initramfs_overlay'
@@ -1557,7 +1516,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 env=self.env)
             self.resume.enable("bootloader")
         except CatalystError:
-            self.unbind()
             raise CatalystError("Script aborting due to error.")
 
     def livecd_update(self):
@@ -1573,7 +1531,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
             self.resume.enable("livecd_update")
 
         except CatalystError:
-            self.unbind()
             raise CatalystError(
                 "build aborting due to livecd_update error.")
 

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 1314ce7c..e9138437 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -56,7 +56,6 @@ class embedded(StageBase):
             "root_overlay",
             "fsscript",
             "unmerge",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "remove",

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index 81367053..5c5e9f58 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -34,7 +34,6 @@ class livecd_stage1(StageBase):
             "chroot_setup",
             "setup_environment",
             "build_packages",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "clean",

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index f6c14919..3606047f 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -80,7 +80,6 @@ class livecd_stage2(StageBase):
                     for x in self.settings["livecd/modblacklist"]:
                         myf.write("\nblacklist "+x)
             except:
-                self.unbind()
                 raise CatalystError("Couldn't open " +
                                     self.settings["chroot_path"] +
                                     "/etc/modprobe.d/blacklist.conf.",
@@ -109,7 +108,6 @@ class livecd_stage2(StageBase):
                 "fsscript",
                 "rcupdate",
                 "unmerge",
-                "unbind",
             ])
             self.finish_sequence.extend([
                 "remove",

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 9a0a4156..55f4dff1 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -93,7 +93,6 @@ class netboot(StageBase):
                 cmd([self.settings['controller_file'], 'image'] +
                     myfiles, env=self.env)
             except CatalystError:
-                self.unbind()
                 raise CatalystError("Failed to copy files to image!",
                                     print_traceback=True)
 
@@ -121,7 +120,6 @@ class netboot(StageBase):
             cmd([self.settings['controller_file'], 'final'], env=self.env)
             log.notice('Netboot Build Finished!')
         except CatalystError:
-            self.unbind()
             raise CatalystError("Failed to move kernel images!",
                                 print_traceback=True)
 
@@ -178,7 +176,6 @@ class netboot(StageBase):
             "move_kernels",
             "remove",
             "empty",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "clean",

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 78a5c780..b7f74b01 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -57,7 +57,6 @@ class stage4(StageBase):
             "preclean",
             "rcupdate",
             "unmerge",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "remove",


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29 16:04 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29 16:04 UTC (permalink / raw
  To: gentoo-commits

commit:     34bd412bc10dd26cd03e6011c50e1cd1f3fbaf49
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 29 03:08:04 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 16:03:41 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=34bd412b

catalyst: Split action_sequence into prepare/build/finish

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 <AT> 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 5f40d3e9..e2981d58 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",


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29 16:14 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29 16:14 UTC (permalink / raw
  To: gentoo-commits

commit:     a2464bc1ab5302a7fad74ff5031cf4a1345b2ac9
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 29 00:32:34 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 16:13:47 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a2464bc1

catalyst: Use .extend() and .append() for action_sequence

Ensures that we don't overwrite and lose some settings.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 6 +++---
 catalyst/targets/embedded.py      | 4 ++--
 catalyst/targets/livecd_stage1.py | 4 ++--
 catalyst/targets/livecd_stage2.py | 8 ++++----
 catalyst/targets/netboot.py       | 4 ++--
 catalyst/targets/stage4.py        | 4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 801df2fb..46b7c59c 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -478,13 +478,13 @@ 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 = ["remove_chroot"]
+            self.action_sequence.append("remove_chroot")
             return
         self.set_action_sequence()
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "setup_confdir",
             "portage_overlay",
@@ -495,7 +495,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "preclean",
             "unbind",
             "clean",
-        ]
+        ])
         self.set_completion_action_sequences()
 
     def set_completion_action_sequences(self):

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 3899cf1b..75eb68e4 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,7 +41,7 @@ class embedded(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -60,7 +60,7 @@ class embedded(StageBase):
             "clean",
             "capture",
             "clear_autoresume",
-        ]
+        ])
 
     def set_stage_path(self):
         self.settings["stage_path"] = normpath(

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index b8c26cb1..9dbfa506 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,7 +23,7 @@ class livecd_stage1(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -34,7 +34,7 @@ class livecd_stage1(StageBase):
             "build_packages",
             "unbind",
             "clean",
-        ]
+        ])
         self.set_completion_action_sequences()
 
     def set_spec_prefix(self):

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index cac16b6e..c9b5ce08 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -87,7 +87,7 @@ class livecd_stage2(StageBase):
                                     print_traceback=True)
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -97,9 +97,9 @@ class livecd_stage2(StageBase):
             "setup_environment",
             "run_local",
             "build_kernel"
-        ]
+        ])
         if "fetch" not in self.settings["options"]:
-            self.action_sequence += [
+            self.action_sequence.extend([
                 "bootloader",
                 "preclean",
                 "livecd_update",
@@ -114,5 +114,5 @@ class livecd_stage2(StageBase):
                 "target_setup",
                 "setup_overlay",
                 "create_iso",
-            ]
+            ])
         self.action_sequence.append("clear_autoresume")

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 61583f0d..e5c6d43c 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -160,7 +160,7 @@ class netboot(StageBase):
         self.resume.enable("empty")
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -179,4 +179,4 @@ class netboot(StageBase):
             "unbind",
             "clean",
             "clear_autoresume",
-        ]
+        ])

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index eef24a73..bb20be79 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,7 +39,7 @@ class stage4(StageBase):
         self.settings["cleanables"].remove('/etc/resolv.conf')
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -59,5 +59,5 @@ class stage4(StageBase):
             "remove",
             "empty",
             "clean",
-        ]
+        ])
         self.set_completion_action_sequences()


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29 19:05 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29 19:05 UTC (permalink / raw
  To: gentoo-commits

commit:     bde364ef77d2555cc4771ae9dd4018ba89ffcefe
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 22 20:37:54 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 19:05:45 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=bde364ef

catalyst: Drop unbind()

mount_namespaces(7) says

	A mount ceases to be a member of a peer group when either the
	mount is explicitly unmounted, or when the mount is implicitly
	unmounted because a mount namespace is removed (because it has
	no more member processes).

As a result, we can rely on exiting the mount namespace to unmount the
bind mounts.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 44 +--------------------------------------
 catalyst/targets/embedded.py      |  1 -
 catalyst/targets/livecd_stage1.py |  1 -
 catalyst/targets/livecd_stage2.py |  2 --
 catalyst/targets/netboot.py       |  3 ---
 catalyst/targets/stage4.py        |  1 -
 6 files changed, 1 insertion(+), 51 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index b9c220d0..a75dbdf9 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -498,7 +498,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "setup_environment",
             "run_local",
             "preclean",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "clean",
@@ -853,40 +852,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                        fstype=fstype, options=options)
                 cxt.mount()
             except OSError as e:
-                self.unbind()
                 raise CatalystError(f"Couldn't mount: {source}, {e.strerror}")
 
-    def unbind(self):
-        chroot_path = self.settings["chroot_path"]
-        umount_failed = False
-
-        # Unmount in reverse order
-        for target in [Path(chroot_path + self.mount[x]['target'])
-                       for x in reversed(self.mount)
-                       if self.mount[x]['enable']]:
-            if not target.exists():
-                log.debug('%s does not exist. Skipping', target)
-                continue
-
-            if not ismount(target):
-                log.debug('%s is not a mount point. Skipping', target)
-                continue
-
-            try:
-                cxt = libmount.Context(target=str(target))
-                cxt.umount()
-            except OSError as e:
-                log.warning("Couldn't umount: %s, %s", target,
-                            e.strerror)
-                umount_failed = True
-
-        if umount_failed:
-            # if any bind mounts really failed, then we need to raise
-            # this to potentially prevent an upcoming bash stage cleanup script
-            # from wiping our bind mounts.
-            raise CatalystError(
-                "Couldn't umount one or more bind-mounts; aborting for safety.")
-
     def chroot_setup(self):
         self.makeconf = read_makeconf(normpath(self.settings["chroot_path"] +
                                                self.settings["make_conf"]))
@@ -1190,7 +1157,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                         env=self.env)
                     self.resume.enable("remove")
             except:
-                self.unbind()
                 raise
 
     def preclean(self):
@@ -1206,7 +1172,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 self.resume.enable("preclean")
 
         except:
-            self.unbind()
             raise CatalystError("Build failed, could not execute preclean")
 
     def capture(self):
@@ -1269,7 +1234,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                          self.settings['controller_file'])
 
         except CatalystError:
-            self.unbind()
             raise CatalystError("Stage build aborting due to error.",
                                 print_traceback=False)
 
@@ -1374,7 +1338,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     env=self.env)
                 log.info('unmerge shell script')
             except CatalystError:
-                self.unbind()
                 raise
             self.resume.enable("unmerge")
 
@@ -1449,7 +1412,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     fileutils.touch(build_packages_resume)
                     self.resume.enable("build_packages")
                 except CatalystError:
-                    self.unbind()
                     raise CatalystError(
                         self.settings["spec_prefix"] +
                         "build aborting due to error.")
@@ -1473,7 +1435,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     self._build_kernel(kname=kname)
                 self.resume.enable("build_kernel")
             except CatalystError:
-                self.unbind()
                 raise CatalystError(
                     "build aborting due to kernel build error.",
                     print_traceback=True)
@@ -1517,7 +1478,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
         key = 'boot/kernel/' + kname + '/config'
         if key in self.settings:
             if not os.path.exists(self.settings[key]):
-                self.unbind()
                 raise CatalystError("Can't find kernel config: %s" %
                                     self.settings[key])
 
@@ -1526,7 +1486,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                             self.settings['chroot_path'] + '/var/tmp/' + kname + '.config')
 
             except IOError:
-                self.unbind()
+                raise
 
     def _copy_initramfs_overlay(self, kname):
         key = 'boot/kernel/' + kname + '/initramfs_overlay'
@@ -1556,7 +1516,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 env=self.env)
             self.resume.enable("bootloader")
         except CatalystError:
-            self.unbind()
             raise CatalystError("Script aborting due to error.")
 
     def livecd_update(self):
@@ -1572,7 +1531,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
             self.resume.enable("livecd_update")
 
         except CatalystError:
-            self.unbind()
             raise CatalystError(
                 "build aborting due to livecd_update error.")
 

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 1314ce7c..e9138437 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -56,7 +56,6 @@ class embedded(StageBase):
             "root_overlay",
             "fsscript",
             "unmerge",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "remove",

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index 81367053..5c5e9f58 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -34,7 +34,6 @@ class livecd_stage1(StageBase):
             "chroot_setup",
             "setup_environment",
             "build_packages",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "clean",

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index f6c14919..3606047f 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -80,7 +80,6 @@ class livecd_stage2(StageBase):
                     for x in self.settings["livecd/modblacklist"]:
                         myf.write("\nblacklist "+x)
             except:
-                self.unbind()
                 raise CatalystError("Couldn't open " +
                                     self.settings["chroot_path"] +
                                     "/etc/modprobe.d/blacklist.conf.",
@@ -109,7 +108,6 @@ class livecd_stage2(StageBase):
                 "fsscript",
                 "rcupdate",
                 "unmerge",
-                "unbind",
             ])
             self.finish_sequence.extend([
                 "remove",

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 9a0a4156..55f4dff1 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -93,7 +93,6 @@ class netboot(StageBase):
                 cmd([self.settings['controller_file'], 'image'] +
                     myfiles, env=self.env)
             except CatalystError:
-                self.unbind()
                 raise CatalystError("Failed to copy files to image!",
                                     print_traceback=True)
 
@@ -121,7 +120,6 @@ class netboot(StageBase):
             cmd([self.settings['controller_file'], 'final'], env=self.env)
             log.notice('Netboot Build Finished!')
         except CatalystError:
-            self.unbind()
             raise CatalystError("Failed to move kernel images!",
                                 print_traceback=True)
 
@@ -178,7 +176,6 @@ class netboot(StageBase):
             "move_kernels",
             "remove",
             "empty",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "clean",

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 78a5c780..b7f74b01 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -57,7 +57,6 @@ class stage4(StageBase):
             "preclean",
             "rcupdate",
             "unmerge",
-            "unbind",
         ])
         self.finish_sequence.extend([
             "remove",


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29 19:05 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29 19:05 UTC (permalink / raw
  To: gentoo-commits

commit:     fd0271c1f3b66c8ea139468b4cef52e73a5a2107
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 29 03:08:04 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 19:05:45 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=fd0271c1

catalyst: Split action_sequence into prepare/build/finish

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 <AT> 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",


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2020-10-29 19:05 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2020-10-29 19:05 UTC (permalink / raw
  To: gentoo-commits

commit:     017d0b10da3ec6f90daf5304ec8ca12aaa97ba7f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 29 00:32:34 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 19:05:45 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=017d0b10

catalyst: Use .extend() and .append() for action_sequence

Ensures that we don't overwrite and lose some settings.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 6 +++---
 catalyst/targets/embedded.py      | 4 ++--
 catalyst/targets/livecd_stage1.py | 4 ++--
 catalyst/targets/livecd_stage2.py | 8 ++++----
 catalyst/targets/netboot.py       | 4 ++--
 catalyst/targets/stage4.py        | 4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 801df2fb..46b7c59c 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -478,13 +478,13 @@ 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 = ["remove_chroot"]
+            self.action_sequence.append("remove_chroot")
             return
         self.set_action_sequence()
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "setup_confdir",
             "portage_overlay",
@@ -495,7 +495,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "preclean",
             "unbind",
             "clean",
-        ]
+        ])
         self.set_completion_action_sequences()
 
     def set_completion_action_sequences(self):

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 3899cf1b..75eb68e4 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,7 +41,7 @@ class embedded(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -60,7 +60,7 @@ class embedded(StageBase):
             "clean",
             "capture",
             "clear_autoresume",
-        ]
+        ])
 
     def set_stage_path(self):
         self.settings["stage_path"] = normpath(

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index b8c26cb1..9dbfa506 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,7 +23,7 @@ class livecd_stage1(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -34,7 +34,7 @@ class livecd_stage1(StageBase):
             "build_packages",
             "unbind",
             "clean",
-        ]
+        ])
         self.set_completion_action_sequences()
 
     def set_spec_prefix(self):

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index cac16b6e..c9b5ce08 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -87,7 +87,7 @@ class livecd_stage2(StageBase):
                                     print_traceback=True)
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -97,9 +97,9 @@ class livecd_stage2(StageBase):
             "setup_environment",
             "run_local",
             "build_kernel"
-        ]
+        ])
         if "fetch" not in self.settings["options"]:
-            self.action_sequence += [
+            self.action_sequence.extend([
                 "bootloader",
                 "preclean",
                 "livecd_update",
@@ -114,5 +114,5 @@ class livecd_stage2(StageBase):
                 "target_setup",
                 "setup_overlay",
                 "create_iso",
-            ]
+            ])
         self.action_sequence.append("clear_autoresume")

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 61583f0d..e5c6d43c 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -160,7 +160,7 @@ class netboot(StageBase):
         self.resume.enable("empty")
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -179,4 +179,4 @@ class netboot(StageBase):
             "unbind",
             "clean",
             "clear_autoresume",
-        ]
+        ])

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index eef24a73..bb20be79 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,7 +39,7 @@ class stage4(StageBase):
         self.settings["cleanables"].remove('/etc/resolv.conf')
 
     def set_action_sequence(self):
-        self.action_sequence = [
+        self.action_sequence.extend([
             "unpack",
             "config_profile_link",
             "setup_confdir",
@@ -59,5 +59,5 @@ class stage4(StageBase):
             "remove",
             "empty",
             "clean",
-        ]
+        ])
         self.set_completion_action_sequences()


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/
  2021-01-28  1:54 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/ Matt Turner
@ 2021-01-23 16:22 ` Matt Turner
  2021-01-29 23:50 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
  1 sibling, 0 replies; 11+ messages in thread
From: Matt Turner @ 2021-01-23 16:22 UTC (permalink / raw
  To: gentoo-commits

commit:     4f0fa29d5a2499b7178dc4d19f7693e52eb8def9
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 03:15:02 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 16:19:07 2021 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4f0fa29d

catalyst: Deduplicate prepare_sequence assignments

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 13 ++++++-------
 catalyst/targets/embedded.py      |  6 ------
 catalyst/targets/livecd_stage1.py |  6 ------
 catalyst/targets/livecd_stage2.py |  6 ------
 catalyst/targets/netboot.py       |  6 ------
 catalyst/targets/stage4.py        |  6 ------
 6 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 53b0a224..3b8d3a6e 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -84,7 +84,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "portage_overlay",
             "portage_prefix",
         ])
-        self.prepare_sequence = []
+        self.prepare_sequence = [
+            self.unpack,
+            self.config_profile_link,
+            self.setup_confdir,
+            self.portage_overlay,
+        ]
         self.build_sequence = []
         self.finish_sequence = []
 
@@ -498,12 +503,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 7d328808..83b17ad2 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,12 +41,6 @@ class embedded(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index eb6bb0f0..9fe95a00 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,12 +23,6 @@ class livecd_stage1(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 5fecff85..ab8f4a0e 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -86,12 +86,6 @@ class livecd_stage2(StageBase):
                                     print_traceback=True)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 9a7e59e5..cb5e7ae4 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -158,12 +158,6 @@ class netboot(StageBase):
         self.resume.enable("empty")
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 997139a5..9e53f070 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,12 +39,6 @@ class stage4(StageBase):
         self.settings["cleanables"].remove('/etc/resolv.conf')
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2021-01-28  1:54 Matt Turner
  2021-01-23 16:22 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/ Matt Turner
  2021-01-29 23:50 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
  0 siblings, 2 replies; 11+ messages in thread
From: Matt Turner @ 2021-01-28  1:54 UTC (permalink / raw
  To: gentoo-commits

commit:     4f0fa29d5a2499b7178dc4d19f7693e52eb8def9
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 03:15:02 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 16:19:07 2021 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4f0fa29d

catalyst: Deduplicate prepare_sequence assignments

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 13 ++++++-------
 catalyst/targets/embedded.py      |  6 ------
 catalyst/targets/livecd_stage1.py |  6 ------
 catalyst/targets/livecd_stage2.py |  6 ------
 catalyst/targets/netboot.py       |  6 ------
 catalyst/targets/stage4.py        |  6 ------
 6 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 53b0a224..3b8d3a6e 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -84,7 +84,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "portage_overlay",
             "portage_prefix",
         ])
-        self.prepare_sequence = []
+        self.prepare_sequence = [
+            self.unpack,
+            self.config_profile_link,
+            self.setup_confdir,
+            self.portage_overlay,
+        ]
         self.build_sequence = []
         self.finish_sequence = []
 
@@ -498,12 +503,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 7d328808..83b17ad2 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,12 +41,6 @@ class embedded(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index eb6bb0f0..9fe95a00 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,12 +23,6 @@ class livecd_stage1(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 5fecff85..ab8f4a0e 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -86,12 +86,6 @@ class livecd_stage2(StageBase):
                                     print_traceback=True)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 9a7e59e5..cb5e7ae4 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -158,12 +158,6 @@ class netboot(StageBase):
         self.resume.enable("empty")
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 997139a5..9e53f070 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,12 +39,6 @@ class stage4(StageBase):
         self.settings["cleanables"].remove('/etc/resolv.conf')
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/
@ 2021-01-28  1:54 Matt Turner
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2021-01-28  1:54 UTC (permalink / raw
  To: gentoo-commits

commit:     27d7c7898bb0cccf6962b84058b0e2789bc314c1
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 03:20:41 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 16:19:07 2021 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=27d7c789

catalyst: Deduplicate the common build_sequence steps

This also provides a single location to add a function to all targets'
build_sequence.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 11 ++++++-----
 catalyst/targets/embedded.py      |  3 ---
 catalyst/targets/livecd_stage1.py |  3 ---
 catalyst/targets/livecd_stage2.py |  3 ---
 catalyst/targets/netboot.py       |  3 ---
 catalyst/targets/stage4.py        |  3 ---
 6 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 3b8d3a6e..40b60af3 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -90,7 +90,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
             self.setup_confdir,
             self.portage_overlay,
         ]
-        self.build_sequence = []
+        self.build_sequence = [
+            self.bind,
+            self.chroot_setup,
+            self.setup_environment,
+        ]
         self.finish_sequence = []
 
         self.set_valid_build_kernel_vars(addlargs)
@@ -497,16 +501,13 @@ class StageBase(TargetBase, ClearBase, GenBase):
         Or it calls the normal set_action_sequence() for the target stage.
         """
         if "purgeonly" in self.settings["options"]:
-            self.build_sequence.append(self.remove_chroot)
+            self.build_sequence = [self.remove_chroot]
             return
         self.set_action_sequence()
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
         self.build_sequence.extend([
-            self.bind,
-            self.chroot_setup,
-            self.setup_environment,
             self.run_local,
             self.preclean,
         ])

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 83b17ad2..b677b226 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -42,9 +42,6 @@ class embedded(StageBase):
 
     def set_action_sequence(self):
         self.build_sequence.extend([
-            self.bind,
-            self.chroot_setup,
-            self.setup_environment,
             self.build_kernel,
             self.build_packages,
             self.root_overlay,

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index 9fe95a00..dbfa54ed 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -24,9 +24,6 @@ class livecd_stage1(StageBase):
 
     def set_action_sequence(self):
         self.build_sequence.extend([
-            self.bind,
-            self.chroot_setup,
-            self.setup_environment,
             self.build_packages,
         ])
         self.finish_sequence.extend([

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index ab8f4a0e..e90e9f53 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -87,9 +87,6 @@ class livecd_stage2(StageBase):
 
     def set_action_sequence(self):
         self.build_sequence.extend([
-            self.bind,
-            self.chroot_setup,
-            self.setup_environment,
             self.run_local,
             self.build_kernel
         ])

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index cb5e7ae4..a2a9fcb3 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -159,9 +159,6 @@ class netboot(StageBase):
 
     def set_action_sequence(self):
         self.build_sequence.extend([
-            self.bind,
-            self.chroot_setup,
-            self.setup_environment,
             self.build_packages,
             self.root_overlay,
             self.copy_files_to_image,

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 9e53f070..f8383f75 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -40,9 +40,6 @@ class stage4(StageBase):
 
     def set_action_sequence(self):
         self.build_sequence.extend([
-            self.bind,
-            self.chroot_setup,
-            self.setup_environment,
             self.build_packages,
             self.build_kernel,
             self.bootloader,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, catalyst/targets/
  2021-01-28  1:54 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/ Matt Turner
  2021-01-23 16:22 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/ Matt Turner
@ 2021-01-29 23:50 ` Matt Turner
  1 sibling, 0 replies; 11+ messages in thread
From: Matt Turner @ 2021-01-29 23:50 UTC (permalink / raw
  To: gentoo-commits

commit:     4f0fa29d5a2499b7178dc4d19f7693e52eb8def9
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 03:15:02 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 16:19:07 2021 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4f0fa29d

catalyst: Deduplicate prepare_sequence assignments

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py        | 13 ++++++-------
 catalyst/targets/embedded.py      |  6 ------
 catalyst/targets/livecd_stage1.py |  6 ------
 catalyst/targets/livecd_stage2.py |  6 ------
 catalyst/targets/netboot.py       |  6 ------
 catalyst/targets/stage4.py        |  6 ------
 6 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 53b0a224..3b8d3a6e 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -84,7 +84,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
             "portage_overlay",
             "portage_prefix",
         ])
-        self.prepare_sequence = []
+        self.prepare_sequence = [
+            self.unpack,
+            self.config_profile_link,
+            self.setup_confdir,
+            self.portage_overlay,
+        ]
         self.build_sequence = []
         self.finish_sequence = []
 
@@ -498,12 +503,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
     def set_action_sequence(self):
         """Set basic stage1, 2, 3 action sequences"""
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 7d328808..83b17ad2 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -41,12 +41,6 @@ class embedded(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index eb6bb0f0..9fe95a00 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -23,12 +23,6 @@ class livecd_stage1(StageBase):
         StageBase.__init__(self, spec, addlargs)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 5fecff85..ab8f4a0e 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -86,12 +86,6 @@ class livecd_stage2(StageBase):
                                     print_traceback=True)
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 9a7e59e5..cb5e7ae4 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -158,12 +158,6 @@ class netboot(StageBase):
         self.resume.enable("empty")
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 997139a5..9e53f070 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -39,12 +39,6 @@ class stage4(StageBase):
         self.settings["cleanables"].remove('/etc/resolv.conf')
 
     def set_action_sequence(self):
-        self.prepare_sequence.extend([
-            self.unpack,
-            self.config_profile_link,
-            self.setup_confdir,
-            self.portage_overlay,
-        ])
         self.build_sequence.extend([
             self.bind,
             self.chroot_setup,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-29 23:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-28  1:54 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/ Matt Turner
2021-01-23 16:22 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/ Matt Turner
2021-01-29 23:50 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2021-01-28  1:54 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/base/ Matt Turner
2020-10-29 19:05 Matt Turner
2020-10-29 19:05 Matt Turner
2020-10-29 19:05 Matt Turner
2020-10-29 16:14 Matt Turner
2020-10-29 16:04 Matt Turner
2020-10-29 15:47 Matt Turner
2020-10-29  3:33 Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox