From c02de7efe5df9c180ca9286edfdcf7c541d4ac49 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Wed, 22 Nov 2006 14:44:45 +0000 Subject: [PATCH] Added patch from Daniel Ostrow for added FreeBSD goodness wrt bug #153587. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1186 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 5 ++++ modules/generic_stage_target.py | 42 +++++++++++++++++++-------------- modules/stage1_target.py | 26 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65051842..49bb7c6e 100644 --- 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 + modules/generic_stage_target.py, modules/stage1_target.py: + Added patch from Daniel Ostrow for added FreeBSD + goodness wrt bug #153587. + 03 Nov 2006; Chris Gianelloni 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. diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 2d5c8537..8a480dfd 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -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): diff --git a/modules/stage1_target.py b/modules/stage1_target.py index 3cb12d42..90478d23 100644 --- a/modules/stage1_target.py +++ b/modules/stage1_target.py @@ -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"): -- 2.26.2