public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/
Date: Wed,  9 Sep 2015 15:22:50 +0000 (UTC)	[thread overview]
Message-ID: <1441811796.a7dd0129e0f01026e29583805e0b0c1232a8e747.dolsen@gentoo> (raw)

commit:     a7dd0129e0f01026e29583805e0b0c1232a8e747
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  9 15:16:15 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Sep  9 15:16:36 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a7dd0129

Fix LockInUse return code failure

Move trapping of the lock failure from the top most build call to the run() where
it can do cleanup work before exiting.

 catalyst/base/stagebase.py | 18 +++++++++++++++---
 catalyst/main.py           | 11 +++++------
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 5eb8fc9..60acd55 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -20,7 +20,7 @@ from catalyst.support import (CatalystError, msg, file_locate, normpath,
 from catalyst.base.targetbase import TargetBase
 from catalyst.base.clearbase import ClearBase
 from catalyst.base.genbase import GenBase
-from catalyst.lock import LockDir
+from catalyst.lock import LockDir, LockInUse
 from catalyst.fileops import ensure_dirs, pjoin
 from catalyst.base.resume import AutoResume
 
@@ -1419,18 +1419,30 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			print "StageBase: run() purge"
 			self.purge()
 
+		failure = False
 		for x in self.settings["action_sequence"]:
 			print "--- Running action sequence: "+x
 			sys.stdout.flush()
 			try:
 				apply(getattr(self,x))
+			except LockInUse:
+				print "Error, unable to aquire the lock..."
+				print " Catalyst aborting...."
+				failure = True
+				break
 			except Exception as error:
 				print "Exception running action sequence %s" % x
 				print "Error:", str(error)
-				print "Running unbind()"
-				self.unbind()
+				print " Catalyst aborting...."
+				failure = True
 				break
 
+		if failure:
+			print "Cleaning up... Running unbind()"
+			self.unbind()
+			return False
+		return True
+
 
 	def unmerge(self):
 		if "autoresume" in self.settings["options"] \

diff --git a/catalyst/main.py b/catalyst/main.py
index 2a5bdd3..dfa0609 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -21,7 +21,6 @@ import catalyst.config
 import catalyst.util
 from catalyst.defaults import confdefaults, option_messages
 from catalyst.hash_utils import HashMap, HASH_DEFINITIONS
-from catalyst.lock import LockInUse
 from catalyst.support import CatalystError, find_binary
 from catalyst.version import get_version
 
@@ -164,8 +163,8 @@ def build_target(addlargs):
 			"Target \"%s\" not available." % target,
 			print_traceback=True)
 	except CatalystError:
-		return
-	target.run()
+		return False
+	return target.run()
 
 
 def main():
@@ -345,12 +344,12 @@ def main():
 
 	# everything is setup, so the build is a go
 	try:
-		build_target(addlargs)
+		success = build_target(addlargs)
 	except KeyboardInterrupt:
 		print "\nCatalyst build aborted due to user interrupt ( Ctrl-C )"
 		print
 		print "Catalyst aborting...."
 		sys.exit(2)
-	except LockInUse:
-		print "Catalyst aborting...."
+	if not success:
 		sys.exit(2)
+	sys.exit(0)


             reply	other threads:[~2015-09-09 15:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09 15:22 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-18 19:53 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/, catalyst/base/ Matt Turner
2020-11-14 16:37 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-12-19 19:56 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-11-14 16:37 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-16  6:43 Matt Turner
2020-04-22  5:52 Matt Turner
2020-04-13 20:43 Matt Turner
2020-04-10 21:04 Matt Turner
2019-10-20  0:00 Matt Turner
2015-10-11 17:26 Mike Frysinger
2015-10-09  2:40 Mike Frysinger
2015-10-09  2:40 Mike Frysinger
2015-10-06 15:31 Mike Frysinger
2015-05-21 23:53 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-05-24  0:08 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-02-26 22:18 Brian Dolbec
2015-01-01  5:59 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26  4:12 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-01-01  5:59 [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/ Brian Dolbec
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/ Brian Dolbec

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=1441811796.a7dd0129e0f01026e29583805e0b0c1232a8e747.dolsen@gentoo \
    --to=dolsen@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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox