Re: "tinderbox" using stacked unionfs
- From: David Naylor <naylor.b.david@xxxxxxxxx>
- Date: Tue, 26 Jan 2010 18:41:20 +0200
On Tuesday 26 January 2010 15:04:59 Gary Jennejohn wrote:
On Mon, 25 Jan 2010 20:39:11 +0200
David Naylor <naylor.b.david@xxxxxxxxx> wrote:
On Saturday 23 January 2010 12:33:14 David Naylor wrote:
Hi,
I have been experimenting with using unionfs to build ports in a
"tinderbox" environment. This avoids having to remove and extract
files for the build of each port and it allows the discovery of
installed/modified files by the port.
Please see attached for a (updated) shell script that handles all the
"heavy lifting" of building ports. Of importance is LOCALBASE and
BUILDDIR. If you want to override LOCALBASE please use `env` as the
script needs to know about it. BUILDDIR (/usr/build by default) is
where the script stores everything (including PKG_DBDIR).
Please see attached for an updated script. This no longer uses `sort -u`
but removed duplicates while maintaining dependency order. (See below)
ENOSCRIPT
See attached. Processes are still freezing periodically (requiring a
restart). The mtree problem appears when installing meta ports (x11/xorg-
apps, x11/xorg, etc).
#!/bin/sh
BUILDDIR=${BUILDDIR:-/usr/build}
LOCALBASE=${LOCALBASE:-/usr/local}
PORTSDIR=${PORTSDIR:-/usr/ports}
PORT_DBDIR=${PKG_DBDIR:-$BUILDDIR/db_ports}
PKG_DBDIR=${PKG_DBDIR:-$BUILDDIR/db_pkg}
PACKAGES=${PACKAGES:-$BUILDDIR/packages}
MAKE="env LOCALBASE=$LOCALBASE PORTSDIR=$PORTSDIR PORT_DBDIR=$PORT_DBDIR PKG_DBDIR=$PKG_DBDIR PACKAGES=$PACKAGES make"
set -e
mkdir -p $BUILDDIR $LOCALBASE $PKG_DBDIR $PACKAGES
[ -n "$(kldstat -v | grep unionfs)" ] || kldload unionfs
[ ! -e $BUILDDIR/.installing_port ] || rm -r `cat $BUILDDIR/.installing_port` $BUILDDIR/.installing_port
port2name() {
echo $1 | sed 's|[/.-]|_|g'
}
port2pkg() {
local pkg_name=
local port=
port=$1; shift
eval pkg_name=PKG$(port2name $port)
eval pkg=\$$pkg_name
if [ -z "$pkg" ]
then
pkg=$($MAKE -C $port -V PKGNAME)
eval $pkg_name=$pkg
fi
}
depends() {
local depend=
local depends_name=
local _deps=
local name=
local port=
local type
type=$1
port=$2
eval depends_name=DEPEND_${type}_$(port2name $port)
eval deps=\"\$$depends_name\"
if [ -z "$deps" ]
then
echo "Getting $type dependancies for $port" > /dev/stderr
if [ "$type" = "build" ]
then
depend_list="$($MAKE -C $port -V EXTRACT_DEPENDS -V BUILD_DEPENDS -V LIB_DEPENDS -V RUN_DEPENDS)"
else
depend_list="$($MAKE -C $port -V LIB_DEPENDS -V RUN_DEPENDS)"
fi
for depend in $depend_list
do
name=$(echo $depend | cut -f 2 -d ':')
depends runtime $name
_deps="$_deps $deps $name"
done
deps=" "
for depend in $_deps
do
if [ -z "`echo "$deps" | grep " $depend "`" ]
then
deps="$deps$depend "
fi
done
[ "`echo $deps | tr ' ' '\n' | sort`" = "`echo $deps | tr ' ' '\n' | sort -u`" ]
depends_name=$depends_name
eval $depends_name=\"$deps \"
fi
}
run_make() {
set +e
trap "true" INT TERM EXIT
$MAKE "$@"
status=$?
trap - INT TERM EXIT
set -e
}
build() {
local _deps=
local dep=
local port=
port=$1
depends build $port
_deps="$deps"
for dep in $_deps
do
port2pkg $dep
if [ ! -d $BUILDDIR/$pkg ]
then
if ! build $dep
then
echo "Port $port failed due to dependency $dep" > /dev/stderr
return 255
fi
fi
done
echo "Building port $port..."
for pkg in $_deps
do
port2pkg $pkg
mount -t unionfs -r -o noatime $BUILDDIR/$pkg $LOCALBASE
done
run_make -C $port clean build -DNO_DEPENDS -DBATCH
if [ $status -eq 0 ]
then
port2pkg $port
mkdir -p $BUILDDIR/$pkg
mount -t unionfs -o noatime $BUILDDIR/$pkg $LOCALBASE
echo $BUILDDIR/$pkg > $BUILDDIR/.installing_port
run_make -C $port install package -DNO_DEPENDS -DBATCH
rm $BUILDDIR/.installing_port
[ $status -ne 0 -a -n "$NO_CLEANUP" ] || umount $LOCALBASE
fi
for pkg in $(echo $_deps | sort -r)
do
[ $status -ne 0 -a -n "$NO_CLEANUP" ] || umount $LOCALBASE
done
if [ $status -ne 0 ]
then
echo "Port $port failed to build" > /dev/stderr
port2pkg $port
rm -rf $BUILDDIR/$pkg || (chflags -R 0 $BUILDDIR/$pkg; rm -rf $BUILDDIR/$pkg)
else
$MAKE -C $port clean
fi
return $status
}
build /usr/ports/x11/xorg
Attachment:
signature.asc
Description: This is a digitally signed message part.
- Follow-Ups:
- Re: "tinderbox" using stacked unionfs
- From: David Naylor
- Re: "tinderbox" using stacked unionfs
- References:
- "tinderbox" using stacked unionfs
- From: David Naylor
- Re: "tinderbox" using stacked unionfs
- From: David Naylor
- Re: "tinderbox" using stacked unionfs
- From: Gary Jennejohn
- "tinderbox" using stacked unionfs
- Prev by Date: Re: [FreeBSD 8/9] USB webcamd and video4bsd: Call for testing
- Next by Date: Re: SUJ testing update
- Previous by thread: Re: "tinderbox" using stacked unionfs
- Next by thread: Re: "tinderbox" using stacked unionfs
- Index(es):
Relevant Pages
|