svn commit: r43978 - head/share/tools

Glen Barber gjb at FreeBSD.org
Tue Feb 18 18:04:04 UTC 2014


Author: gjb
Date: Tue Feb 18 18:04:03 2014
New Revision: 43978
URL: http://svnweb.freebsd.org/changeset/doc/43978

Log:
  Update webupdate and webupdate.wrapper scripts to always
  install from a clean build directory.
  
  PUBDIR is where the installed files end up for the public
  site.  DESTDIR is now suffixed with '-clean', and always
  purged before a new build starts.
  
  When the build finishes, rsync populates PUBDIR from the
  resulting DESTDIR files.  When doing a full site refresh,
  'rsync --delete' is used to purge stale files.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/share/tools/webupdate
  head/share/tools/webupdate.wrapper

Modified: head/share/tools/webupdate
==============================================================================
--- head/share/tools/webupdate	Tue Feb 18 17:03:47 2014	(r43977)
+++ head/share/tools/webupdate	Tue Feb 18 18:04:03 2014	(r43978)
@@ -17,6 +17,7 @@
 #	SVNROOT		- Path to the FreeBSD SVN repository.
 #	BUILDDIR	- Where the checked out copies of the files are stored.
 #	DESTDIR		- Where the rendered copies should wind up.
+#	PUBDIR		- Where the rendered files are published.
 #	LOGFILE		- Name of the log file to use (in $BUILDDIR).
 #	BUILDARGS	- Arguments to pass to make(1) when {build,install}ing.
 #	INSTARGS	- Arguments to pass to make(1) when installing.
@@ -162,6 +163,11 @@ time make ${BUILDARGS} all >> $LOGFILE 2
 	 mail -s "FreeBSD web build failed on `hostname`" $WEBMAILTO;
 	 exit 3) || exit 3;
 
+if [ "X${PUBDIR}" != "X" ]; then
+	/usr/local/bin/rsync ${RSYNC_FLAGS} ${DESTDIR}/ ${PUBDIR} \
+		>> ${LOGFILE} 2>&1
+fi
+
 # simon@ 20110116 - for now we use newsyslog...
 #gzip -f $LOGFILE
 #find $LOGDIR -mtime +60 -print0 | perl -n0e unlink

Modified: head/share/tools/webupdate.wrapper
==============================================================================
--- head/share/tools/webupdate.wrapper	Tue Feb 18 17:03:47 2014	(r43977)
+++ head/share/tools/webupdate.wrapper	Tue Feb 18 18:04:03 2014	(r43978)
@@ -9,11 +9,13 @@
 
 PATH=/bin:/usr/bin:/usr/local/bin
 SVNROOT=svn://svn.FreeBSD.org
-DESTDIR=/usr/local/www/www.freebsd.org
+PUBDIR=/usr/local/www/www.freebsd.org
+DESTDIR="${PUBDIR}-clean"
+RSYNC_FLAGS="-avH"
 PINDEX_OVERRIDE=/usr/ports/INDEX-9
 GEN_INDEX=yes
 export USER=www-data
-export PATH DESTDIR PINDEX_OVERRIDE GEN_INDEX
+export PATH DESTDIR PINDEX_OVERRIDE GEN_INDEX PUBDIR
 
 WEBMAILTO=freebsd-doc at FreeBSD.org
 export WEBMAILTO
@@ -29,6 +31,7 @@ if [ -e $FLAGDIR/fullbuild-clean.flag ];
 	export BUILD_RELNOTES=YES
 	# TODO - tell webupdate to do clean via env variable
 	# webupdate will remove flag file
+	RSYNC_FLAGS="${RSYNC_FLAGS} --delete"
 elif [ -e $FLAGDIR/fullbuild-all-lang.flag ]; then
 	export BUILD_RELNOTES=YES
 elif [ -e $FLAGDIR/fullbuild-en.flag ]; then
@@ -37,6 +40,7 @@ elif [ -e $FLAGDIR/fullbuild-en.flag ]; 
 else
 	export WEB_ONLY=YES
 fi
+rm -rf ${DESTDIR}/*
 rm -f $FLAGDIR/fullbuild-all-lang.flag $FLAGDIR/fullbuild-en.flag
 
 # 30m
@@ -45,6 +49,8 @@ if [ "$1" = "-f" ]; then
 	LOCKF_WAIT=0
 fi
 
+export RSYNC_FLAGS
+
 nice -5 lockf -s -t $LOCKF_WAIT /usr/local/www/build/lock.webupdate \
 	sh -c "/usr/local/www/bin/webupdate ; \
 		/usr/sbin/newsyslog -f /home/www/etc/webupdate_newsyslog.conf -Fr -t ''"


More information about the svn-doc-all mailing list