Added initial Gentoo/FreeBSD support. Patch from Diego Pettenò <flameeyes@gentoo...
authorChris Gianelloni <wolf31o2@gentoo.org>
Wed, 11 Oct 2006 13:51:41 +0000 (13:51 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Wed, 11 Oct 2006 13:51:41 +0000 (13:51 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1180 d1e1f19c-881f-0410-ab34-b69fee027534

AUTHORS
ChangeLog
modules/generic_stage_target.py
targets/stage1/stage1-controller.sh
targets/support/chroot-functions.sh

diff --git a/AUTHORS b/AUTHORS
index 4caceae155570a5d9d6bdcd4e522de2a05d36552..0679cc4df01a3e6b12ebb90dedd1a6d1613d9847 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -18,3 +18,4 @@ Matsuu Takuto <matsuu@gentoo.org>
 Joshua Kinard <kumba@gentoo.org>
 Lars Weiler <pylon@gentoo.org>
 Andrew Gaffney <agaffney@gentoo.org>
+Diego Pettenò <flameeyes@gentoo.org>
index a58e9e23cba84b898aa067509a4734480dad3a76..efb30091356a308d3b585dae138d03a1bfc37389 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 # 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 $
 
+  11 Oct 2006; Chris Gianelloni <wolf31o2@gentoo.org> AUTHORS,
+  modules/generic_stage_target.py, targets/stage1/stage1-controller.sh,
+  targets/support/chroot-functions.sh:
+  Added initial Gentoo/FreeBSD support. Patch from Diego Pettenò
+  <flameeyes@gentoo.org> and attached to bug #150351.
+
   02 Oct 2006; Chris Gianelloni <wolf31o2@gentoo.org> README, arch/alpha.py,
   arch/amd64.py, arch/arm.py, arch/hppa.py, arch/ia64.py, arch/mips.py,
   arch/ppc.py, arch/ppc64.py, arch/s390.py, arch/sh.py, arch/sparc.py,
index c20defad3c5aeb8ddb11bd6ad92ba55bcc535429..b5b2e7ece176a5c4e771eb5204cda2b3663b8605 100644 (file)
@@ -162,14 +162,16 @@ class generic_stage_target(generic_target):
                
                # setup our mount points
                if self.settings.has_key("SNAPCACHE"):
-                       self.mounts=[ "/proc","/dev","/dev/pts","/usr/portage","/usr/portage/distfiles" ]
+                       self.mounts=[ "/proc","/dev","/usr/portage","/usr/portage/distfiles" ]
                        self.mountmap={"/proc":"/proc", "/dev":"/dev", "/dev/pts":"/dev/pts",\
                                "/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\
                                "/usr/portage/distfiles":self.settings["distdir"]}
                else:
-                       self.mounts=[ "/proc","/dev","/dev/pts","/usr/portage/distfiles" ]
+                       self.mounts=[ "/proc","/dev","/usr/portage/distfiles" ]
                        self.mountmap={"/proc":"/proc", "/dev":"/dev", "/dev/pts":"/dev/pts",\
                                "/usr/portage/distfiles":self.settings["distdir"]}
+               if os.uname()[0] == "Linux":
+                       self.mounts.append("/dev/pts")
 
                self.set_mounts()
 
@@ -769,7 +771,13 @@ class generic_stage_target(generic_target):
                        src=self.mountmap[x]
                        if self.settings.has_key("SNAPCACHE") and x == "/usr/portage":
                                self.snapshot_lock_object.read_lock()
-                       retval=os.system("mount --bind "+src+" "+self.settings["chroot_path"]+x)
+                       if os.uname()[0] == "FreeBSD":
+                               if src == "/dev":
+                                       retval=os.system("mount -t devfs none "+self.settings["chroot_path"]+x)
+                               else:
+                                       retval=os.system("mount_nullfs "+src+" "+self.settings["chroot_path"]+x)
+                       else:
+                               retval=os.system("mount --bind "+src+" "+self.settings["chroot_path"]+x)
                        if retval!=0:
                                self.unbind()
                                raise CatalystError,"Couldn't bind mount "+src
@@ -789,7 +797,7 @@ class generic_stage_target(generic_target):
                                # it's not mounted, continue
                                continue
                        
-                       retval=os.system("umount "+mypath+x)
+                       retval=os.system("umount "+os.path.join(mypath,x.lstrip(os.path.sep)))
                        
                        if retval!=0:
                                warn("First attempt to unmount: "+mypath+x+" failed.")
@@ -1282,6 +1290,8 @@ class generic_stage_target(generic_target):
                    # the proper perms and ownership
                    mystat=os.stat(myemp)
                    #cmd("rm -rf "+myemp, "Could not remove existing file: "+myemp,env=self.env)
+                   if os.uname()[0] == "FreeBSD": # There's no easy way to change flags recursively in python
+                           os.system("chflags -R noschg "+myemp)
                    shutil.rmtree(myemp)
                    os.makedirs(myemp,0755)
                    os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
index 2a264e3e9f1c9aae6763ef304d142b3535dc2013..52f815878c2d53587d2590ddcac92361b076bff2 100755 (executable)
@@ -55,10 +55,10 @@ case $1 in
                # Clean out man, info and doc files
                rm -rf usr/share/{man,doc,info}/*
                # Zap all .pyc and .pyo files
-               find -iname "*.py[co]" -exec rm -f {} \;
+               find -iname "*.py[co]" -exec rm -f {} \;
                # Cleanup all .a files except libgcc.a, *_nonshared.a and
                # /usr/lib/portage/bin/*.a
-               find -type f -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' \
+               find -type f -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' \
                        | grep -v '/usr/lib/portage/bin/' | grep -v 'libgcc_eh.a' | xargs \
                        rm -f
        ;;
index 63b72578701ad4110d9f48dfdacf2c7a8e70fe3a..43ff04742cf41f78678a0a92ead8dbc335f4ee31 100755 (executable)
@@ -214,7 +214,11 @@ function copy_symlink() {
        [ ! -e ${clst_root_path}/${1} ] && \
                cp -vfdp ${1} ${clst_root_path}/${1}
        
-       TARGET=`readlink -f ${1}`
+       if [[ -n $(type -p realpath) ]]; then
+           TARGET=`realpath ${1}`
+       else
+           TARGET=`readlink -f ${1}`
+       fi
        if [ -h ${TARGET} ]
        then
                copy_symlink ${TARGET} ${STACK}