From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2A33F138359 for ; Thu, 29 Oct 2020 15:47:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 45AD1E0835; Thu, 29 Oct 2020 15:47:41 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1C325E0835 for ; Thu, 29 Oct 2020 15:47:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 53AA7340D8E for ; Thu, 29 Oct 2020 15:47:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AB01F296 for ; Thu, 29 Oct 2020 15:47:37 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1603982938.9db9735a51152a0be92177f22ddaa9dc6ca70163.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/, catalyst/targets/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py catalyst/targets/embedded.py catalyst/targets/livecd_stage1.py catalyst/targets/livecd_stage2.py catalyst/targets/netboot.py catalyst/targets/stage1.py catalyst/targets/stage4.py X-VCS-Directories: catalyst/base/ catalyst/targets/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 9db9735a51152a0be92177f22ddaa9dc6ca70163 X-VCS-Branch: pending/mattst88 Date: Thu, 29 Oct 2020 15:47:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7940bc40-a911-4129-a0fe-809c28b73dbb X-Archives-Hash: e4797107a13e6df11bbee032ebfd787a commit: 9db9735a51152a0be92177f22ddaa9dc6ca70163 Author: Matt Turner gentoo org> AuthorDate: Thu Oct 29 00:28:24 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Thu Oct 29 14:48:58 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=9db9735a catalyst: Move action_sequence out of self.settings[] This self.settings[] dictionary is very similar to the god object anti-pattern. Moving action_sequence out it starts us down the road of fixing this. Signed-off-by: Matt Turner 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",