see changelog
authorJohn P. Davis <zhen@gentoo.org>
Sat, 3 Jul 2004 00:33:37 +0000 (00:33 +0000)
committerJohn P. Davis <zhen@gentoo.org>
Sat, 3 Jul 2004 00:33:37 +0000 (00:33 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@402 d1e1f19c-881f-0410-ab34-b69fee027534

12 files changed:
ChangeLog
modules/generic_stage_target.py
modules/generic_target.py
modules/grp_target.py
modules/livecd_stage1_target.py
modules/livecd_stage2_target.py
modules/snapshot_target.py
modules/stage1_target.py
modules/stage2_target.py
modules/stage3_target.py
modules/tinderbox_target.py
targets/stage1/stage1.sh

index 7ddb51703c2232337c8185f8c0b005305866b9e9..7148b2739f8f69f87667dc76eb01b342ee8728fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,22 @@
 # 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.66 2004/06/18 18:06:21 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.67 2004/07/03 00:33:37 zhen Exp $
+
+  02 Jul 2004; John Davis <zhen@gentoo.org> modules/generic_stage_target.py,
+  modules/generic_target.py, modules/grp_target.py,
+  modules/livecd_stage1_target.py, modules/livecd_stage2_target.py,
+  modules/snapshot_target.py, modules/stage1_target.py,
+  modules/stage2_target.py, modules/stage3_target.py,
+  modules/tinderbox_target.py, targets/stage1/stage1.sh:
+  fixes for bugs #55192 and #54137
+  added a new key for all specfiles, portage_confdir.
+  this should point to a directory similar in functionality to /etc/portage.
+  
+  cleaned up the module code a bit so that unnecessary modules
+  are not imported.
+  
+  more work on resuming. it is getting there, but it still needs a ton of work,
+  so please test, and report bugs.
 
   18 Jun 2004; John Davis <zhen@gentoo.org> catalyst,
   modules/catalyst_support.py, modules/generic_stage_target.py,
index ebf74822c2657fad028fa94c07c957b8e3a6db2e..6d2584a9b582c158c8a128c51cf105c04dc4ad2e 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.4 2004/06/18 18:06:21 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.5 2004/07/03 00:33:37 zhen Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -16,13 +16,16 @@ class generic_stage_target(generic_target):
 
        def __init__(self,myspec,addlargs):
                
-               self.required_values.extend(["version_stamp","target","subarch","rel_type","profile","snapshot","source_subpath"])
-               self.valid_values.extend(["version_stamp","target","subarch","rel_type","profile","snapshot","source_subpath"])
+               self.required_values.extend(["version_stamp","target","subarch","rel_type",\
+                       "profile","snapshot","source_subpath"])
+               
+               self.valid_values.extend(["version_stamp","target","subarch","rel_type","profile",\
+                       "snapshot","source_subpath","portage_confdir"])
                generic_target.__init__(self,addlargs,myspec)
+               
                # map the mainarch we are running under to the mainarches we support for
                # building stages and LiveCDs. (for example, on amd64, we can build stages for
                # x86 or amd64.
-               
                targetmap={     "x86" : ["x86"],
                                "amd64" : ["x86","amd64"],
                                "sparc64" : ["sparc","sparc64"],
@@ -57,49 +60,74 @@ class generic_stage_target(generic_target):
                mymachine=os.uname()[4]
                if not machinemap.has_key(mymachine):
                        raise CatalystError, "Unknown machine type "+mymachine
+                       
                self.settings["hostarch"]=machinemap[mymachine]
                self.archmap={}
                self.subarchmap={}
+               
                for x in targetmap[self.settings["hostarch"]]:
                        try:
                                fh=open(self.settings["sharedir"]+"/arch/"+x+".py")
-                               #this next line loads the plugin as a module and assigns it to archmap[x]
+                               # this next line loads the plugin as a module and assigns it to archmap[x]
                                self.archmap[x]=imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
-                               #this next line registers all the subarches supported in the plugin
+                               # this next line registers all the subarches supported in the plugin
                                self.archmap[x].register(self.subarchmap)
                                fh.close()      
+                       
                        except IOError:
                                msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
-               #call arch constructor, pass our settings
+               
+               # call arch constructor, pass our settings
                self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
-               #self.settings["mainarch"] should now be set by our arch constructor, so we print
-               #a nice informational message:
+               
+               # self.settings["mainarch"] should now be set by our arch constructor, so we print
+               # a nice informational message:
                if self.settings["mainarch"]==self.settings["hostarch"]:
                        print "Building natively for",self.settings["hostarch"]
+               
                else:
-                       print "Building on",self.settings["hostarch"],"for alternate machine type",self.settings["mainarch"]
-                       
+                       print "Building on",self.settings["hostarch"],"for alternate machine type",\
+                               self.settings["mainarch"]
+               
+               # define all of our core variables
                self.settings["target_profile"]=self.settings["profile"]
-               self.settings["target_subpath"]=self.settings["rel_type"]+"/"+self.settings["target"]+"-"+self.settings["subarch"]+"-"+self.settings["version_stamp"]
+               self.settings["target_subpath"]=self.settings["rel_type"]+"/"+self.settings["target"]+\
+                       "-"+self.settings["subarch"]+"-"+self.settings["version_stamp"]
+                       
                st=self.settings["storedir"]
                self.settings["snapshot_path"]=st+"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2"
                if self.settings["target"] in ["grp","tinderbox"]:
-                       #grp creates a directory of packages and sources rather than a compressed tarball
+                       # grp creates a directory of packages and sources rather than a compressed tarball
                        self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"]
                        self.settings["source_path"]=st+"/builds/"+self.settings["source_subpath"]+".tar.bz2"
+               
                elif self.settings["target"] == "livecd-stage2":
                        self.settings["source_path"]=st+"/tmp/"+self.settings["source_subpath"]
                        self.settings["cdroot_path"]=st+"/builds/"+self.settings["target_subpath"]
+               
                else:
                        self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"]+".tar.bz2"
                        self.settings["source_path"]=st+"/builds/"+self.settings["source_subpath"]+".tar.bz2"
+               
                self.settings["chroot_path"]=st+"/tmp/"+self.settings["target_subpath"]
                
-               #this next line checks to make sure that the specified variables exist on disk.
+               # this next line checks to make sure that the specified variables exist on disk.
                file_locate(self.settings,["source_path","snapshot_path","distdir"],expand=0)
                
+               # if we are using portage_confdir, check that as well
+               if self.settings.has_key("portage_confdir"):
+                       file_locate(self.settings,["portage_confdir"],expand=0)
+               
+               # setup our mount points
                self.mounts=[ "/proc","/dev","/dev/pts","/usr/portage/distfiles" ]
-               self.mountmap={"/proc":"/proc", "/dev":"/dev", "/dev/pts":"/dev/pts","/usr/portage/distfiles":self.settings["distdir"]}
+               self.mountmap={"/proc":"/proc", "/dev":"/dev", "/dev/pts":"/dev/pts",\
+                       "/usr/portage/distfiles":self.settings["distdir"]}
+               
+               if self.settings["target"]=="grp":
+                       self.mounts.append("/tmp/grp")
+                       self.mountmap["/tmp/grp"]=self.settings["target_path"]
+
+               # configure any user specified options (either in catalyst.conf or on the cmdline)
                if self.settings.has_key("PKGCACHE"):
                        self.settings["pkgcache_path"]=st+"/packages/"+self.settings["target_subpath"]
                        self.mounts.append("/usr/portage/packages")
@@ -112,73 +140,103 @@ class generic_stage_target(generic_target):
                        else:
                                ccdir="/root/.ccache"
                        if not os.path.isdir(ccdir):
-                                       raise CatalystError,"Compiler cache support can't be enabled (can't find "+ccdir+")"
+                                       raise CatalystError,\
+                                               "Compiler cache support can't be enabled (can't find "+ccdir+")"
                        self.mounts.append("/var/tmp/ccache")
                        self.mountmap["/var/tmp/ccache"]=ccdir
-                       #for the chroot:
+                       # for the chroot:
                        os.environ["CCACHE_DIR"]="/var/tmp/ccache"      
-
-               if self.settings["target"]=="grp":
-                       self.mounts.append("/tmp/grp")
-                       self.mountmap["/tmp/grp"]=self.settings["target_path"]
-               
+                       
        def mount_safety_check(self):
                mypath=self.settings["chroot_path"]
-               #check and verify that none of our paths in mypath are mounted. We don't want to clean up with things still
-               #mounted, and this allows us to check. returns 1 on ok, 0 on "something is still mounted" case.
+               
+               """
+               check and verify that none of our paths in mypath are mounted. We don't want to clean
+               up with things still mounted, and this allows us to check. 
+               returns 1 on ok, 0 on "something is still mounted" case.
+               """
                if not os.path.exists(mypath):
-                       return 
+                       return
+                       
                for x in self.mounts:
                        if not os.path.exists(mypath+x):
                                continue
+                       
                        if ismount(mypath+x):
                                #something is still mounted
                                try:
                                        print x+" is still mounted; performing auto-bind-umount..."
-                                       #try to umount stuff ourselves
+                                       # try to umount stuff ourselves
                                        self.unbind()
                                        if ismount(mypath+x):
                                                raise CatalystError, "Auto-unbind failed for "+x
+                                       
                                        else:
                                                print "Auto-unbind successful, continuing..."
+                               
                                except CatalystError:
                                        raise CatalystError, "Unable to auto-unbind "+x
                
        def dir_setup(self):
                print "Setting up directories..."
                self.mount_safety_check()
-               if self.settings.has_key("AUTORESUME") and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
                        print "Directories previously setup, resuming..."
+               
                else:
-                       cmd("rm -rf "+self.settings["chroot_path"],"Could not remove existing directory: "+self.settings["chroot_path"])
+                       cmd("rm -rf "+self.settings["chroot_path"],\
+                               "Could not remove existing directory: "+self.settings["chroot_path"])
 
                if not os.path.exists(self.settings["chroot_path"]):
                        os.makedirs(self.settings["chroot_path"])
+               
                if self.settings.has_key("PKGCACHE"):   
                        if not os.path.exists(self.settings["pkgcache_path"]):
                                os.makedirs(self.settings["pkgcache_path"])
                                        
        def unpack_and_bind(self):
-               if self.settings.has_key("AUTORESUME") and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
-                       print "CHROOT previously unpacked and bind mounted, resuming..."
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
+                       print "Resume point detected, skipping unpack and bind operation..."
+               
                else:
                        print "Unpacking stage tarball..."
-                       cmd("tar xjpf "+self.settings["source_path"]+" -C "+self.settings["chroot_path"],"Error unpacking tarball")
+                       cmd("tar xjpf "+self.settings["source_path"]+" -C "+self.settings["chroot_path"],\
+                               "Error unpacking tarball")
+                               
                        if os.path.exists(self.settings["chroot_path"]+"/usr/portage"):
                                print "Cleaning up existing portage tree snapshot..."
-                               cmd("rm -rf "+self.settings["chroot_path"]+"/usr/portage","Error removing existing snapshot directory.")
+                               cmd("rm -rf "+self.settings["chroot_path"]+"/usr/portage",\
+                                       "Error removing existing snapshot directory.")
+                       
                        print "Unpacking portage tree snapshot..."
-                       cmd("tar xjpf "+self.settings["snapshot_path"]+" -C "+self.settings["chroot_path"]+"/usr","Error unpacking snapshot")
-                       print "Configuring profile link..."
-                       cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile","Error zapping profile link")
-                       cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+" "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
-                       touch(self.settings["chroot_path"]+"/tmp/unpacked")
-                               
+                       cmd("tar xjpf "+self.settings["snapshot_path"]+" -C "+\
+                               self.settings["chroot_path"]+"/usr","Error unpacking snapshot")
+                       
+                       touch(self.settings["chroot_path"]+"/tmp/.unpack_and_bind")
+
+               # for safety's sake, we really don't want to resume these either                
+               print "Configuring profile link..."
+               cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile",\
+                       "Error zapping profile link")
+               cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+\
+                       " "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
+               
+               if self.settings.has_key("portage_confdir"):
+                       print "Configuring /etc/portage..."
+                       cmd("rm -rf "+self.settings["chroot_path"]+"/etc/portage","Error zapping /etc/portage")
+                       cmd("cp -R "+self.settings["portage_confdir"]+" "+self.settings["chroot_path"]+\
+                               "/etc/portage","Error copying /etc/portage")
+
+               # do all of our bind mounts here (does not get autoresumed!)
                for x in self.mounts: 
                        if not os.path.exists(self.settings["chroot_path"]+x):
                                os.makedirs(self.settings["chroot_path"]+x)
+                       
                        if not os.path.exists(self.mountmap[x]):
                                os.makedirs(self.mountmap[x])
+                       
                        src=self.mountmap[x]
                        retval=os.system("mount --bind "+src+" "+self.settings["chroot_path"]+x)
                        if retval!=0:
@@ -190,55 +248,75 @@ class generic_stage_target(generic_target):
                mypath=self.settings["chroot_path"]
                myrevmounts=self.mounts[:]
                myrevmounts.reverse()
-               #unmount in reverse order for nested bind-mounts
+               # unmount in reverse order for nested bind-mounts
                for x in myrevmounts:
                        if not os.path.exists(mypath+x):
                                continue
+                       
                        if not ismount(mypath+x):
-                               #it's not mounted, continue
+                               # it's not mounted, continue
                                continue
+                       
                        retval=os.system("umount "+mypath+x)
+                       
                        if retval!=0:
                                ouch=1
                                warn("Couldn't umount bind mount: "+mypath+x)
-                               #keep trying to umount the others, to minimize damage if developer makes a mistake
+                               # keep trying to umount the others, to minimize damage if developer makes a mistake
+               
                if ouch:
-                       #if any bind mounts really failed, then we need to raise this to potentially prevent
-                       #an upcoming bash stage cleanup script from wiping our bind mounts.
+                       """
+                       if any bind mounts really failed, then we need to raise
+                       this to potentially prevent an upcoming bash stage cleanup script
+                       from wiping our bind mounts.
+                       """
                        raise CatalystError,"Couldn't umount one or more bind-mounts; aborting for safety."
 
        def chroot_setup(self):
                print "Setting up chroot..."
-               cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc","Could not copy resolv.conf into place.")
+               cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc",\
+                       "Could not copy resolv.conf into place.")
+               
+               # copy over the envscript, if applicable
                if self.settings.has_key("ENVSCRIPT"):
                        if not os.path.exists(self.settings["ENVSCRIPT"]):
                                raise CatalystError, "Can't find envscript "+self.settings["ENVSCRIPT"]
-                       cmd("cp "+self.settings["ENVSCRIPT"]+" "+self.settings["chroot_path"]+"/tmp/envscript","Could not copy envscript into place.")
+                       cmd("cp "+self.settings["ENVSCRIPT"]+" "+self.settings["chroot_path"]+"/tmp/envscript",\
+                               "Could not copy envscript into place.")
+               
+               # modify and write out make.conf (for the chroot)
                cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.conf")
-
                myf=open(self.settings["chroot_path"]+"/etc/make.conf","w")
                myf.write("# These settings were set by the catalyst build script that automatically built this stage\n")
                myf.write("# Please consult /etc/make.conf.example for a more detailed example\n")
                myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n')
                myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
+               
+               # figure out what our USE vars are for building
                myusevars=[]
                if self.settings.has_key("HOSTUSE"):
                        myusevars.extend(self.settings["HOSTUSE"])
+                       
                if self.settings["target"]=="grp":
                        myusevars.append("bindist")
                        myusevars.extend(self.settings["grp/use"])
                        myf.write('USE="'+string.join(myusevars)+'"\n')
+                       
                elif self.settings["target"]=="tinderbox":
                        myusevars.extend(self.settings["tinderbox/use"])
                        myf.write('USE="'+string.join(myusevars)+'"\n')
+                       
                elif self.settings["target"]=="livecd-stage1":
                        myusevars.extend(self.settings["livecd/use"])
                        myf.write('USE="'+string.join(myusevars)+'"\n')
+                       
                elif self.settings["target"]=="embedded":
                        myusevars.extend(self.settings["embedded/use"])
                        myf.write('USE="'+string.join(myusevars)+'"\n')
+                       
                if self.settings.has_key("CXXFLAGS"):
                        myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
+               
                else:
                        myf.write('CXXFLAGS="${CFLAGS}"\n')
                myf.close()
@@ -248,51 +326,63 @@ class generic_stage_target(generic_target):
                        myf=open(self.settings["chroot_path"]+"/etc/passwd","a")
                        myf.write("distcc:x:7980:2:distccd:/dev/null:/bin/false\n")
                        myf.close()
-               touch(self.settings["chroot_path"]+"/tmp/chroot_setup")
                
        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
+                       # we don't need to clean up a livecd-stage2
                        cleanables.append("/usr/portage")
+                       
                if self.settings["target"]=="stage1":
                        destpath+="/tmp/stage1root"
-                       #this next stuff can eventually be integrated into the python and glibc ebuilds themselves (USE="build"):
-                       cleanables.extend(["/usr/share/gettext","/usr/lib/python2.2/test","/usr/lib/python2.2/encodings","/usr/lib/python2.2/email","/usr/lib/python2.2/lib-tk","/usr/share/zoneinfo"])
+                       # this next stuff can eventually be integrated into the python
+                       # and glibc ebuilds themselves (USE="build"):
+                       cleanables.extend(["/usr/share/gettext","/usr/lib/python2.2/test",\
+                               "/usr/lib/python2.2/encodings","/usr/lib/python2.2/email",\
+                               "/usr/lib/python2.2/lib-tk","/usr/share/zoneinfo"])
+                               
                for x in cleanables: 
                        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
+                                       # 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
+                                       # 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
+               # cleanup after distcc
                if self.settings.has_key("DISTCC"):
                        myf=open(self.settings["chroot_path"]+"/etc/passwd","r")
                        outf=open(self.settings["chroot_path"]+"/tmp/out.txt","w")
@@ -303,8 +393,11 @@ class generic_stage_target(generic_target):
                        outf.close()
                        os.rename(self.settings["chroot_path"]+"/tmp/out.txt",self.settings["chroot_path"]+"/etc/passwd")
                        cmd("/usr/bin/pkill -U 7980","could not kill distcc process(es)")
+                       
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/"+self.settings["target"]+".sh preclean","preclean script failed.")
+                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
+                               "/"+self.settings["target"]+".sh preclean","preclean script failed.")
+               
                except:
                        self.unbind()
                        raise
@@ -312,22 +405,30 @@ class generic_stage_target(generic_target):
        def capture(self):
                """capture target in a tarball"""
                mypath=self.settings["target_path"].split("/")
-               #remove filename from path
+               # remove filename from path
                mypath=string.join(mypath[:-1],"/")
-               #now make sure path exists
+               
+               # now make sure path exists
                if not os.path.exists(mypath):
                        os.makedirs(mypath)
                print "Creating stage tarball..."
+               
                if self.settings["target"]=="stage1":
-                       cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["chroot_path"]+"/tmp/stage1root .","Couldn't create stage tarball")
+                       cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["chroot_path"]+\
+                               "/tmp/stage1root .","Couldn't create stage tarball")
+               
                elif self.settings["target"]=="embedded":
-                       cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["chroot_path"]+"/tmp/mergeroot .","Couldn't create stage tarball")
+                       cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["chroot_path"]+\
+                               "/tmp/mergeroot .","Couldn't create stage tarball")
+               
                else:
-                       cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["chroot_path"]+" .","Couldn't create stage tarball")
+                       cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["chroot_path"]+\
+                               " .","Couldn't create stage tarball")
 
        def run_local(self):
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/"+self.settings["target"]+".sh run","build script failed")
+                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
+                               "/"+self.settings["target"]+".sh run","build script failed")
 
                except CatalystError:
                        self.unbind()
@@ -338,17 +439,19 @@ class generic_stage_target(generic_target):
                self.unpack_and_bind()
                try:
                        self.chroot_setup()
+               
                except:
                        self.unbind()
                        raise
-               #modify the current environment. This is an ugly hack that should be fixed. We need this
-               #to use the os.system() call since we can't specify our own environ:
+               
+               # modify the current environment. This is an ugly hack that should be fixed. We need this
+               # to use the os.system() call since we can't specify our own environ:
                for x in self.settings.keys():
-                       #"/" is replaced with "_", "-" is also replaced with "_"
+                       # "/" is replaced with "_", "-" is also replaced with "_"
                        varname="clst_"+string.replace(x,"/","_")
                        varname=string.replace(varname,"-","_")
                        if type(self.settings[x])==types.StringType:
-                               #prefix to prevent namespace clashes:
+                               # prefix to prevent namespace clashes:
                                os.environ[varname]=self.settings[x]
                        elif type(self.settings[x])==types.ListType:
                                os.environ[varname]=string.join(self.settings[x])
@@ -356,13 +459,18 @@ class generic_stage_target(generic_target):
                self.run_local()
                if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage2"]:
                        self.preclean()
+               
                if self.settings["target"] in ["livecd-stage2"]:
                        self.unmerge()
                self.unbind()
+               
                if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage2"]:
-                       #clean is for removing things after bind-mounts are unmounted (general file removal and cleanup)
+                       # clean is for removing things after bind-mounts are 
+                       # unmounted (general file removal and cleanup)
                        self.clean()
+               
                if self.settings["target"] in ["stage1","stage2","stage3","embedded"]:
                        self.capture()
+               
                if self.settings["target"] in ["livecd-stage2"]:
                        self.cdroot_setup()
index 86718ca961d142a77dfab8717ddb6ab229433ba9..97093364c626a58e82528af5578c08a1e0a3ecb4 100644 (file)
@@ -1,14 +1,12 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
 """
 The toplevel class for generic_stage_target. This is about as generic as we get.
 """
 
-import os,string,imp,types,shutil
 from catalyst_support import *
-from stat import *
 
 class generic_target:
 
index db7aa05fed2871d4375df382204cc4b5079868e5..f8285bc671d3c506e5cd96cc5604096e348407ee 100644 (file)
@@ -1,37 +1,43 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/grp_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/grp_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
 """
 The builder class for GRP (Gentoo Reference Platform) builds.
 """
 
-import os,string,imp,types,shutil
+import os,types
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
-
 
 class grp_target(generic_stage_target):
        def __init__(self,spec,addlargs):
-               self.required_values=["version_stamp","target","subarch","rel_type","profile","snapshot","source_subpath"]
+               self.required_values=["version_stamp","target","subarch",\
+                       "rel_type","profile","snapshot","source_subpath"]
+               
                self.valid_values=self.required_values[:]
                if not addlargs.has_key("grp"):
                        raise CatalystError,"Required value \"grp\" not specified in spec."
+               
                self.required_values.extend(["grp","grp/use"])
                if type(addlargs["grp"])==types.StringType:
                        addlargs["grp"]=[addlargs["grp"]]
+                       
                for x in addlargs["grp"]:
                        self.required_values.append("grp/"+x+"/packages")
                        self.required_values.append("grp/"+x+"/type")
+                       
                generic_stage_target.__init__(self,spec,addlargs)
 
        def run_local(self):
                for pkgset in self.settings["grp"]:
-                       #example call: "grp.sh run pkgset cd1 xmms vim sys-apps/gleep"
+                       # example call: "grp.sh run pkgset cd1 xmms vim sys-apps/gleep"
                        mypackages=list_bashify(self.settings["grp/"+pkgset+"/packages"])
                        try:
-                               cmd("/bin/bash "+self.settings["sharedir"]+"/targets/grp/grp.sh run "+self.settings["grp/"+pkgset+"/type"]+" "+pkgset+" "+mypackages)
+                               cmd("/bin/bash "+self.settings["sharedir"]+\
+                                       "/targets/grp/grp.sh run "+self.settings["grp/"+pkgset+"/type"]\
+                                       +" "+pkgset+" "+mypackages)
+                       
                        except CatalystError:
                                self.unbind()
                                raise CatalystError,"GRP build aborting due to error."
index 96f502e7c0ae75cb50e0de739e6bf9929427e614..0c73e49c9add3b8956dc52ae9cd7da504e0f3bf4 100644 (file)
@@ -1,15 +1,13 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
 """
 Builder class for LiveCD stage1.
 """
 
-import os,string,imp,types,shutil
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class livecd_stage1_target(generic_stage_target):
        def __init__(self,spec,addlargs):
@@ -20,7 +18,9 @@ class livecd_stage1_target(generic_stage_target):
        def run_local(self):
                mypack=list_bashify(self.settings["livecd/packages"])
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/livecd-stage1/livecd-stage1.sh run "+mypack)
+                       cmd("/bin/bash "+self.settings["sharedir"]+\
+                               "/targets/livecd-stage1/livecd-stage1.sh run "+mypack)
+               
                except CatalystError:
                        self.unbind()
                        raise CatalystError,"LiveCD stage1 build aborting due to error."
index 6b44117880979b0c059401ae28701356c69fc232..5b8a8cefb35237cfe2ef50b8d5f5c908ad050b40 100644 (file)
@@ -1,26 +1,30 @@
 # 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.10 2004/06/11 19:06:37 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.11 2004/07/03 00:33:37 zhen Exp $
 
 """
 Builder class for a LiveCD stage2 build.
 """
 
-import os,string,imp,types,shutil
+import os,string,types
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class livecd_stage2_target(generic_stage_target):
        def __init__(self,spec,addlargs):
-               self.required_values=["boot/kernel","livecd/cdfstype","livecd/archscript","livecd/runscript"]
+               self.required_values=["boot/kernel","livecd/cdfstype",\
+               "livecd/archscript","livecd/runscript"]
+               
                self.valid_values=[]
                if not addlargs.has_key("boot/kernel"):
                        raise CatalystError, "Required value boot/kernel not specified."
+                       
                if type(addlargs["boot/kernel"]) == types.StringType:
                        loopy=[addlargs["boot/kernel"]]
+                       
                else:
                        loopy=addlargs["boot/kernel"]
+                       
                for x in loopy:
                        self.required_values.append("boot/kernel/"+x+"/sources")
                        self.required_values.append("boot/kernel/"+x+"/config")
@@ -28,6 +32,7 @@ class livecd_stage2_target(generic_stage_target):
                        self.valid_values.append("boot/kernel/"+x+"/packages")
                        self.valid_values.append("boot/kernel/"+x+"/use")
                        self.valid_values.append("boot/kernel/"+x+"/gk_kernargs")
+               
                self.valid_values.extend(self.required_values)
                self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\
                        "livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\
@@ -36,14 +41,37 @@ class livecd_stage2_target(generic_stage_target):
                
                generic_stage_target.__init__(self,spec,addlargs)
                file_locate(self.settings, ["livecd/cdtar","livecd/archscript","livecd/runscript"])
+               if self.settings.has_key("portage_confdir"):
+                       file_locate(self.settings,["portage_confdir"],expand=0)
        
        def unpack_and_bind(self):
-               if os.path.exists(self.settings["chroot_path"]):
-                       print "Removing previously-existing livecd-stage2 chroot directory..."
-                       cmd("rm -rf "+self.settings["chroot_path"],"Error removing livecd-stage2 chroot")
-                       os.makedirs(self.settings["chroot_path"])
-               print "Copying livecd-stage1 result to new livecd-stage2 work directory..."
-               cmd("cp -a "+self.settings["source_path"]+"/* "+self.settings["chroot_path"],"Error copying initial livecd-stage2")
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["cdroot_path"]+"/tmp/.unpack_and_bind"):
+                       print "Detected resume point, skipping unpack and bind operation..."
+               
+               else:
+                       if os.path.exists(self.settings["chroot_path"]):
+                               print "Removing previously-existing livecd-stage2 chroot directory..."
+                               cmd("rm -rf "+self.settings["chroot_path"],"Error removing livecd-stage2 chroot")
+                               os.makedirs(self.settings["chroot_path"])
+                               
+                       print "Copying livecd-stage1 result to new livecd-stage2 work directory..."
+                       cmd("cp -a "+self.settings["source_path"]+"/* "+self.settings["chroot_path"],
+                               "Error copying initial livecd-stage2")
+                       touch(self.settings["chroot_path"]+"/tmp/.unpack_and_bind")
+       
+               # we do not want to resume code below this line
+               print "Configuring profile link..."
+               cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile","Error zapping profile link")
+               cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+" "
+                       +self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
+       
+               if self.settings.has_key("portage_confdir"):
+                       print "Configuring /etc/portage..."
+                       cmd("rm -rf "+self.settings["chroot_path"]+"/etc/portage","Error zapping /etc/portage")
+                       cmd("cp -R "+self.settings["portage_confdir"]+" "+self.settings["chroot_path"]+\
+                               "/etc/portage","Error copying /etc/portage")
+
                for x in self.mounts: 
                        if not os.path.exists(self.settings["chroot_path"]+x):
                                os.makedirs(self.settings["chroot_path"]+x)
@@ -54,89 +82,123 @@ class livecd_stage2_target(generic_stage_target):
                        if retval!=0:
                                self.unbind()
                                raise CatalystError,"Couldn't bind mount "+src
-               print "Configuring profile link..."
-               cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile","Error zapping profile link")
-               cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+" "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
-               
+                       
        def unmerge(self):
-               if self.settings.has_key("livecd/unmerge"):
-                       if type(self.settings["livecd/unmerge"])==types.StringType:
-                               self.settings["livecd/unmerge"]=[self.settings["livecd/unmerge"]]
-                       myunmerge=self.settings["livecd/unmerge"][:]
-                       for x in range(0,len(myunmerge)):
-                               #surround args with quotes for passing to bash, 
-                               #allows things like "<" to remain intact
-                               myunmerge[x]="'"+myunmerge[x]+"'"
-                       myunmerge=string.join(myunmerge)
-                       #before cleaning, unmerge stuff:
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/unmerge"):
+                       print "Detected resume point, skipping unmerge operation..."
+               
+               else:
+                       if self.settings.has_key("livecd/unmerge"):
+                               if type(self.settings["livecd/unmerge"])==types.StringType:
+                                       self.settings["livecd/unmerge"]=[self.settings["livecd/unmerge"]]
+                               myunmerge=self.settings["livecd/unmerge"][:]
+                               
+                               for x in range(0,len(myunmerge)):
+                                       #surround args with quotes for passing to bash, 
+                                       #allows things like "<" to remain intact
+                                       myunmerge[x]="'"+myunmerge[x]+"'"
+                               myunmerge=string.join(myunmerge)
+                               #before cleaning, unmerge stuff:
+                               
+                               try:
+                                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"
+                                               +self.settings["target"]+"/unmerge.sh "+myunmerge,"Unmerge script failed.")
+                               
+                               except CatalystError:
+                                       self.unbind()
+                                       raise
+                               touch(self.settings["chroot_path"]+"/tmp/unmerge")
+
+       def clean(self):
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.clean"):
+                       print "Detected resume point, skipping clean operation..."
+               
+               else:
+                       generic_stage_target.clean(self)
                        try:
-                               cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/unmerge.sh "+myunmerge,"Unmerge script failed.")
-                       except CatalystError:
+                               cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean",\
+                                       "Clean runscript failed.")
+                       except:
                                self.unbind()
                                raise
-
-       def clean(self):
-               generic_stage_target.clean(self)
-               try:
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean","Clean runscript failed.")
-               except:
-                       self.unbind()
-                       raise
+                       touch(self.settings["chroot_path"]+"/tmp/.clean")
 
        def preclean(self):
-               try:
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" preclean","Preclean runscript failed.")
-               except:
-                       self.unbind()
-                       raise
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.preclean"):
+                       print "Detected resume point, skipping preclean operation..."
+               
+               else:
+                       try:
+                               cmd("/bin/bash "+self.settings["livecd/runscript"]+" preclean",
+                                       "Preclean runscript failed.")
+                       
+                       except:
+                               self.unbind()
+                               raise
+                       touch(self.settings["chroot_path"]+"/tmp/.preclean")
 
        def cdroot_setup(self):
-               cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","CDFS runscript failed.")
-               if self.settings.has_key("livecd/overlay"):
-                       cmd("/bin/cp -a "+self.settings["livecd/overlay"]+"/* "+self.settings["cdroot_path"],
-                                       "LiveCD overlay copy failed.") 
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.cdroot_setup"):
+                       print "Detected resume point, skipping cdroot setup..."
+               
+               else:
+                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","CDFS runscript failed.")
+                       if self.settings.has_key("livecd/overlay"):
+                               cmd("/bin/cp -a "+self.settings["livecd/overlay"]+"/* "+\
+                                       self.settings["cdroot_path"],"LiveCD overlay copy failed.")
+                                       
+                       touch(self.settings["chroot_path"]+"/tmp/.cdroot_setup")
+               
+               # create the ISO - this is the preferred method (the iso scripts do not always work)
                if self.settings.has_key("livecd/iso"):
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" iso "+self.settings["livecd/iso"],"ISO creation runscript failed.")
+                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" iso "+\
+                               self.settings["livecd/iso"],"ISO creation runscript failed.")
+               
                print "livecd-stage2: complete!"
 
-       def run_local(self):
-               #first clean up any existing cdroot stuff
-               if os.path.exists(self.settings["cdroot_path"]):
-                       print "cleaning previous livecd-stage2 build"
-                       cmd("rm -rf "+self.settings["cdroot_path"],"Could not remove existing directory: "+self.settings["cdroot_path"])
-               os.makedirs(self.settings["cdroot_path"])
-               #now, start building the kernel
+       def build_kernel(self):
                mynames=self.settings["boot/kernel"]
                if type(mynames)==types.StringType:
                        mynames=[mynames]
                args=[]
                args.append(`len(mynames)`)
+               
                for kname in mynames:
                        args.append(kname)
                        args.append(self.settings["boot/kernel/"+kname+"/sources"])
                        try:
                                if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
                                        self.unbind()
-                                       raise CatalystError, "Can't find kernel config: "+self.settings["boot/kernel/"+kname+"/config"]
+                                       raise CatalystError, "Can't find kernel config: " \
+                                               +self.settings["boot/kernel/"+kname+"/config"]
+                       
                        except TypeError:
                                raise CatalystError, "Required value boot/kernel/config not specified"
-
-                       # We must support multiple configs for the same kernel,
-                       # so we must manually edit the EXTRAVERSION on the kernel to allow them to coexist.
-                       # The extraversion field gets appended to the current EXTRAVERSION
-                       # in the kernel Makefile.  Examples of this usage are UP vs SMP kernels,
-                       # and on PPC64 we need a seperate pSeries, iSeries, and PPC970 (G5) kernels,
-                       # all compiled off the same source, without having to release a seperate 
-                       # livecd for each (since other than the kernel, they are all binary compatible)
+                       
+                       """
+                       We must support multiple configs for the same kernel,
+                       so we must manually edit the EXTRAVERSION on the kernel to allow them to coexist.
+                       The extraversion field gets appended to the current EXTRAVERSION
+                       in the kernel Makefile.  Examples of this usage are UP vs SMP kernels,
+                       and on PPC64 we need a seperate pSeries, iSeries, and PPC970 (G5) kernels,
+                       all compiled off the same source, without having to release a seperate 
+                       livecd for each (since other than the kernel, they are all binary compatible)
+                       """
                        if self.settings.has_key("boot/kernel/"+kname+"/extraversion"):
                                # extraversion is now an optional parameter, so that don't need to
                                # worry about it unless they have to
                                args.append(self.settings["boot/kernel/"+kname+"/extraversion"])
+                       
                        else:
                                # this value will be detected on the bash side and indicate
                                # that EXTRAVERSION processing
                                # should be skipped
                                args.append("NULL_VALUE")
+                       
                        # write out /var/tmp/kname.(use|packages) files, used for kernel USE
                        # and extra packages settings
                        for extra in ["use","packages","gk_kernargs"]:
@@ -149,6 +211,7 @@ class livecd_stage2_target(generic_stage_target):
                                        except:
                                                self.unbind()
                                                raise CatalystError,"Couldn't create file /var/tmp/"+kname+"."+extra+" in chroot."
+                                       # write out to the file 
                                        if extra=="use":
                                                myf.write("export USE=\""+myex+"\"\n")
                                        if extra=="gk_kernargs":
@@ -156,40 +219,86 @@ class livecd_stage2_target(generic_stage_target):
                                        else:
                                                myf.write(myex+"\n")
                                        myf.close()
-                                       
-                       retval=os.system("cp "+self.settings["boot/kernel/"+kname+"/config"]+" "+self.settings["chroot_path"]+"/var/tmp/"+kname+".config")
-                       if retval!=0:
+                       try:
+                               cmd("cp "+self.settings["boot/kernel/"+kname+"/config"]+" "+ \
+                                       self.settings["chroot_path"]+"/var/tmp/"+kname+".config", \
+                                       "Couldn't copy kernel config: "+self.settings["boot/kernel/"+kname+"/config"])
+               
+                       except CatalystError:
                                self.unbind()
-                               raise CatalystError, "Couldn't copy kernel config: "+self.settings["boot/kernel/"+kname+"/config"]
 
                        # If we need to pass special options to the bootloader
                        # for this kernel put them into the environment.
                        if self.settings.has_key("boot/kernel/"+kname+"/kernelopts"):
                                myopts=self.settings["boot/kernel/"+kname+"/kernelopts"]
+                               
                                if type(myopts) != types.StringType:
                                        myopts = string.join(myopts)
                                os.putenv(kname+"_kernelopts", myopts)
+
                        else:
                                os.putenv(kname+"_kernelopts", "")
-                       
+
+                       # execute the script that builds the kernel
+                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" kernel "+list_bashify(args),
+                               "Runscript kernel build failed")
+
+       def run_local(self):
+               # first clean up any existing cdroot stuff
+               # unless of course we are resuming
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_cdroot_clean"):
+                       print "Detected resume point, not cleaning cdroot_path..."
+               
+               else:
+                       if os.path.exists(self.settings["cdroot_path"]):
+                               print "cleaning previous livecd-stage2 build"
+                               cmd("rm -rf "+self.settings["cdroot_path"],
+                                       "Could not remove existing directory: "+self.settings["cdroot_path"])
+                       else:
+                               os.makedirs(self.settings["cdroot_path"])
+                               touch(self.settings["chroot_path"]+"/tmp/.run_local_cdroot_clean")
+                               
+               # the runscripts do the real building, so execute them now
+               # this is the part that we want to resume on since it is the most time consuming
                try:
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" kernel "+list_bashify(args),"Runscript kernel build failed")
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader","Bootloader runscript failed.")
+                       if self.settings.has_key("AUTORESUME") \
+                               and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_kernel_script"):
+                               print "Resume point detected, skipping kernel build runscript..."
+                       
+                       else:
+                               self.build_kernel()
+                               touch(self.settings["chroot_path"]+"/tmp/.run_local_kernel_script")
+                       
+                       if self.settings.has_key("AUTORESUME") \
+                               and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_bootloader_script"):
+                               print "Resume point detected, skipping bootloader runscript..."
+                       
+                       else:
+                               cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader","Bootloader runscript failed.")
+                               touch(self.settings["chroot_path"]+"/tmp/.run_local_bootloader_script")
+               
                except CatalystError:
                        self.unbind()
                        raise CatalystError,"Runscript aborting due to error."
 
                # what modules do we want to blacklist?
-               if self.settings.has_key("livecd/modblacklist"):
-                       try:
-                               myf=open(self.settings["chroot_path"]+"/etc/hotplug/blacklist","a")
-                       except:
-                               self.unbind()
-                               raise CatalystError,"Couldn't open "+self.settings["chroot_path"]+"/etc/hotplug/blacklist."
-                       myf.write("\n#Added by Catalyst:")
-                       for x in self.settings["livecd/modblacklist"]:
-                               myf.write("\n"+x)
-                       myf.close()
+               if self.settings.has_key("AUTORESUME") \
+                               and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_blacklist"):
+                               print "Resume point detected, skipping module blacklisting..."
+               
+               else:
+                       if self.settings.has_key("livecd/modblacklist"):
+                               try:
+                                       myf=open(self.settings["chroot_path"]+"/etc/hotplug/blacklist","a")
+                               except:
+                                       self.unbind()
+                                       raise CatalystError,"Couldn't open "+self.settings["chroot_path"]+"/etc/hotplug/blacklist."
+                               myf.write("\n#Added by Catalyst:")
+                               for x in self.settings["livecd/modblacklist"]:
+                                       myf.write("\n"+x)
+                               myf.close()
+                       touch(self.settings["chroot_path"]+"/tmp/.run_local_blacklist")
 
 def register(foo):
        foo.update({"livecd-stage2":livecd_stage2_target})
index 2dff87caed295b9da3d0d281df74accb7eaba9fd..16df2a57237d79790ad6e6b25a058d20881c77ea 100644 (file)
@@ -1,15 +1,14 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.2 2004/06/02 06:35:29 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.3 2004/07/03 00:33:37 zhen Exp $
 
 """
 Builder class for snapshots.
 """
 
-import os,string,imp,types,shutil
+import os
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class snapshot_target(generic_target):
        def __init__(self,myspec,addlargs):
@@ -29,17 +28,24 @@ class snapshot_target(generic_target):
 
        def run(self):
                self.setup()
-               print "Creating Portage tree snapshot "+self.settings["version_stamp"]+" from "+self.settings["portdir"]+"..."
+               print "Creating Portage tree snapshot "+self.settings["version_stamp"]+\
+                       " from "+self.settings["portdir"]+"..."
+               
                mytmp=self.settings["tmp_path"]
                if not os.path.exists(mytmp):
                        os.makedirs(mytmp)
                
-               cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure")
+               cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+\
+                       self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure")
+               
                if self.settings.has_key("portdir_overlay"):
-                       cmd("rsync -a --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+self.settings["portdir_overlay"]+"/ "+mytmp+"/portage/","Snapshot/ overlay addition failure")
+                       print "Adding Portage overlay to the snapshot..."
+                       cmd("rsync -a --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+\
+                               self.settings["portdir_overlay"]+"/ "+mytmp+"/portage/","Snapshot/ overlay addition failure")
                        
                print "Compressing Portage snapshot tarball..."
-               cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage","Snapshot creation failure")
+               cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
+                       "Snapshot creation failure")
                self.cleanup()
                print "snapshot: complete!"
 
index 57661fe35148125df4878dbb55b280072cabfa13..a7bc9d64e8a2373dd41190dfc080b65894e28fba 100644 (file)
@@ -1,15 +1,13 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage1_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage1_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
 """
 Builder class for a stage1 installation tarball build.
 """
 
-import os,string,imp,types,shutil
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class stage1_target(generic_stage_target):
        def __init__(self,spec,addlargs):
index 472d09c5df15353c5798046eb0c889b660acd9e4..f4c176ce9e6dbf62b54e74eb47b5271a392b517f 100644 (file)
@@ -1,15 +1,13 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage2_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage2_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
 """
 Builder class for a stage2 installation tarball build.
 """
 
-import os,string,imp,types,shutil
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class stage2_target(generic_stage_target):
        def __init__(self,spec,addlargs):
index abbf0124ec087e135d477ca0039307542aa18f6f..2e4be44170f94c45988fecf510e2f194fae112a8 100644 (file)
@@ -1,15 +1,13 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage3_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage3_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
 """
 Builder class for a stage3 installation tarball build.
 """
 
-import os,string,imp,types,shutil
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class stage3_target(generic_stage_target):
        def __init__(self,spec,addlargs):
index 931d3e8792e7cd2081d26efe4b81202fbaf299f3..6f132f357253e755097b71fade61ea721fda8f15 100644 (file)
@@ -1,11 +1,9 @@
 # Distributed under the GNU General Public License version 2
 # Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/tinderbox_target.py,v 1.1 2004/05/17 01:21:17 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/tinderbox_target.py,v 1.2 2004/07/03 00:33:37 zhen Exp $
 
-import os,string,imp,types,shutil
 from catalyst_support import *
 from generic_stage_target import *
-from stat import *
 
 class tinderbox_target(generic_stage_target):
        def __init__(self,spec,addlargs):
@@ -14,10 +12,13 @@ class tinderbox_target(generic_stage_target):
                generic_stage_target.__init__(self,spec,addlargs)
 
        def run_local(self):
-               #tinderbox
-               #example call: "grp.sh run xmms vim sys-apps/gleep"
+               # tinderbox
+               # example call: "grp.sh run xmms vim sys-apps/gleep"
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/tinderbox/tinderbox.sh run "+list_bashify(self.settings["tinderbox/packages"]))
+                       cmd("/bin/bash "+self.settings["sharedir"]+\
+                               "/targets/tinderbox/tinderbox.sh run "+\
+                               list_bashify(self.settings["tinderbox/packages"]))
+               
                except CatalystError:
                        self.unbind()
                        raise CatalystError,"Tinderbox aborting due to error."
index b002a6e4d9054f51767e00770018604c99137c00..4906e8fc26e798538e4dad2c68675afbb60b7cc4 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2003 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.13 2004/06/04 14:03:46 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.14 2004/07/03 00:33:37 zhen Exp $
 
 case $1 in
        enter)
@@ -39,7 +39,7 @@ case $1 in
        
        clean)
                #clean runs after preclean with bind mounts unmounted
-               keepers="sys-kernel/linux-headers sys-devel/binutils sys-devel/gcc sys-apps/baselayout sys-libs/glibc virtual/glibc virtual/kernel"
+               keepers="virtual/os-headers sys-devel/binutils sys-devel/gcc virtual/baselayout sys-libs/glibc virtual/libc virtual/kernel"
                # set everything to uid 999 (nouser)
                cd ${clst_chroot_path}/tmp/stage1root
                install -d var/db/pkg2