head	1.17;
access;
symbols
	HRS_XML_CLEANUP:1.15
	HRS_XML_CLEANUP_PRE:1.15
	EMILYBOYD_REDESIGN:1.15
	PRE_REDESIGN:1.15
	XML_XSL_XP:1.9.0.2
	XML_XSL_XP_BP:1.9;
locks; strict;
comment	@# @;


1.17
date	2008.10.05.11.50.30;	author simon;	state Exp;
branches;
next	1.16;

1.16
date	2008.02.26.18.47.23;	author simon;	state Exp;
branches;
next	1.15;

1.15
date	2005.07.15.15.27.43;	author hrs;	state Exp;
branches;
next	1.14;

1.14
date	2004.11.07.11.04.09;	author simon;	state Exp;
branches;
next	1.13;

1.13
date	2004.09.26.11.55.51;	author simon;	state Exp;
branches;
next	1.12;

1.12
date	2004.08.21.10.39.28;	author hrs;	state Exp;
branches;
next	1.11;

1.11
date	2004.07.04.14.33.58;	author hrs;	state Exp;
branches;
next	1.10;

1.10
date	2003.11.18.11.00.54;	author kuriyama;	state Exp;
branches;
next	1.9;

1.9
date	2001.08.31.17.39.07;	author dd;	state Exp;
branches;
next	1.8;

1.8
date	2001.08.31.17.38.41;	author dd;	state Exp;
branches;
next	1.7;

1.7
date	2001.08.31.17.37.33;	author dd;	state Exp;
branches;
next	1.6;

1.6
date	2001.08.31.17.09.21;	author dd;	state Exp;
branches;
next	1.5;

1.5
date	2001.08.30.06.59.19;	author dd;	state Exp;
branches;
next	1.4;

1.4
date	2001.08.24.02.09.39;	author dd;	state Exp;
branches;
next	1.3;

1.3
date	2001.06.14.04.59.13;	author dd;	state Exp;
branches;
next	1.2;

1.2
date	2001.06.14.04.13.24;	author dd;	state Exp;
branches;
next	1.1;

1.1
date	2001.06.06.22.45.43;	author dd;	state Exp;
branches;
next	;


desc
@@


1.17
log
@Checkout release notes for FreeBSD 6, 7, and 8 instead of older releases.
@
text
@#!/bin/sh
# Copyright (c) 2001 Wolfram Schneider <wosch@@FreeBSD.org>
# Copyright (c) 2001 Dima Dorfman <dd@@FreeBSD.org>
#
# Update the FreeBSD web site from the CVS repository.
#
#
# NOTE: Changes to this file is NOT automatically used for the web
# site build on www.FreeBSD.org.  If an update to the main build
# script is required, please contact webmaster@@FreeBSD.org or a member
# of the wwwadm team.
#
#
# Major variables:
#
#	PATH		- The search path as interpreted by the shell.
#	CVSROOT		- Path to the FreeBSD CVS repository.
#	BUILDDIR	- Where the checked out copies of the files are stored.
#	DESTDIR		- Where the rendered copies should wind up.
#	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.
#	WEBMAILTO	- Address to send mail to if the build fails.
#
#	subtrees	- List of directores in $BUILDDIR which are from CVS.
#
# Variables which are in uppercase are derived from the environment
# unless they don't exist, in which case a value suitable for
# www.FreeBSD.org is used.  Variables in lowercase can't be safely
# changed without editing other parts of the script; thus, their value
# in the environment is ignored.
#
# Exit codes:
#
#	0	- success
#	1	- unknown failure
#	2	- failure in CVS operations
#	3	- failure in make operations
#
# $FreeBSD: www/tools/webupdate,v 1.15 2005/07/15 15:27:43 hrs Exp $
#

#
# Default configuration.
#
DEFAULT_PATH=/bin:/usr/bin:/usr/local/bin;
DEFAULT_CVSROOT=/home/ncvs;
DEFAULT_BUILDDIR=/usr/local/www/build;
DEFAULT_LOGDIR=/usr/local/www/build/log;
DEFAULT_DESTDIR=/usr/local/www;
DEFAULT_LOGFILE=log.make.`date '+%d.%H'`;
DEFAULT_BUILDARGS='';
DEFAULT_INSTARGS='';
DEFAULT_WEBMAILTO=freebsd-doc;

#
# Variable setup.
#
PATH=${PATH:-${DEFAULT_PATH}}; export PATH;
CVSROOT=${CVSROOT:-${DEFAULT_CVSROOT}}; export CVSROOT;
BUILDDIR=${BUILDDIR:-${DEFAULT_BUILDDIR}};
LOGDIR=${LOGDIR:-${DEFAULT_LOGDIR}};
DESTDIR=${DESTDIR:-${DEFAULT_DESTDIR}}; export DESTDIR
LOGFILE=${LOGFILE:-${LOGDIR}/${DEFAULT_LOGFILE}};
BUILDARGS=${BUILDARGS:-${DEFAULT_BUILDARGS}};
INSTARGS="${BUILDARGS} ${INSTARGS:-${DEFAULT_INSTARGS}}";
WEBMAILTO=${WEBMAILTO:-${DEFAULT_WEBMAILTO}};

# Notes on the names of the release notes directories:
#
# - They weren't named the same way they will be on the web site
# (CURRENT, 4-STABLE) becuase that wouldn't make it obvious that they
# were release notes.
#
# - They weren't named after their path names in the repository
# (src/release/doc) because that doesn't play well with branches.
#
# - The '/doc' part is necessary because of the way doc.subdir.mk finds
# ${LANGCODE}.  It strips off the last component of ${.CURDIR} one by
# one and compares the last component to 'doc'.  When it finds it, it
# assumes that the directory right below that is the language code.
# This works fine if all the languages are in a directory called
# 'doc', and not at all if they aren't.
subtrees='www doc relnotes/doc relnotes/man4 relnotes6/doc relnotes6/man4 relnotes7/doc relnotes7/man4';

#
# Update the checked out copies.  Check out new copies every Sunday or
# if they don't exist.
#

# Only create $BUILDDIR if the directory right above it exists.
cd `dirname $BUILDDIR` || exit 1;
if [ ! -d $BUILDDIR ]; then
	mkdir $BUILDDIR;
fi
umask 002
cd $BUILDDIR || exit 1;

mkdir -p $LOGDIR
rm -f $LOGFILE 2>/dev/null;
touch $LOGFILE;

# XXX If one of the directories in $subtrees doesn't exist, *all* of
# them will be wiped and checked out again.  This should only happen
# if something went terribly wrong, or if there's a new entry in
# $subtrees, so I (dd) don't plan on fixing it; there's no sense in
# optimizing something that should only happen twice a year (if that).
cond="X`date '+%u'` = X7 `echo $subtrees | sed -E 's/([^ ]*)/-o ! -d \1/g'`";
if [ $cond ]; then
	# Remove the old copies.
	rm -Rf $subtrees 2>/dev/null;
	chflags -R noschg $subtrees 2>/dev/null;
	rm -Rf $subtrees 2>/dev/null;

	# Check out the new copies.  This creates all the $subtrees.
	cvs -qR checkout -P www >> $LOGFILE 2>&1 || exit 2;
	cvs -qR checkout -P doc >> $LOGFILE 2>&1 || exit 2;

	test -d relnotes || mkdir relnotes;
	cvs -qR checkout -Pd relnotes/doc src/release/doc >> \
		$LOGFILE 2>&1 || exit 2;
	cvs -qR checkout -Pd relnotes/man4 src/share/man/man4 >> \
		$LOGFILE 2>&1 || exit 2;

	test -d relnotes7 || mkdir relnotes7;
	cvs -qR checkout -Pd relnotes7/doc -rRELENG_7 src/release/doc >> \
		$LOGFILE 2>&1 || exit 2;
	cvs -qR checkout -Pd relnotes7/man4 -rRELENG_7 src/share/man/man4 >> \
		$LOGFILE 2>&1 || exit 2;

	test -d relnotes6 || mkdir relnotes6;
	cvs -qR checkout -Pd relnotes6/doc -rRELENG_6 src/release/doc >> \
		$LOGFILE 2>&1 || exit 2;
	cvs -qR checkout -Pd relnotes6/man4 -rRELENG_6 src/share/man/man4 >> \
		$LOGFILE 2>&1 || exit 2;
else
	cvs -qR update -dP $subtrees >> $LOGFILE 2>&1 || exit 2;
fi

#
# Build the web site.
#
cd $BUILDDIR/www/en || exit 1;

time make ${BUILDARGS} all >> $LOGFILE 2>&1 &&
    time make ${INSTARGS} install >> $LOGFILE 2>&1 ||
	(tail -50 $LOGFILE |
	 mail -s "FreeBSD web build failed on `hostname`" $WEBMAILTO;
	 exit 3) || exit 3;

gzip -f $LOGFILE
find $LOGDIR -mtime +60 -print0 | perl -n0e unlink

exit 0;
@


1.16
log
@Sync with the actual build script used on www.FreeBSD.org:

Make this script work with newer version of make(1).  If DESTDIR is set
on the make command line it cannot be overridden in www/en/doc etc.

This makes the script work with FreeBSD 6.X+.
@
text
@d84 1
a84 1
subtrees='www doc relnotes/doc relnotes/man4 relnotes5/doc relnotes5/man4 relnotes4/doc relnotes4/man4';
d125 6
a135 12

	test -d relnotes5 || mkdir relnotes5;
	cvs -qR checkout -Pd relnotes5/doc -rRELENG_5 src/release/doc >> \
		$LOGFILE 2>&1 || exit 2;
	cvs -qR checkout -Pd relnotes5/man4 -rRELENG_5 src/share/man/man4 >> \
		$LOGFILE 2>&1 || exit 2;

	test -d relnotes4 || mkdir relnotes4;
	cvs -qR checkout -Pd relnotes4/doc -rRELENG_4 src/release/doc >> \
		$LOGFILE 2>&1 || exit 2;
	cvs -qR checkout -Pd relnotes4/man4 -rRELENG_4 src/share/man/man4 >> \
		$LOGFILE 2>&1 || exit 2;
@


1.15
log
@Add release documentation for RELENG_6 as relnotes6.
@
text
@d40 1
a40 1
# $FreeBSD: www/tools/webupdate,v 1.14 2004/11/07 11:04:09 simon Exp $
d63 1
a63 1
DESTDIR=${DESTDIR:-${DEFAULT_DESTDIR}};
d152 1
a152 1
    time make ${INSTARGS} DESTDIR=$DESTDIR install >> $LOGFILE 2>&1 ||
@


1.14
log
@Sync with the actual script on www.FreeBSD.org:
- Use a separate directory for log files.
- Compress the log file after build.
@
text
@d40 1
a40 1
# $FreeBSD: www/tools/webupdate,v 1.13 2004/09/26 11:55:51 simon Exp $
d125 6
@


1.13
log
@Note that changes to this file is NOT automatically used for the web
site build on www.FreeBSD.org.

Prompted by:	hrs (some time ago)
@
text
@d40 1
a40 1
# $FreeBSD: www/tools/webupdate,v 1.12 2004/08/21 10:39:28 hrs Exp $
d49 1
d62 1
d64 1
a64 1
LOGFILE=${LOGFILE:-${BUILDDIR}/${DEFAULT_LOGFILE}};
d98 2
d150 3
@


1.12
log
@Checkout RELENG_5 relnotes.
@
text
@d8 6
d40 1
a40 1
# $FreeBSD: www/tools/webupdate,v 1.11 2004/07/04 14:33:58 hrs Exp $
@


1.11
log
@Check out src/share/man/man4 directory used for generating
device listings in the hardware notes.
@
text
@d34 1
a34 1
# $FreeBSD: www/tools/webupdate,v 1.10 2003/11/18 11:00:54 kuriyama Exp $
d76 1
a76 1
subtrees='www doc relnotes/doc relnotes/man4 relnotes4/doc relnotes4/man4';
d108 1
d114 7
@


1.10
log
@Return error code to parent process.
@
text
@d34 1
a34 1
# $FreeBSD: www/tools/webupdate,v 1.9 2001/08/31 17:39:07 dd Exp $
d76 1
a76 1
subtrees='www doc relnotes/doc relnotes4/doc';
d111 2
d115 2
@


1.9
log
@Remove excess vertical whitespace.
@
text
@d34 1
a34 1
# $FreeBSD: www/tools/webupdate,v 1.8 2001/08/31 17:38:41 dd Exp $
d126 2
a127 2
	    mail -s "FreeBSD web build failed on `hostname`" $WEBMAILTO &&
	    exit 3);
@


1.8
log
@Last commit claimed to have set umask 002; it didn't.  Do that now.
@
text
@d34 1
a34 1
# $FreeBSD: www/tools/webupdate,v 1.7 2001/08/31 17:37:33 dd Exp $
a89 1

a127 1

@


1.7
log
@- Introduce a WEBMAILTO (not just 'MAILTO' since that might be used
  for something else) variable that specifies a e-mail address to send
  a failed build report to.  Previously, this script would push part
  of the log to stdout for cron to do that, but that would always send
  it to the job owner, which may not necessarily be the person who can
  fix the problem.  Set the default to 'freebsd-doc' (the @@freebsd.org
  was explicitly left off so that if someone runs this on something
  other than freefall, the -doc list won't get mail about problems
  they probably didn't cause).
- Rename the default log file to log.make.* to be consistent with the
  previous version of this.
- Include the hour in the log file.  The web build runs more than once
  per day, and it's nice to be able to keep the log files.
- Set umask 002 so that people in the WEBGRP can do what they need
  without su'ing to wosch.

Obtained from:	wosch
@
text
@d34 1
a34 1
# $FreeBSD: www/tools/webupdate,v 1.6 2001/08/31 17:09:21 dd Exp $
d88 1
@


1.6
log
@Include BUILDARGS in INSTARGS.
@
text
@d17 1
d34 1
a34 1
# $FreeBSD: www/tools/webupdate,v 1.5 2001/08/30 06:59:19 dd Exp $
d44 1
a44 1
DEFAULT_LOGFILE=log.webbuild.`date '+%d'`;
d47 1
d59 1
d125 3
a127 1
	(tail -50 $LOGFILE && exit 3);
@


1.5
log
@Check out the release notes for both branches, but don't turn on
BUILD_RELNOTES yet.
@
text
@d15 1
a15 1
#	BUILDARGS	- Arguments to pass to make(1) when building.
d33 1
a33 1
# $FreeBSD: www/tools/webupdate,v 1.4 2001/08/24 02:09:39 dd Exp $
d56 1
a56 1
INSTARGS=${INSTARGS:-${DEFAULT_INSTARGS}};
@


1.4
log
@I have no idea what $modules is.  I must've meant $subtrees.
@
text
@d33 1
a33 1
# $FreeBSD: www/tools/webupdate,v 1.3 2001/06/14 04:59:13 dd Exp $
d58 16
a73 1
subtrees='www doc';
d105 6
@


1.3
log
@Add an XXX comment about a small inefficiency.  There's no sense in
fixing it, but I think it should be documented.
@
text
@d33 1
a33 1
# $FreeBSD: www/tools/webupdate,v 1.2 2001/06/14 04:13:24 dd Exp $
d84 1
a84 1
	chflags -R noschg $modules 2>/dev/null;
@


1.2
log
@Rewrite:
 * Try not to hardcode anything.  Intoduce a $subtrees variable which
   lists the CVS subtrees that need to be updated.
 * Document all major variables and actions.
 * Allow customization via the current environment (add some variables
   which can be set to facilitate testing and running outside of
   freefall).
 * Do a fresh checkout of the sources every Sunday; previously this
   was only a `make clean`; a fresh checkout makes sure occasional CVS
   bogons don't mess anything up (requested by nik).
 * Make $LOGFILE an absolute path so we don't end up with multiple log
   files, each containing half of the story.

Approved by:	nik
@
text
@d33 1
a33 1
# $FreeBSD: www/tools/webupdate,v 1.1 2001/06/06 22:45:43 dd Exp $
d75 5
@


1.1
log
@This is the website build script being used on freefall.  It is being
committed to the main (as opposed to ~wosch/cvs) CVS repository so
that committers can modify it without the assistance of (but, of
course, with the approval of) the webmaster and/or his lieutenant.  It
may also serve as a starting point for web site mirrors' update
scripts.

Requested by:	nik
Obtained from:	freefall:~wosch/bin/myupdate
@
text
@d3 1
d5 1
a5 1
# update the FreeBSD Web-Server from the CVS repository
d7 27
a33 1
# $FreeBSD$
d36 10
a45 2
PATH=/bin:/usr/bin:/usr/local/bin; export PATH
CVSROOT=/home/ncvs; export CVSROOT
d47 10
a56 2
build_dir=/usr/local/www/build
logfile=log.make.`date '+%d'`
d58 1
a58 1
cd $build_dir || exit 2
d60 4
a63 1
cvs -qR update -dP www doc > $logfile 2>&1 || exit 2
d65 23
a87 3
# fresh checkout
# rm -rf www doc || exit 2
# cvs -QR co www doc || exit 2
d89 4
a92 2
cd www || exit 2
cd en || exit 2
d94 3
a96 2
# force a rebuild every week at sunday
case `date '+%u'` in 7) make clean > /dev/null 2>&1 ;; esac
a97 3
time make all > $logfile 2>&1 && 
    time make DESTDIR=/usr/local/www install >> $logfile 2>&1 || 
	tail -50 $logfile
d99 1
@

