From: "Matt Turner" <mattst88@gentoo.org> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/ Date: Sat, 19 Dec 2020 19:56:01 +0000 (UTC) [thread overview] Message-ID: <1604097652.d9010dead74470b2be148412e5b9ed9cca7a8b45.mattst88@gentoo> (raw) commit: d9010dead74470b2be148412e5b9ed9cca7a8b45 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> AuthorDate: Thu Oct 29 13:03:33 2020 +0000 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> CommitDate: Fri Oct 30 22:40:52 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d9010dea catalyst: Factor out run_sequence() This is preparation for the next patch, which will run the build sequence in a separate mount namespace. Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> catalyst/base/stagebase.py | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 75c84baa..06ec8727 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -1362,6 +1362,22 @@ class StageBase(TargetBase, ClearBase, GenBase): log.debug('setup_environment(); env = %r', self.env) + def run_sequence(self, sequence): + for func in sequence: + log.notice('--- Running action sequence: %s', func) + sys.stdout.flush() + try: + getattr(self, func)() + except LockInUse: + log.error('Unable to aquire the lock...') + return False + except Exception: + log.error('Exception running action sequence %s', + func, exc_info=True) + return False + + return True + def run(self): self.chroot_lock.write_lock() @@ -1386,26 +1402,16 @@ class StageBase(TargetBase, ClearBase, GenBase): log.info('StageBase: run() purge') self.purge() - failure = False - for x in self.prepare_sequence + self.build_sequence + self.finish_sequence: - log.notice('--- Running action sequence: %s', x) - sys.stdout.flush() - try: - getattr(self, x)() - except LockInUse: - log.error('Unable to aquire the lock...') - failure = True - break - except Exception: - log.error('Exception running action sequence %s', - x, exc_info=True) - failure = True - break + if not self.run_sequence(self.prepare_sequence): + return False - if failure: - log.notice('Cleaning up... Running unbind()') + if not self.run_sequence(self.build_sequence): self.unbind() return False + + if not self.run_sequence(self.finish_sequence): + return False + return True def unmerge(self):
WARNING: multiple messages have this Message-ID (diff)
From: "Matt Turner" <mattst88@gentoo.org> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Date: Fri, 30 Oct 2020 22:41:06 +0000 (UTC) [thread overview] Message-ID: <1604097652.d9010dead74470b2be148412e5b9ed9cca7a8b45.mattst88@gentoo> (raw) Message-ID: <20201030224106.blAOEwMW05x-2dGjIrLT896OQCYMs_FKaCgWXQFHFUc@z> (raw) commit: d9010dead74470b2be148412e5b9ed9cca7a8b45 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> AuthorDate: Thu Oct 29 13:03:33 2020 +0000 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> CommitDate: Fri Oct 30 22:40:52 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d9010dea catalyst: Factor out run_sequence() This is preparation for the next patch, which will run the build sequence in a separate mount namespace. Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> catalyst/base/stagebase.py | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 75c84baa..06ec8727 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -1362,6 +1362,22 @@ class StageBase(TargetBase, ClearBase, GenBase): log.debug('setup_environment(); env = %r', self.env) + def run_sequence(self, sequence): + for func in sequence: + log.notice('--- Running action sequence: %s', func) + sys.stdout.flush() + try: + getattr(self, func)() + except LockInUse: + log.error('Unable to aquire the lock...') + return False + except Exception: + log.error('Exception running action sequence %s', + func, exc_info=True) + return False + + return True + def run(self): self.chroot_lock.write_lock() @@ -1386,26 +1402,16 @@ class StageBase(TargetBase, ClearBase, GenBase): log.info('StageBase: run() purge') self.purge() - failure = False - for x in self.prepare_sequence + self.build_sequence + self.finish_sequence: - log.notice('--- Running action sequence: %s', x) - sys.stdout.flush() - try: - getattr(self, x)() - except LockInUse: - log.error('Unable to aquire the lock...') - failure = True - break - except Exception: - log.error('Exception running action sequence %s', - x, exc_info=True) - failure = True - break + if not self.run_sequence(self.prepare_sequence): + return False - if failure: - log.notice('Cleaning up... Running unbind()') + if not self.run_sequence(self.build_sequence): self.unbind() return False + + if not self.run_sequence(self.finish_sequence): + return False + return True def unmerge(self):
next reply other threads:[~2020-12-19 19:56 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-19 19:56 Matt Turner [this message] 2020-10-30 22:41 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Matt Turner -- strict thread matches above, loose matches on Subject: below -- 2023-05-11 14:47 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2022-11-28 20:38 Matt Turner 2022-11-22 21:19 [gentoo-commits] proj/catalyst:master " Matt Turner 2022-11-28 20:38 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2022-11-22 4:58 Matt Turner 2022-11-22 3:49 Matt Turner 2022-11-20 0:21 Matt Turner 2022-11-20 0:21 Matt Turner 2022-11-20 0:21 Matt Turner 2022-11-20 0:21 Matt Turner 2022-05-13 17:45 [gentoo-commits] proj/catalyst:master " Matt Turner 2022-11-20 0:21 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2022-05-13 17:45 [gentoo-commits] proj/catalyst:master " Matt Turner 2022-11-20 0:21 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2022-05-13 17:43 [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner 2022-11-20 0:21 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-06-10 0:48 Matt Turner 2021-06-10 0:48 Matt Turner 2021-06-10 0:48 Matt Turner 2021-06-10 0:48 Matt Turner 2021-03-25 3:03 [gentoo-commits] proj/catalyst:master " Matt Turner 2021-06-10 0:48 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-03-06 16:58 [gentoo-commits] proj/catalyst:master " Matt Turner 2021-06-10 0:48 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-01-28 2:41 [gentoo-commits] proj/catalyst:master " Matt Turner 2021-01-29 23:50 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-01-28 2:41 [gentoo-commits] proj/catalyst:master " Matt Turner 2021-01-29 23:50 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-01-28 2:09 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2021-01-29 23:50 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-01-18 19:53 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-12-19 19:56 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2021-01-18 3:38 Matt Turner 2020-10-30 22:41 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-12-19 19:56 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-10-24 22:07 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-10-29 21:00 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-10-24 22:07 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-10-29 21:00 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-05-20 1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-05-20 3:39 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-05-20 1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-05-20 3:39 Matt Turner 2020-05-20 2:29 Matt Turner 2020-05-20 0:26 Matt Turner 2020-05-20 0:26 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=1604097652.d9010dead74470b2be148412e5b9ed9cca7a8b45.mattst88@gentoo \ --to=mattst88@gentoo.org \ --cc=gentoo-commits@lists.gentoo.org \ --cc=gentoo-dev@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: linkBe 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