diff options
author | kris <kris@FreeBSD.org> | 2008-07-26 23:16:16 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2008-07-26 23:16:16 +0800 |
commit | 2453ebd810f86fe59cf71882cd30dbc5a78d2f9e (patch) | |
tree | ca8dd9a92cc5c431690403f63445f57e773497b9 /Tools | |
parent | d352685f168378c471ca4a66f434e452e258411e (diff) | |
download | freebsd-ports-graphics-2453ebd810f86fe59cf71882cd30dbc5a78d2f9e.tar.gz freebsd-ports-graphics-2453ebd810f86fe59cf71882cd30dbc5a78d2f9e.tar.zst freebsd-ports-graphics-2453ebd810f86fe59cf71882cd30dbc5a78d2f9e.zip |
Script run from cron to regularly update the master ZFS copies of the
ports and source trees. Since we have >=1 consumer of these trees
that run frequently but do not insist on up-to-the-second trees, it
makes sense to "pre-update" them regularly and then then re-use in all
of the consumers, instead of potentially doing several updates
simultaneously or on demand. Consumers can clone the ZFS snapshot
into their local filesystem which takes a couple of seconds instead of
minutes or tens of minutes for the CVS update.
We update to a date stamp instead of "." because this avoids
ambiguity of commits that happen while the tree update is in progress
(unfortunately it's slower).
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/portbuild/scripts/updatesnap | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Tools/portbuild/scripts/updatesnap b/Tools/portbuild/scripts/updatesnap new file mode 100755 index 00000000000..f968c4f2e62 --- /dev/null +++ b/Tools/portbuild/scripts/updatesnap @@ -0,0 +1,63 @@ +#!/bin/sh +# +# Update the master ports and source trees that are used by package builds +# and other consumers + +base=/a/snap +zbase=a/snap + +srepo=/r/ncvs +prepo=/r/pcvs + +stamp() { + fulldate=$1 + date -j -f %+ "${fulldate}" +%Y%m%d%H%M%S +} + +finish() { + err=$1 + + end=$(date +%s) + echo "Finished at $(date)" + len=$((end-begin)) + echo "Duration = $(date -j -f %s +%H:%M:%S ${len})" + exit 1 +} + +begin=$(date +%s) +echo "Started at $(date)" + +# We need to preserve group writability so portmgr group can write +umask 002 + +#cvsup -g /root/cvs-supfile || finish 1 + +cd $base/ports +fulldate=$(date) +cvs -Rq -d ${prepo} update -PdA -D "${fulldate}" +echo ${fulldate} > cvsdone +snapdate=$(stamp ${fulldate}) +zfs snapshot ${zbase}/ports@${snapdate} + +cd $base/src-HEAD +fulldate=$(date) +cvs -Rq -d ${srepo} update -PdA -D "${fulldate}" +echo ${fulldate} > cvsdone +snapdate=$(stamp ${fulldate}) +zfs snapshot ${zbase}/src-HEAD@${snapdate} + +cd $base/src-6 +fulldate=$(date) +cvs -Rq -d ${srepo} update -PdA -D "${fulldate}" -r RELENG_6 +echo ${fulldate} > cvsdone +snapdate=$(stamp ${fulldate}) +zfs snapshot ${zbase}/src-6@${snapdate} + +cd $base/src-7 +fulldate=$(date) +cvs -Rq -d ${srepo} update -PdA -D "${fulldate}" -r RELENG_7 +echo ${fulldate} > cvsdone +snapdate=$(stamp ${fulldate}) +zfs snapshot ${zbase}/src-7@${snapdate} + +finish 0 |