?mode=patch&uid=2006091409085687330
Discarded Patch: 2006091409085687330 (by blindcoder)
+ blindcoder
Votecheck 'core-strong': Missing 1 qualified vote(s) (clifford, fake, teha)
scripts/Build-Pkg
Benjamin Schieder:
fix some tmpfs related problems
fixes problems introduced with [2006091100524749360]
new version in [2006091412142817004]
Benjamin Schieder:
fix some tmpfs related problems
--- scripts/Build-Pkg (Revision 27)
+++ scripts/Build-Pkg (Revision 29)
@@ -187,6 +187,17 @@
export ROCK_PKG=$pkg
export ROCK_XPKG=$xpkg
+mkdir -p "$builddir"; chmod 700 "$builddir"
+
+# This must happen _before_ the FLWRAPPER starts or we get into trouble
+# also before $chroot does anything
+if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
+ if ! grep -q "src.$xpkg.$id" /proc/mounts ; then
+ mount -t tmpfs -o $ROCKCFG_SRC_TMPFS_OPT tmpfs "$builddir"
+ echo_status "Mounted tmpfs"
+ fi
+fi
+
if [ "$chroot" = 1 ] ; then
cd "$xroot" || exit 1
@@ -213,7 +224,7 @@
ln -s /proc/self/fd dev/fd
fi
- if [ "$ROCKCFG_PSEUDONATIVE" = 1 -a ! -f pseudonative_handler ]
+ if [ "$ROCKCFG_PSEUDONATIVE" = 1 -a ! -f pseudonative_handler ] # {{{
then
echo_header "Preparing chroot dir for pseudonative build:"
@@ -267,7 +278,7 @@
echo_status "Creating fake rootdir-symlink."
mkdir -p $( dirname ${xroot#/} )
rm -f ${xroot#/}; ln -s / ${xroot#/}
- fi
+ fi # }}}
realconf=$(cd $base/config; pwd -P)
realdown=$(cd $base/download; pwd -P)
@@ -278,6 +289,9 @@
mount --bind $realbase $PWD/ROCK/loop
mount --bind $realconf $PWD/ROCK/config
mount --bind $realdown $PWD/ROCK/download
+ if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
+ mount --bind $builddir $PWD/ROCK/loop/src.$xpkg.$id
+ fi
fi
if [ ! -f proc/mounts ]; then
@@ -296,9 +310,9 @@
# If build is a symlink to somewhere else (NFS share for clusterbuild
# usually) we do _not_ want to extract our stuff there.
# Network latency!
- mkdir -p "$builddir"; chmod 700 "$builddir"
ln -s loop/src.$xpkg.$id ROCK/src.$xpkg.$id
+ echo_status "Builddir is $builddir"
cat > "$builddir/chroot.sh" <<- EOT
#!/bin/bash
export ROCK_THIS_IS_CHROOT=1; cd /ROCK
@@ -312,6 +326,9 @@
mount --bind $realbase $PWD/ROCK/loop
mount --bind $realconf $PWD/ROCK/config
mount --bind $realdown $PWD/ROCK/download
+ if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
+ mount --bind $builddir $PWD/ROCK/loop/src.$xpkg.$id
+ fi
fi
chroot "$xroot" /bin/bash ROCK/src.$xpkg.$id/debug_x.sh
EOT
@@ -331,11 +348,21 @@
fi
fi
+ echo_status "pwd is `pwd`"
TZ="/ROCK/localtime" chroot . bin/bash ROCK/src.$xpkg.$id/chroot.sh
returncode=$?
+ if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
+ umount $PWD/ROCK/loop/src.$xpkg.$id
+ umount $realbase/src.$xpkg.$id
+ fi
+ umount $PWD/ROCK/loop
+ umount $PWD/ROCK/config
+ umount $PWD/ROCK/download
+ umount $PWD/proc
# Only remove $builddir if it is empty.
- rmdir --ignore-fail-on-non-empty "$builddir"
+ rm ROCK/src.$xpkg.$id
+ rmdir --ignore-fail-on-non-empty "$realbase/src.$xpkg.$id"
exit $returncode
fi
@@ -676,12 +703,6 @@
echo_status "Preparing build in src.$xpkg.$id"
-if [ $clear_src = 1 ] ; then
- if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
- mount -t tmpfs -o $ROCKCFG_SRC_TMPFS_OPT tmpfs "$builddir"
- fi
-fi
-
if [ "$xroot" != "$root" ] ; then
for x in $flistroot ; do
[ -d $xroot/$x ] || mkdir -p $xroot/$x
@@ -1244,9 +1265,20 @@
rm -f $base/build/$ROCKCFG_ID/pseudonative_handler
fi
+if [ "$ROCKCFG_FLIST" = "flwrapper" ] ; then
+ export LD_PRELOAD="${LD_PRELOAD//${FLWRAPPER}/}"
+ export LD_PRELOAD="${LD_PRELOAD//::/:}"
+fi
if [ -f $root/var/adm/logs/$stagelevel-$xpkg.log ] ; then
if [ $clear_src = 1 ] ; then
- rm -rf "$builddir"/* "$builddir"
+ rm -rf "$builddir"/*
+ if [ $stagelevel -lt 2 ] ; then
+# in stages 2-9 the outer Build-Pkg has a fd open in $builddir
+ if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
+ umount "$builddir"
+ fi
+ rmdir "$builddir"
+ fi
else
cp $root/var/adm/logs/$stagelevel-$xpkg.out "$builddir/BUILD-LOG"
fi
@@ -1258,7 +1290,14 @@
exit 0
else
if [ $clear_src = 1 -a "$ROCKCFG_ALWAYS_CLEAN" = 1 ] ; then
- rm -rf "$builddir"/* "$builddir"
+ rm -rf "$builddir"/*
+ if [ $stagelevel -lt 2 ] ; then
+# in stages 2-9 the outer Build-Pkg has a fd open in $builddir
+ if [ "$ROCKCFG_SRC_TMPFS" = 1 ]; then
+ umount "$builddir"
+ fi
+ rmdir "$builddir"
+ fi
else
cp $root/var/adm/logs/$stagelevel-$xpkg.out "$builddir/ERROR-LOG"
fi
[Download this patch]