[79836] contrib/mpab
jmr at macports.org
jmr at macports.org
Mon Jun 27 15:22:56 PDT 2011
Revision: 79836
http://trac.macports.org/changeset/79836
Author: jmr at macports.org
Date: 2011-06-27 15:22:56 -0700 (Mon, 27 Jun 2011)
Log Message:
-----------
mpab: make macports prefix and location to keep sources configurable
Modified Paths:
--------------
contrib/mpab/chroot-scripts/buildports
contrib/mpab/chroot-scripts/genportlist.tcl
contrib/mpab/chroot-scripts/installmacports
contrib/mpab/chroot-scripts/recreateportindex
contrib/mpab/mpab
contrib/mpab/mpab-functions
contrib/mpab/mpsync.sh
Modified: contrib/mpab/chroot-scripts/buildports
===================================================================
--- contrib/mpab/chroot-scripts/buildports 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/chroot-scripts/buildports 2011-06-27 22:22:56 UTC (rev 79836)
@@ -30,7 +30,9 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-PREFIX="/opt/local"
+if [[ -z "$PREFIX" ]]; then
+ PREFIX=/opt/local
+fi
ARCHIVE_TYPE=".tbz2"
function uninstallPorts()
Modified: contrib/mpab/chroot-scripts/genportlist.tcl
===================================================================
--- contrib/mpab/chroot-scripts/genportlist.tcl 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/chroot-scripts/genportlist.tcl 2011-06-27 22:22:56 UTC (rev 79836)
@@ -31,10 +31,13 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-set prefix /opt/local
+if {[info exists env(PREFIX)]} {
+ set prefix $env(PREFIX)
+} else {
+ set prefix /opt/local
+}
-catch {source \
- [file join ${prefix} share macports Tcl macports1.0 macports_fastload.tcl]}
+source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
package require macports
Modified: contrib/mpab/chroot-scripts/installmacports
===================================================================
--- contrib/mpab/chroot-scripts/installmacports 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/chroot-scripts/installmacports 2011-06-27 22:22:56 UTC (rev 79836)
@@ -3,9 +3,15 @@
# configure/build/install MacPorts in the chroot
#
-cd /opt/mports/base
-./configure && make all && make install && make distclean
+if [[ -z "$PREFIX" ]]; then
+ PREFIX=/opt/local
+fi
+if [[ -z "$SRC_PREFIX" ]]; then
+ SRC_PREFIX=/opt/mports
+fi
+
+cd ${SRC_PREFIX}/base
+./configure --prefix=${PREFIX} && make -j2 all && make install && make distclean
if [[ $? == 0 ]]; then
- echo "file:///opt/mports/dports [default]" > /opt/local/etc/macports/sources.conf
+ echo "file://${SRC_PREFIX}/dports [default]" > ${PREFIX}/etc/macports/sources.conf
fi
-
Modified: contrib/mpab/chroot-scripts/recreateportindex
===================================================================
--- contrib/mpab/chroot-scripts/recreateportindex 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/chroot-scripts/recreateportindex 2011-06-27 22:22:56 UTC (rev 79836)
@@ -3,5 +3,12 @@
# re-create the portindex
#
-cd /opt/mports/dports
-/opt/local/bin/portindex > /dev/null
+if [[ -z "$PREFIX" ]]; then
+ PREFIX=/opt/local
+fi
+if [[ -z "$SRC_PREFIX" ]]; then
+ SRC_PREFIX=/opt/mports
+fi
+
+cd ${SRC_PREFIX}/dports
+${PREFIX}/bin/portindex > /dev/null
Modified: contrib/mpab/mpab
===================================================================
--- contrib/mpab/mpab 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/mpab 2011-06-27 22:22:56 UTC (rev 79836)
@@ -30,6 +30,16 @@
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
+if [[ -z "$PREFIX" ]]; then
+ PREFIX=/opt/local
+fi
+export PREFIX
+# location to store base and dports sources
+if [[ -z "$SRC_PREFIX" ]]; then
+ SRC_PREFIX=/opt/mports
+fi
+export SRC_PREFIX
+
# Base filename for the disk image
IMGBASENAME="mproot"
@@ -122,9 +132,9 @@
trap "exitFunction ${dataDir} ${chrootPath}" EXIT
exitMessage="Stopping..."
if [[ ${command} == "rebuildmp" ]]; then
- rm -rf ${chrootPath}/opt/mports
+ rm -rf ${chrootPath}${SRC_PREFIX}
if [[ -n "$chrootPath" ]]; then
- rm -f ${chrootPath}/opt/local/bin/port
+ rm -f ${chrootPath}${PREFIX}/bin/port
fi
fi
Modified: contrib/mpab/mpab-functions
===================================================================
--- contrib/mpab/mpab-functions 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/mpab-functions 2011-06-27 22:22:56 UTC (rev 79836)
@@ -215,25 +215,25 @@
local chrootPath=$3
local mpExport=$4
- if [[ ! -d ${chrootPath}/opt/mports ]]; then
+ if [[ ! -d ${chrootPath}${SRC_PREFIX} ]]; then
if [[ -f ${dataDir}/${mpExport} ]]; then
- mkdir -p ${chrootPath}/opt/mports
+ mkdir -p ${chrootPath}${SRC_PREFIX}
echo ${mpExport} | grep -q "MacPorts-......tar.gz"
if [[ $? == 0 ]]; then
- cp ${mpExport} ${chrootPath}/opt/mports
- cd ${chrootPath}/opt/mports
+ cp ${mpExport} ${chrootPath}${SRC_PREFIX}
+ cd ${chrootPath}${SRC_PREFIX}
tar xzf ${mpExport} || return 1
rm -rf base 2>/dev/null
mv $(ls -d MacPorts-?.?.?) base || return 1
else
- cd ${chrootPath}/opt/mports
+ cd ${chrootPath}${SRC_PREFIX}
bunzip2 -c ${dataDir}/${mpExport} | tar xf -
fi
cd - > /dev/null
elif [[ -d ${dataDir}/${mpExport} ]]; then
- mkdir -p ${chrootPath}/opt/mports
+ mkdir -p ${chrootPath}${SRC_PREFIX}
cd ${dataDir}/${mpExport} && \
- rsync -r --del --exclude '*~' --exclude '.svn' . ${chrootPath}/opt/mports
+ rsync -r --del --exclude '*~' --exclude '.svn' . ${chrootPath}${SRC_PREFIX}
cd - > /dev/null
else
echo "No ${mpExport} found"
@@ -241,7 +241,7 @@
fi
fi
- if [[ ! -f ${chrootPath}/opt/local/bin/port ]]; then
+ if [[ ! -f ${chrootPath}${PREFIX}/bin/port ]]; then
chrootExec installmacports
fi
@@ -344,8 +344,8 @@
mount_devfs devfs ${chrootPath}/dev
mount_fdesc -o union fdesc ${chrootPath}/dev
- mkdir -p ${chrootPath}/opt/local/var/macports/distfiles
- hdiutil attach ${baseDir}/${imgBaseName}_distcache.sparseimage -mountpoint ${chrootPath}/opt/local/var/macports/distfiles -noverify -owners on -nobrowse -noautofsck ${HDIUTILDEBUG}
+ mkdir -p ${chrootPath}${PREFIX}/var/macports/distfiles
+ hdiutil attach ${baseDir}/${imgBaseName}_distcache.sparseimage -mountpoint ${chrootPath}${PREFIX}/var/macports/distfiles -noverify -owners on -nobrowse -noautofsck ${HDIUTILDEBUG}
returnValue=$?
if [[ ${returnValue} != 0 ]]; then
echo "Failed to attach distfiles image"
@@ -374,9 +374,9 @@
# And again for the devfs
umount -f ${chrootPath}/dev
fi
- if [[ -d ${chrootPath}/opt/local/var/macports/distfiles ]]; then
+ if [[ -d ${chrootPath}${PREFIX}/var/macports/distfiles ]]; then
# Now the cache image for the dist files
- hdiutil detach ${chrootPath}/opt/local/var/macports/distfiles ${HDIUTILDEBUG}
+ hdiutil detach ${chrootPath}${PREFIX}/var/macports/distfiles ${HDIUTILDEBUG}
fi
if [[ -d ${chrootPath} ]]; then
# Finally, the main image itself
@@ -398,9 +398,9 @@
# 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
+ 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 /bin/sh /var/tmp/$1
+ 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
}
Modified: contrib/mpab/mpsync.sh
===================================================================
--- contrib/mpab/mpsync.sh 2011-06-27 22:22:18 UTC (rev 79835)
+++ contrib/mpab/mpsync.sh 2011-06-27 22:22:56 UTC (rev 79836)
@@ -7,9 +7,12 @@
baseDir=$(dirname $0)
dataDir=$(pwd)
-if [[ $MPAB_DATA ]]; then
+if [[ -n "$MPAB_DATA" ]]; then
dataDir=$MPAB_DATA
fi
+if [[ -z "$SRC_PREFIX" ]]; then
+ SRC_PREFIX=/opt/mports
+fi
chrootPath="${dataDir}/${CHROOTSUBDIR}"
@@ -34,14 +37,14 @@
${dataDir}/${exportDir} > /dev/null || exit 1
fi
-if [[ ! -d ${dataDir}/mpchroot ]] ; then
+if [[ ! -d ${chrootPath} ]] ; then
sudo ${baseDir}/mpab mount || exit 1
umount=yes
fi
rsync -r --del --exclude '*~' --exclude '.svn' \
${dataDir}/${exportDir}/dports \
- ${dataDir}/mpchroot/opt/mports || exit 1
+ ${chrootPath}${SRC_PREFIX} || exit 1
echo "Re-creating portindex in chroot"
chroot_exec recreateportindex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110627/a61d59bd/attachment.html>
More information about the macports-changes
mailing list