Fix bug where purge deletes the autoresume directory but doesnt recreate it
authorEric Edgar <rocket@gentoo.org>
Tue, 26 Apr 2005 18:28:26 +0000 (18:28 +0000)
committerEric Edgar <rocket@gentoo.org>
Tue, 26 Apr 2005 18:28:26 +0000 (18:28 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@626 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/generic_stage_target.py

index 881891bc3a5fee35a7abc0d17f05de406bbd5372..6d780fa7b9f7eac66525e5359e1c8355fc841a29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.238 2005/04/26 14:58:04 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.239 2005/04/26 18:28:26 rocket Exp $
+
+  26 Apr 2005; Eric Edgar <rocket@gentoo.org>
+  modules/generic_stage_target.py:
+  Fix bug where purge deletes the autoresume directory but doesnt recreate it
 
   26 Apr 2005; Eric Edgar <rocket@gentoo.org> modules/catalyst_support.py,
   modules/generic_stage_target.py:
index a1f1a69e01435fa9240ccdd6d3da956149bd67ef..445e2667c5e680eba40b32e3abc5d4a7b0b4ccb5 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.39 2005/04/26 14:58:04 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.40 2005/04/26 18:28:26 rocket Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -722,12 +722,6 @@ class generic_stage_target(generic_target):
                    self.unbind()
                    raise
 
-       def clear_autoresume(self):
-               # clean resume points since they are no longer needed
-               if self.settings.has_key("AUTORESUME"):
-                       print "Removing AutoResume Points: ..."
-                       cmd("rm -rf "+self.settings["autoresume_path"],\
-                               "Couldn't remove resume points")
        
        def preclean(self):
            if self.settings.has_key("AUTORESUME") \
@@ -1008,7 +1002,21 @@ class generic_stage_target(generic_target):
                    mystat=os.stat(myemp)
                    shutil.rmtree(myemp)
                    os.makedirs(myemp,0755)
-       
+        def clear_autoresume(self):
+               # clean resume points since they are no longer needed
+               if self.settings.has_key("AUTORESUME"):
+                       print "Removing AutoResume Points: ..."
+                       myemp=self.settings["autoresume_path"]
+                       if not os.path.isdir(myemp):
+                               print myemp,"not a directory or does not exist, skipping 'pkgcache purge' operation."
+                       else:
+                               print "Emptying directory",myemp
+                               # stat the dir, delete the dir, recreate the dir and set
+                               # the proper perms and ownership
+                               mystat=os.stat(myemp)
+                               shutil.rmtree(myemp)
+                               os.makedirs(myemp,0755)
+
        def purge(self):
            countdown(10,"Purging Caches ...")
            if self.settings.has_key("PURGE"):