[71438] contrib/mpab
jmr at macports.org
jmr at macports.org
Sun Sep 12 22:33:59 PDT 2010
Revision: 71438
http://trac.macports.org/changeset/71438
Author: jmr at macports.org
Date: 2010-09-12 22:33:56 -0700 (Sun, 12 Sep 2010)
Log Message:
-----------
mpab: add chroot-less mode, update/generalise macports.conf editing regexes
Modified Paths:
--------------
contrib/mpab/mpab
contrib/mpab/mpab-functions
Modified: contrib/mpab/mpab
===================================================================
--- contrib/mpab/mpab 2010-09-13 04:44:25 UTC (rev 71437)
+++ contrib/mpab/mpab 2010-09-13 05:33:56 UTC (rev 71438)
@@ -49,7 +49,7 @@
fi
chrootPath="${dataDir}/${CHROOTSUBDIR}"
-if [[ -n ${MPABDEBUG} ]]; then
+if [[ -n "${MPABDEBUG}" ]]; then
HDIUTILDEBUG="-verbose"
else
HDIUTILDEBUG="-quiet"
@@ -58,6 +58,17 @@
. ${baseDir}/mpab-functions
+# option parsing
+OSMajor=`uname -r | sed 's/\..*//'`
+# xcodebuild breaks in chroots on 10.6
+if [[ $1 = "-n" -o $OSMajor -ge 10 ]]; then
+ chrootPath=""
+ echo "Warning: not using chroot"
+ if [[ $1 = "-n" ]]; then
+ shift
+ fi
+fi
+
command="buildports"
portlistFile=""
if [[ -n $1 ]]; then
@@ -101,16 +112,20 @@
if [[ ${command} == "mount" || ${command} == "buildmp" ||
${command} == "rebuildmp" || ${command} == "buildports" ]]; then
- buildImages ${dataDir} ${chrootPath} ${IMGBASENAME}
- mountChroot ${dataDir} ${chrootPath} ${IMGBASENAME}
- if [[ $? == 0 &&
+ if [[ -n "$chrootPath" ]]; then
+ buildImages ${dataDir} ${chrootPath} ${IMGBASENAME}
+ mountChroot ${dataDir} ${chrootPath} ${IMGBASENAME}
+ fi
+ if [[ ( $? == 0 || -n "$chrootPath" ) &&
( ${command} == "buildmp" || ${command} == "rebuildmp" ||
${command} == "buildports" ) ]]; then
trap "exitFunction ${dataDir} ${chrootPath}" EXIT
exitMessage="Stopping..."
if [[ ${command} == "rebuildmp" ]]; then
rm -rf ${chrootPath}/opt/mports
- rm -f ${chrootPath}/opt/local/bin/port
+ if [[ -n "$chrootPath" ]]; then
+ rm -f ${chrootPath}/opt/local/bin/port
+ fi
fi
if [[ -n ${installPackage} ]]; then
Modified: contrib/mpab/mpab-functions
===================================================================
--- contrib/mpab/mpab-functions 2010-09-13 04:44:25 UTC (rev 71437)
+++ contrib/mpab/mpab-functions 2010-09-13 05:33:56 UTC (rev 71438)
@@ -93,7 +93,7 @@
if [[ -d ${chrootPath}/var/tmp/portresults/fail ]]; then
moveAndReport ${baseDir} ${chrootPath}
fi
- if [[ -d ${chrootPath} ]]; then
+ if [[ -n "$chrootPath" && -d ${chrootPath} ]]; then
umountChroot ${chrootPath}
fi
}
@@ -110,6 +110,10 @@
local chrootPath=$2
local imgBaseName=$3
+ if [[ -z "$chrootPath" ]]; then
+ return 0
+ fi
+
echo "Building MP chroot images, if necessary"
# Paths to create within the chroot
@@ -241,7 +245,10 @@
chrootExec installmacports
- sed 's/portarchivemode.*no/portarchivemode yes/' ${chrootPath}/opt/local/etc/macports/macports.conf > ${chrootPath}/opt/local/etc/macports/macports.conf.new
+ sed -E -e 's/#?portarchivemode.*no/portarchivemode yes/' \
+ -e 's/#?portarchivetype.*tgz/portarchivetype tbz2/' \
+ ${chrootPath}/opt/local/etc/macports/macports.conf \
+ > ${chrootPath}/opt/local/etc/macports/macports.conf.new
mv ${chrootPath}/opt/local/etc/macports/macports.conf.new ${chrootPath}/opt/local/etc/macports/macports.conf
fi
@@ -321,6 +328,10 @@
local chrootPath=$2
local imgBaseName=$3
+ if [[ -z "$chrootPath" ]]; then
+ return 0
+ fi
+
echo "Mounting chroot images"
mkdir -p ${chrootPath}
@@ -359,6 +370,10 @@
{
local chrootPath=$1
+ if [[ -z "$chrootPath" ]]; then
+ return 0
+ fi
+
if [[ -d ${chrootPath}/dev ]]; then
# First for the fdesc
umount -f ${chrootPath}/dev
@@ -385,10 +400,14 @@
# $1 - script to execute
function chrootExec () {
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
+ 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 /usr/sbin/chroot ${chrootPath} /bin/sh /var/tmp/$1
+ else
+ env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin HOME=/var/root /bin/sh /var/tmp/$1
+ fi
rm ${chrootPath}/var/tmp/$1
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100912/673c3f74/attachment-0001.html>
More information about the macports-changes
mailing list