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 3316B138359 for ; Fri, 30 Oct 2020 22:41:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 84DFFE0839; Fri, 30 Oct 2020 22:41:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 6BB06E0831 for ; Fri, 30 Oct 2020 22:41:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 5C69133BF21 for ; Fri, 30 Oct 2020 22:41:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AC4DD42B for ; Fri, 30 Oct 2020 22:41:06 +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: <1604097652.d9010dead74470b2be148412e5b9ed9cca7a8b45.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: d9010dead74470b2be148412e5b9ed9cca7a8b45 X-VCS-Branch: master Date: Fri, 30 Oct 2020 22:41:06 +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: e8e3d810-713f-404e-9cad-3786eb9520a4 X-Archives-Hash: 34c15d52258784cc82b4c67988f6c232 Message-ID: <20201030224106.blAOEwMW05x-2dGjIrLT896OQCYMs_FKaCgWXQFHFUc@z> commit: d9010dead74470b2be148412e5b9ed9cca7a8b45 Author: Matt Turner gentoo org> AuthorDate: Thu Oct 29 13:03:33 2020 +0000 Commit: Matt Turner gentoo 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 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):