summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2011-10-23 19:46:01 +0000
committerphk <phk@FreeBSD.org>2011-10-23 19:46:01 +0000
commiteb67f83b02065565ec24b8ab3da09fc389452cda (patch)
treeae52f2e93c3dc2fee1875b6976293fef28ba3ef9 /tools
parent2a95de90da8deb3bce8d0b7e322530d4e87a06a5 (diff)
downloadFreeBSD-src-eb67f83b02065565ec24b8ab3da09fc389452cda.zip
FreeBSD-src-eb67f83b02065565ec24b8ab3da09fc389452cda.tar.gz
Add a "-P olddistfiles" facility to prefetch ports distfiles, using an
old distfile directory as primary source: mkdir /freebsd/ports/distfiles.old mv /freebsd/ports/distfiles/* /freebsd/ports/distfiles.old sh sysbuild.sh -c $yourconfig -P /freebsd/ports/distfiles.old rm -rf /freebsd/ports/distfiles.old Unfortunately bsd.ports.mk does not attempt to use a hard-link so while this runs you need diskspace for both your old and your "new" distfiles.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/sysbuild/sysbuild.sh55
1 files changed, 43 insertions, 12 deletions
diff --git a/tools/tools/sysbuild/sysbuild.sh b/tools/tools/sysbuild/sysbuild.sh
index 93bf5d8..ee77259 100644
--- a/tools/tools/sysbuild/sysbuild.sh
+++ b/tools/tools/sysbuild/sysbuild.sh
@@ -113,6 +113,17 @@ final_chroot() (
)
#######################################################################
+# -P is a pretty neat way to clean junk out from your ports dist-files:
+#
+# mkdir /freebsd/ports/distfiles.old
+# mv /freebsd/ports/distfiles/* /freebsd/ports/distfiles.old
+# sh sysbuild.sh -c $yourconfig -P /freebsd/ports/distfiles.old
+# rm -rf /freebsd/ports/distfiles.old
+#
+# Unfortunately bsd.ports.mk does not attempt to use a hard-link so
+# while this runs you need diskspace for both your old and your "new"
+# distfiles.
+#
#######################################################################
usage () {
@@ -122,6 +133,7 @@ usage () {
echo " -k suppress buildkernel"
echo " -w suppress buildworld"
echo " -p used cached packages"
+ echo " -P <dir> prefetch ports"
echo " -c specify config file"
) 1>&2
exit 2
@@ -249,12 +261,13 @@ ports_build() (
ports_prefetch() (
(
set +x
- true > /mnt/_.prefetch
- echo "Building /tmp/_.plist" >> /mnt/_.prefetch
+ ldir=$1
+ true > /${ldir}/_.prefetch
+ echo "Building /tmp/_.plist" >> /${ldir}/_.prefetch
ports_recurse . $PORTS_WE_WANT
- echo "Completed /tmp/_.plist" >> /mnt/_.prefetch
+ echo "Completed /tmp/_.plist" >> /${ldir}/_.prefetch
# Now checksump/fetch them
for p in `cat /tmp/_.plist`
do
@@ -262,21 +275,22 @@ ports_prefetch() (
(
cd $p
if make checksum $PORTS_OPTS ; then
- rm -f /mnt/_.prefetch.$b
- echo "OK $p" >> /mnt/_.prefetch
+ rm -f /${ldir}/_.prefetch.$b
+ echo "OK $p" >> /${ldir}/_.prefetch
exit 0
fi
make distclean
make checksum $PORTS_OPTS || true
if make checksum $PORTS_OPTS > /dev/null 2>&1 ; then
- rm -f /mnt/_.prefetch.$b
- echo "OK $p" >> /mnt/_.prefetch
+ rm -f /${ldir}/_.prefetch.$b
+ echo "OK $p" >> /${ldir}/_.prefetch
else
- echo "BAD $p" >> /mnt/_.prefetch
+ echo "BAD $p" >> /${ldir}/_.prefetch
fi
- ) > /mnt/_.prefetch.$b 2>&1
+ ) > /${ldir}/_.prefetch.$b 2>&1
done
+ echo "Done" >> /${ldir}/_.prefetch
)
)
@@ -284,11 +298,12 @@ ports_prefetch() (
do_world=true
do_kernel=true
+do_prefetch=false
use_pkg=""
c_arg=""
set +e
-args=`getopt bc:hkpw $*`
+args=`getopt bc:hkpP:w $*`
if [ $? -ne 0 ] ; then
usage
fi
@@ -325,6 +340,12 @@ do
shift;
use_pkg="-p"
;;
+ -P)
+ shift;
+ do_prefetch=true
+ distfile_cache=$1
+ shift;
+ ;;
-w)
shift;
do_world=false
@@ -366,6 +387,15 @@ fi
T0=`date +%s`
echo $T0 $T0 > /tmp/_sb_log
+if $do_prefetch ; then
+ rm -rf /tmp/sysbuild/ports
+ mkdir -p /tmp/sysbuild/ports
+ ln -s ${distfile_cache} /tmp/sysbuild/ports/distfiles
+ export PORTS_OPTS=CD_MOUNTPTS=/tmp/sysbuild
+ ports_prefetch /tmp
+ exit 0
+fi
+
log_it Unmount everything
(
( cleanup )
@@ -446,7 +476,7 @@ log_it copy ports config files
(cd / ; find var/db/ports -print | cpio -dumpv /mnt > /dev/null 2>&1)
log_it "Start prefetch of ports distfiles"
-ports_prefetch &
+ports_prefetch /mnt &
if $do_world ; then
(
@@ -558,13 +588,14 @@ if [ "x$SERCONS" != "xfalse" ] ; then
sed -i "" -e '/^ttyv[0-8]/s/ on/ off/' /mnt/etc/ttys
fi
-log_it move config files
+log_it move dist config files "(expect warnings)"
(
cd /mnt
mkdir root/configfiles_dist
find ${CONFIGFILES} -print | cpio -dumpv root/configfiles_dist
)
+log_it copy live config files
(cd / && find ${CONFIGFILES} -print | cpio -dumpv /mnt)
log_it final_root
OpenPOWER on IntegriCloud