public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, bin/
@ 2015-09-08 14:14 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2015-09-08 14:14 UTC (permalink / raw
  To: gentoo-commits

commit:     8524792afc755906b50f276f6c3d22a00af21e0c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  8 06:15:25 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Sep  8 14:11:48 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=8524792a

Move the signal handler into the StageBase class so it can handle unbind() cleanup

Not quite complete, still errors on some unmounting

 bin/catalyst               | 19 -------------------
 catalyst/base/stagebase.py | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/bin/catalyst b/bin/catalyst
index 19f5289..5560d41 100755
--- a/bin/catalyst
+++ b/bin/catalyst
@@ -12,25 +12,6 @@ from __future__ import print_function
 
 import sys
 
-# This block ensures that ^C interrupts are handled quietly.
-try:
-	import signal
-
-	def exithandler(signum,frame):
-		signal.signal(signal.SIGINT, signal.SIG_IGN)
-		signal.signal(signal.SIGTERM, signal.SIG_IGN)
-		print()
-		sys.exit(1)
-
-	signal.signal(signal.SIGINT, exithandler)
-	signal.signal(signal.SIGTERM, exithandler)
-	signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
-except KeyboardInterrupt:
-	print()
-	sys.exit(1)
-
-
 from catalyst.main import main
 from catalyst import __maintainer__
 from catalyst import __version__

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 17d88cd..077b663 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -4,6 +4,7 @@ import string
 import imp
 import types
 import shutil
+import signal
 import sys
 from stat import ST_UID, ST_GID, ST_MODE
 
@@ -200,6 +201,17 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		if "portage_confdir" in self.settings:
 			file_locate(self.settings,["portage_confdir"],expand=0)
 
+
+		# This block ensures that ^C interrupts are handled quietly.
+		try:
+			signal.signal(signal.SIGINT, self.exithandler)
+			signal.signal(signal.SIGTERM, self.exithandler)
+			signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+		except KeyboardInterrupt:
+			print()
+			sys.exit(1)
+
 		""" Setup our mount points """
 		# initialize our target mounts.
 		self.target_mounts = TARGET_MOUNT_DEFAULTS.copy()
@@ -276,6 +288,13 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		# save resources, it is not always needed
 		self.compressor = None
 
+	def exithandler(self, signum,frame):
+		signal.signal(signal.SIGINT, signal.SIG_IGN)
+		signal.signal(signal.SIGTERM, signal.SIG_IGN)
+		self.unbind()
+		print()
+		sys.exit(1)
+
 	def override_cbuild(self):
 		if "CBUILD" in self.makeconf:
 			self.settings["CBUILD"]=self.makeconf["CBUILD"]


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

* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, bin/
@ 2015-10-06 19:54 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2015-10-06 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     2dac8da1679121bf992574d7fb5f8ed41c99c3c9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  8 06:15:25 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Oct  6 19:52:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=2dac8da1

Move the signal handler into the StageBase class so it can handle unbind() cleanup

Not quite complete, still errors on some unmounting

 bin/catalyst               | 19 -------------------
 catalyst/base/stagebase.py | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/bin/catalyst b/bin/catalyst
index 577e899..832399f 100755
--- a/bin/catalyst
+++ b/bin/catalyst
@@ -12,25 +12,6 @@ from __future__ import print_function
 
 import sys
 
-# This block ensures that ^C interrupts are handled quietly.
-try:
-	import signal
-
-	def exithandler(_signum, _frame):
-		signal.signal(signal.SIGINT, signal.SIG_IGN)
-		signal.signal(signal.SIGTERM, signal.SIG_IGN)
-		print()
-		sys.exit(1)
-
-	signal.signal(signal.SIGINT, exithandler)
-	signal.signal(signal.SIGTERM, exithandler)
-	signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
-except KeyboardInterrupt:
-	print()
-	sys.exit(1)
-
-
 from catalyst.main import main
 
 try:

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 813e5f1..90e8303 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -3,6 +3,7 @@ import os
 import imp
 import types
 import shutil
+import signal
 import sys
 from stat import ST_UID, ST_GID, ST_MODE
 
@@ -191,6 +192,17 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		if "portage_confdir" in self.settings:
 			file_locate(self.settings,["portage_confdir"],expand=0)
 
+
+		# This block ensures that ^C interrupts are handled quietly.
+		try:
+			signal.signal(signal.SIGINT, self.exithandler)
+			signal.signal(signal.SIGTERM, self.exithandler)
+			signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+		except KeyboardInterrupt:
+			print()
+			sys.exit(1)
+
 		# Setup our mount points.
 		# initialize our target mounts.
 		self.target_mounts = TARGET_MOUNT_DEFAULTS.copy()
@@ -265,6 +277,13 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		# save resources, it is not always needed
 		self.compressor = None
 
+	def exithandler(self, _signum, _frame):
+		signal.signal(signal.SIGINT, signal.SIG_IGN)
+		signal.signal(signal.SIGTERM, signal.SIG_IGN)
+		self.unbind()
+		print()
+		sys.exit(1)
+
 	def override_cbuild(self):
 		if "CBUILD" in self.makeconf:
 			self.settings["CBUILD"]=self.makeconf["CBUILD"]


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

end of thread, other threads:[~2015-10-06 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-08 14:14 [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, bin/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2015-10-06 19:54 Brian Dolbec

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