Added a better exception handling message for keyboard interrupt and added countdown...
authorEric Edgar <rocket@gentoo.org>
Thu, 21 Apr 2005 18:18:46 +0000 (18:18 +0000)
committerEric Edgar <rocket@gentoo.org>
Thu, 21 Apr 2005 18:18:46 +0000 (18:18 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@623 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
catalyst
modules/catalyst_support.py
modules/generic_stage_target.py

index 44bd72c408fe92d723ae18b7e6ddea0f433a044f..0a5032fb68d5ba519662bebf6580acd394e6637c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.235 2005/04/21 17:45:31 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.236 2005/04/21 18:18:46 rocket Exp $
+
+  21 Apr 2005; Eric Edgar <rocket@gentoo.org> catalyst,
+  modules/catalyst_support.py, modules/generic_stage_target.py:
+  Added a better exception handling message for keyboard interrupt and added
+  countdown timer for purge operation to give an opportunity to exit
 
   21 Apr 2005; Eric Edgar <rocket@gentoo.org> catalyst,
   modules/catalyst_support.py, modules/generic_stage_target.py:
index 59562df20b6b64f0313c2966abcf7d516b677c1c..43efd8bb9d0db6727ed05233a3a246638175049c 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.74 2005/04/21 17:45:31 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.75 2005/04/21 18:18:46 rocket Exp $
 
 # Maintained in full by:
 # Eric Edgar <rocket@gentoo.org>
@@ -338,3 +338,6 @@ if __name__ == "__main__":
        except CatalystError:
                raise CatalystError,"Could not complete build"
                sys.exit(2)
+       except KeyboardInterrupt:
+               print "\nCatalyst build aborted due to user interrupt"
+               sys.exit(2)
index 3c22bfd1c64931033cb99457481780246f933d83..df24966bfe1699311ad13d60ed59da78f36ee899 100644 (file)
@@ -1,8 +1,8 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.41 2005/04/21 17:45:31 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.42 2005/04/21 18:18:46 rocket Exp $
 
-import sys,string,os,types,re,signal,traceback,md5
+import sys,string,os,types,re,signal,traceback,md5,time
 # a function to turn a string of non-printable characters into a string of
 # hex characters
 def hexify(str):
@@ -358,3 +358,16 @@ def touch(myfile):
                myf.close()
        except IOError:
                raise CatalystError, "Could not touch "+myfile+"."
+
+def countdown(secs=5, doing="Starting"):
+        if secs:
+               print ">>> Waiting",secs,"seconds before starting..."
+               print ">>> (Control-C to abort)...\n"+doing+" in: ",
+               ticks=range(secs)
+               ticks.reverse()
+               for sec in ticks:
+                       sys.stdout.write(str(sec+1)+" ")
+                       sys.stdout.flush()
+                       time.sleep(1)
+               print
+
index 0757031700f31f43201d234038c127290eab367f..dd8ab95f14a1f14441b34ec5dde581ea9c9b2b57 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.36 2005/04/21 17:45:31 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.37 2005/04/21 18:18:46 rocket Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -1012,6 +1012,7 @@ class generic_stage_target(generic_target):
                    os.makedirs(myemp,0755)
        
        def purge(self):
+           countdown(10,"Purging Caches ...")
            if self.settings.has_key("PURGE"):
                print "clearing autoresume ..."
                self.clear_autoresume