fixed livecd-stage2 cleaning
authorJohn P. Davis <zhen@gentoo.org>
Wed, 14 Jul 2004 17:23:16 +0000 (17:23 +0000)
committerJohn P. Davis <zhen@gentoo.org>
Wed, 14 Jul 2004 17:23:16 +0000 (17:23 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@418 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
livecd/runscript-support/livecdfs-update.sh
modules/generic_stage_target.py
modules/livecd_stage2_target.py

index 7144144e695d898d000a1ee854222af8b14ac241..ba56f9d7878348345fff124c93f8bd48f33638c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
 # ChangeLog for gentoo/src/catalyst 
 # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.71 2004/07/13 14:06:44 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.72 2004/07/14 17:23:16 zhen Exp $
+
+  14 Jul 2004; John Davis <zhen@gentoo.org>
+  livecd/runscript-support/livecdfs-update.sh,
+  modules/generic_stage_target.py, modules/livecd_stage2_target.py:
+  fixed a bug for livecd-stage2. somehow, the inheritance got mucked up and the
+  livecds were not cleaning out livecd/empty livecd/rm etc. I moved the code for
+  this out of generic_stage_target and into livecd-stage2 since the
+  livecd-stage2 class was overriding generic_stage_target for cleaning anyway.
 
   13 Jul 2004; <zhen@gentoo.org> livecd/runscript-support/livecdfs-update.sh:
   changed the behavior of rcadd/ rcdel. it was getting hokey to have to add the
index c648c02b6f3fce29f55de7da75939fc01ebe37c2..ce272744151c54f323b8897f2e37f6d924a6bbbe 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2004 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/livecd/runscript-support/Attic/livecdfs-update.sh,v 1.7 2004/07/13 14:06:44 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/livecd/runscript-support/Attic/livecdfs-update.sh,v 1.8 2004/07/14 17:23:16 zhen Exp $
 
 /usr/sbin/env-update
 source /etc/profile
@@ -16,6 +16,7 @@ fi
 # fix /etc/issue for mingetty and friends
 echo "This is \n.gentoo (\s \m \r) \t" > /etc/issue
 
+# switch the order of rcadd/ rcdel
 if [ -n "${clst_livecd_rcadd}" ] || [ -n "${clst_livecd_rcdel}" ]
 then
        if [ -n "${clst_livecd_rcadd}" ]
index cce1606283b6c01a7653267742ee7c8e24abe91a..c4b1588d6e1401a1f3fded79cbf3abf6a13be0f5 100644 (file)
@@ -1,6 +1,6 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.6 2004/07/06 13:48:00 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.7 2004/07/14 17:23:16 zhen Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -335,10 +335,7 @@ class generic_stage_target(generic_target):
        def clean(self):
                destpath=self.settings["chroot_path"]
                
-               cleanables=["/etc/resolv.conf","/var/tmp/*","/tmp/*","/root/*"]
-               if self.settings["target"] not in ["livecd-stage2"]:
-                       # we don't need to clean up a livecd-stage2
-                       cleanables.append("/usr/portage")
+               cleanables=["/etc/resolv.conf","/var/tmp/*","/tmp/*","/root/*","/usr/portage"]
                        
                if self.settings["target"]=="stage1":
                        destpath+="/tmp/stage1root"
@@ -352,39 +349,8 @@ class generic_stage_target(generic_target):
                        print "Cleaning chroot: "+x+"..."
                        cmd("rm -rf "+destpath+x,"Couldn't clean "+x)
                
-               if self.settings["target"]=="livecd-stage2":
-                       
-                       if self.settings.has_key("livecd/empty"):
-                               
-                               if type(self.settings["livecd/empty"])==types.StringType:
-                                       self.settings["livecd/empty"]=[self.settings["livecd/empty"]]
-                               
-                               for x in self.settings["livecd/empty"]:
-                                       myemp=self.settings["chroot_path"]+x
-                                       if not os.path.isdir(myemp):
-                                               print x,"not a directory or does not exist, skipping 'empty' operation."
-                                               continue
-                                       print "Emptying directory",x
-                                       # 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)
-                                       os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
-                                       os.chmod(myemp,mystat[ST_MODE])
-                       
-                       if self.settings.has_key("livecd/rm"):  
-                               
-                               if type(self.settings["livecd/rm"])==types.StringType:
-                                       self.settings["livecd/rm"]=[self.settings["livecd/rm"]]
-                               
-                               for x in self.settings["livecd/rm"]:
-                                       # we're going to shell out for all these cleaning operations, so we get easy glob handling
-                                       print "livecd: removing "+x
-                                       os.system("rm -rf "+self.settings["chroot_path"]+x)
-               
-               if self.settings["target"]!="livecd-stage2":
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
-                               "/"+self.settings["target"]+".sh clean","clean script failed.")
+               cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
+                       "/"+self.settings["target"]+".sh clean","clean script failed.")
        
        def preclean(self):
                # cleanup after distcc
index 09c37bb11dbdc13e1fae0f89e7fff13d43be8cea..605c6f2184a0e8f6ed9583394c935decf6905e3c 100644 (file)
@@ -1,12 +1,12 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.14 2004/07/14 04:26:45 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.15 2004/07/14 17:23:16 zhen Exp $
 
 """
 Builder class for a LiveCD stage2 build.
 """
 
-import os,string,types
+import os,string,types,stat,shutil
 from catalyst_support import *
 from generic_stage_target import *
 
@@ -111,6 +111,36 @@ class livecd_stage2_target(generic_stage_target):
                                touch(self.settings["chroot_path"]+"/tmp/.clst_unmerge")
 
        def clean(self):
+               if self.settings.has_key("livecd/empty"):
+               
+                       if type(self.settings["livecd/empty"])==types.StringType:
+                               self.settings["livecd/empty"]=[self.settings["livecd/empty"]]
+                       
+                       for x in self.settings["livecd/empty"]:
+                               myemp=self.settings["chroot_path"]+x
+                               if not os.path.isdir(myemp):
+                                       print x,"not a directory or does not exist, skipping 'empty' operation."
+                                       continue
+                               print "Emptying directory",x
+                               # 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)
+                               os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+                               os.chmod(myemp,mystat[ST_MODE])
+                       
+               if self.settings.has_key("livecd/rm"):  
+                               
+                       if type(self.settings["livecd/rm"])==types.StringType:
+                               self.settings["livecd/rm"]=[self.settings["livecd/rm"]]
+                       
+                       for x in self.settings["livecd/rm"]:
+                               # we're going to shell out for all these cleaning operations,
+                               # so we get easy glob handling
+                               print "livecd: removing "+x
+                               os.system("rm -rf "+self.settings["chroot_path"]+x)
+
                try:
                        cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean",\
                                "Clean runscript failed.")