[79852] contrib/mpab/mpsync.sh

jmr at macports.org jmr at macports.org
Mon Jun 27 22:21:20 PDT 2011


Revision: 79852
          http://trac.macports.org/changeset/79852
Author:   jmr at macports.org
Date:     2011-06-27 22:21:20 -0700 (Mon, 27 Jun 2011)
Log Message:
-----------
mpab: update mpsync.sh to allow chrootless operation

Modified Paths:
--------------
    contrib/mpab/mpsync.sh

Modified: contrib/mpab/mpsync.sh
===================================================================
--- contrib/mpab/mpsync.sh	2011-06-28 05:06:22 UTC (rev 79851)
+++ contrib/mpab/mpsync.sh	2011-06-28 05:21:20 UTC (rev 79852)
@@ -10,25 +10,40 @@
 if [[ -n "$MPAB_DATA" ]]; then
    dataDir=$MPAB_DATA
 fi
+if [[ -z "$PREFIX" ]]; then
+   PREFIX=/opt/local
+fi
 if [[ -z "$SRC_PREFIX" ]]; then
    SRC_PREFIX=/opt/mports
 fi
 
 chrootPath="${dataDir}/${CHROOTSUBDIR}"
+OSMajor=`uname -r | sed 's/\..*//'`
+# xcodebuild breaks in chroots on 10.6
+if [[ $1 = "-n" || $OSMajor -ge 10 ]]; then
+    chrootPath=""
+    if [[ $1 = "-n" ]]; then
+        shift
+    fi
+fi
 
 # $1 - script to execute
 function chroot_exec () {
-    cp -p ${baseDir}/chroot-scripts/$1 ${chrootPath}/var/tmp/
-    # Set DYLD_NO_FIX_PREBINDING as otherwise, on 10.5, dyld will spew
-    # errors to syslog/console log like:
-    # com.apple.launchd[1] (com.apple.dyld): Throttling respawn: Will start in 10 seconds
-    env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin HOME=/var/root DYLD_NO_FIX_PREBINDING=1 /usr/sbin/chroot ${chrootPath} /bin/sh /var/tmp/$1
+    cp -p ${baseDir}/chroot-scripts/$1 ${chrootPath}/var/tmp
+    if [[ -n "$chrootPath" ]]; then
+        # Set DYLD_NO_FIX_PREBINDING as otherwise, on 10.5, dyld will spew
+        # errors to syslog/console log like:
+        # com.apple.launchd[1] (com.apple.dyld): Throttling respawn: Will start in 10 seconds
+        env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin HOME=/var/root DYLD_NO_FIX_PREBINDING=1 PREFIX=${PREFIX} SRC_PREFIX=${SRC_PREFIX} /usr/sbin/chroot ${chrootPath} /bin/sh /var/tmp/$1
+    else
+        env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin HOME=/var/root PREFIX=${PREFIX} SRC_PREFIX=${SRC_PREFIX} /bin/sh /var/tmp/$1
+    fi
     rm ${chrootPath}/var/tmp/$1
 }
 
 if [[ -d ${dataDir}/${exportDir} ]] ; then 
     svn update --non-interactive \
-	-r HEAD ${dataDir}/${exportDir} \
+	-r HEAD ${dataDir}/${exportDir}/* \
 	> /dev/null || exit 1
 else
     echo "Checking out macports from svn..."
@@ -37,7 +52,7 @@
 	${dataDir}/${exportDir} > /dev/null || exit 1
 fi
 
-if [[ ! -d ${chrootPath} ]] ; then
+if [[ -n "$chrootPath" && ! -d "$chrootPath" ]] ; then
     sudo ${baseDir}/mpab mount || exit 1
     umount=yes
 fi
@@ -46,7 +61,7 @@
     ${dataDir}/${exportDir}/dports \
     ${chrootPath}${SRC_PREFIX} || exit 1
 
-echo "Re-creating portindex in chroot"
+echo "Re-creating portindex"
 chroot_exec recreateportindex
 
 if [[ "${umount}" = yes ]] ; then
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110627/249e0378/attachment.html>


More information about the macports-changes mailing list