Added patch from Daniel Ostrow <dostrow@gentoo.org> for added FreeBSD goodness wrt...
authorChris Gianelloni <wolf31o2@gentoo.org>
Wed, 22 Nov 2006 14:44:45 +0000 (14:44 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Wed, 22 Nov 2006 14:44:45 +0000 (14:44 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1186 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/generic_stage_target.py
modules/stage1_target.py

index 650518426b0050cd14e9301368f309daafe80407..49bb7c6e0aa11e6caa3ba9be8c02fa5f5620bf38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
 # $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.664 2006/10/02 20:41:53 wolf31o2 Exp $
 
+  22 Nov 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  modules/generic_stage_target.py, modules/stage1_target.py:
+  Added patch from Daniel Ostrow <dostrow@gentoo.org> for added FreeBSD
+  goodness wrt bug #153587.
+
   03 Nov 2006; Chris Gianelloni <wolf31o2@gentoo.org>
   livecd/files/x86-F3.msg, livecd/files/x86-F4.msg, livecd/files/x86-F5.msg:
   Changed dobladecenter to slowusb.  Thanks to solar for pointing this out.
index 2d5c8537cf01b87fe351fe9863c87a26f1ab9003..8a480dfd0f29b1fa380763f5cfc9573fcb7cb034 100644 (file)
@@ -13,13 +13,13 @@ import catalyst_lock
 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.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","cflags","cxxflags",\
-                       "ldflags","chost","hostuse","portage_overlay","distcc_hosts","makeopts",\
-                       "pkgcache_path","kerncache_path"])
+               self.valid_values.extend(["version_stamp","target","subarch",\
+                       "rel_type","profile","snapshot","source_subpath","portage_confdir",\
+                       "cflags","cxxflags","ldflags","chost","hostuse","portage_overlay",\
+                       "distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
                
                self.set_valid_build_kernel_vars(addlargs)
                generic_target.__init__(self,myspec,addlargs)
@@ -82,25 +82,27 @@ class generic_stage_target(generic_target):
                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
                try:
-                        self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
+                       self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
                 except:
-                        print "Invalid subarch: "+self.settings["subarch"]
-                        print "Choose one of the following:",
-                        for x in self.subarchmap:
-                                print x,
+                       print "Invalid subarch: "+self.settings["subarch"]
+                       print "Choose one of the following:",
+                       for x in self.subarchmap:
+                               print x,
                        print
-                        sys.exit(2)
-       
+                       sys.exit(2)
+
                print "Using target:",self.settings["target"]
                # self.settings["mainarch"] should now be set by our arch constructor,
                # so we print a nice informational message:
@@ -400,8 +402,9 @@ class generic_stage_target(generic_target):
        def set_action_sequence(self):
                #Default action sequence for run method
                self.settings["action_sequence"]=["unpack","unpack_snapshot",\
-                               "config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
-                               "setup_environment","run_local","preclean","unbind","clean"]
+                               "config_profile_link","setup_confdir","portage_overlay",\
+                               "base_dirs","bind","chroot_setup","setup_environment",\
+                               "run_local","preclean","unbind","clean"]
                if not self.settings.has_key("TARBALL"):
                        self.settings["action_sequence"].append("capture")
                self.settings["action_sequence"].append("clear_autoresume")
@@ -763,6 +766,9 @@ class generic_stage_target(generic_target):
                                        cmd("rsync -a "+x+"/ "+\
                                                self.settings["chroot_path"], self.settings["spec_prefix"]+"/root_overlay: "+x+" copy failed.",env=self.env)
 
+       def base_dirs(self):
+               pass
+
        def bind(self):
                for x in self.mounts: 
                        if not os.path.exists(self.settings["chroot_path"]+x):
index 3cb12d42eb6629d3ef792194cda26cf2a7bf1334..90478d23b63e055dfc233c1b3e2744829624407e 100644 (file)
@@ -57,6 +57,32 @@ class stage1_target(generic_stage_target):
                        print "\tIf you break it, you buy it. Don't complain to us about it."
                        print "\tDont say we did not warn you\n"
 
+       def base_dirs(self):
+               if os.uname()[0] == "FreeBSD":
+                       # baselayout no longer creates the .keep files in proc and dev for FreeBSD as it
+                       # would create them too late...we need them earlier before bind mounting filesystems
+                       # since proc and dev are not writeable, so...create them here
+                       if not os.path.exists(self.settings["stage_path"]+"/proc"):
+                               os.makedirs(self.settings["stage_path"]+"/proc")
+                       if not os.path.exists(self.settings["stage_path"]+"/dev"):
+                               os.makedirs(self.settings["stage_path"]+"/dev")
+                       if not os.path.isfile(self.settings["stage_path"]+"/proc/.keep"):
+                               try:
+                                       proc_keepfile = open(self.settings["stage_path"]+"/proc/.keep","w") 
+                                       proc_keepfile.write('')
+                                       proc_keepfile.close()
+                               except IOError:
+                                       print "!!! Failed to create %s" % (self.settings["stage_path"]+"/dev/.keep")
+                       if not os.path.isfile(self.settings["stage_path"]+"/dev/.keep"):
+                               try:
+                                       dev_keepfile = open(self.settings["stage_path"]+"/dev/.keep","w")
+                                       dev_keepfile.write('')
+                                       dev_keepfile.close() 
+                               except IOError:
+                                       print "!!! Failed to create %s" % (self.settings["stage_path"]+"/dev/.keep")
+               else:
+                       pass
+
        def set_mounts(self):
                # stage_path/proc probably doesn't exist yet, so create it
                if not os.path.exists(self.settings["stage_path"]+"/proc"):