[darwinbuild-changes] [505] trunk/darwinbuild/darwinbuild.in

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 17 13:41:22 PDT 2009


Revision: 505
          http://trac.macosforge.org/projects/darwinbuild/changeset/505
Author:   wsiegrist at apple.com
Date:     2009-04-17 13:41:22 -0700 (Fri, 17 Apr 2009)
Log Message:
-----------
New HFXS sparse image support. Use it by default to work around Xcode/chroot problems.

Modified Paths:
--------------
    trunk/darwinbuild/darwinbuild.in

Modified: trunk/darwinbuild/darwinbuild.in
===================================================================
--- trunk/darwinbuild/darwinbuild.in	2009-04-17 19:57:39 UTC (rev 504)
+++ trunk/darwinbuild/darwinbuild.in	2009-04-17 20:41:22 UTC (rev 505)
@@ -80,6 +80,7 @@
 
 PREFIX=%%PREFIX%%
 XREFDB=.build/xref.db
+DMGFILE=.build/buildroot.sparsebundle
 DARWINXREF=$PREFIX/bin/darwinxref
 DATADIR=$PREFIX/share/darwinbuild
 COMMONFILE=$DATADIR/darwinbuild.common
@@ -132,6 +133,9 @@
 if [ "$1" == "-init" ]; then
 	if [ "$2" == "" ]; then
 		echo "usage: $(basename $0) -init <build>" 1>&2
+		echo "" 1>&2
+		echo "\t-nodmg \t do not use a sparse image for build root (use a regular directory)" 1>&2
+		echo "\t-nfs   \t use NFS over loopback to mount the build root (implies -nodmg)" 1>&2
 		exit 1
 	fi
 	build="$2"
@@ -154,12 +158,34 @@
 
 	echo "$build" > .build/build
 
+        ###
+        ### Create the build root
+        ###
+	if [ "$3" == "-nfs" ]; then
+	    echo "NFS not implemented";
+	    exit 71;
+	elif [ "$3" == "-nodmg" ]; then
+	    mkdir -p BuildRoot
+	else
+	    echo "Creating build root disk image ..."
+	    stamp=$(date +'%Y%m%d%H%M%S')
+	    DMGVOLUME="BuildRoot_${build}_${stamp}"
+	    hdiutil create -size 1t -fs HFSX -quiet \
+		-volname $DMGVOLUME \
+		$DMGFILE
+	    ln -s "/Volumes/${DMGVOLUME}" BuildRoot
+	fi
+
+	###
+	### Download the build's plist and its parents
+	###
 	while [ "$build" != "" ]; do
 		Download .build "$build".plist "$sites ${DEFAULTPLISTSITE}"
 		$DARWINXREF "-f$XREFDB" "-b$build" loadIndex .build/"$build".plist
 		sites=$($DARWINXREF "-f$XREFDB" "-b$build" plist_sites | xargs echo)
 		build=$($DARWINXREF "-f$XREFDB" "-b$build" inherits)
 	done
+
 	echo "Initialization Complete"
 	exit 0
 fi
@@ -180,12 +206,22 @@
 ### Check that we're property situated in an initialized directory
 ###
 CheckDarwinBuildRoot
-
 BuildRoot="$DARWIN_BUILDROOT/BuildRoot"
-mkdir -p "$BuildRoot"
 export DARWINXREF_DB_FILE="$DARWIN_BUILDROOT/$XREFDB"
 
 ###
+### See if we need to attach a disk image or mount an NFS share
+###
+stat -L $BuildRoot >> /dev/null 2>&1
+if [ $? -eq 1 ]; then
+    echo "*** Attaching build root disk image ..."
+    hdiutil attach $DMGFILE -readwrite 
+    if [ $? -ne 0 ]; then
+	echo "Error: Unable to attach sparse disk image";
+    fi
+fi
+
+###
 ### Check and see wether there is a sources directory set in the
 ### environment ($DARWIN_SOURCES). If not we assign it the sources pass
 ### in the $DARWIN_BUILDROOT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20090417/31fe38a1/attachment.html>


More information about the darwinbuild-changes mailing list