kit.sh revision 70e5a7403f0e0a3bd292b8287c5fed5772c15270
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews#!/bin/sh
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington#
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# Copyright (C) 2000-2003 Internet Software Consortium.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington#
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# Permission to use, copy, modify, and/or distribute this software for any
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# purpose with or without fee is hereby granted, provided that the above
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews# copyright notice and this permission notice appear in all copies.
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews#
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# PERFORMANCE OF THIS SOFTWARE.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# $Id: kit.sh,v 1.31 2007/06/19 23:47:24 tbox Exp $
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# Make a release kit
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington#
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# Usage: sh kit.sh tag tmpdir
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington#
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington# (e.g., sh kit.sh v9_0_0b5 /tmp/bindkit
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews#
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews# To build a snapshot release, use the pseudo-tag "snapshot".
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews#
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews# (e.g., sh kit.sh snapshot /tmp/bindkit
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews#
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsarg=-r
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewscase $# in
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews 3)
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews case "$1" in
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews snapshot) ;;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews *) echo "usage: sh kit.sh [snapshot] cvstag tmpdir" >&2
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews exit 1
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington ;;
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington esac
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington snapshot=true;
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington releasetag=$2
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington tag=$2
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington tmpdir=$3
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington ;;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews 2)
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews tag=$1
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews tmpdir=$2
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews case $tag in
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews snapshot) tag=HEAD; snapshot=true ; releasetag="" ;;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews *) snapshot=false ;;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews esac
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews ;;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews *) echo "usage: sh kit.sh [snapshot] cvstag tmpdir" >&2
adf16bbdb65f8c0845d7c7a8ebc0836ec07bbfeeBrian Wellington exit 1
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington ;;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsesac
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington
adf16bbdb65f8c0845d7c7a8ebc0836ec07bbfeeBrian Wellington
adf16bbdb65f8c0845d7c7a8ebc0836ec07bbfeeBrian Wellingtontest -d $tmpdir ||
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsmkdir $tmpdir || {
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews echo "$0: could not create directory $tmpdir" >&2
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews exit 1
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews}
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewscd $tmpdir || exit 1
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewscvs checkout -p -r $tag bind9/version >version.tmp
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews. ./version.tmp
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsif $snapshot
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsthen
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews set `date -u +'%Y%m%d%H%M%S %Y/%m/%d %H:%M:%S UTC'`
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews dstamp=$1
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews RELEASETYPE=s
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews RELEASEVER=${dstamp}${releasetag}
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews shift
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews tag="$@"
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews arg=-D
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsfi
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewsversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
echo "building release kit for BIND version $version, hold on..."
topdir=bind-$version
test ! -d $topdir || {
echo "$0: directory `pwd`/$topdir already exists" >&2
exit 1
}
cvs -Q export $arg "$tag" -d $topdir bind9
cd $topdir || exit 1
if $snapshot
then
cat <<EOF >version
MAJORVER=$MAJORVER
MINORVER=$MINORVER
PATCHVER=$PATCHVER
RELEASETYPE=$RELEASETYPE
RELEASEVER=$RELEASEVER
EOF
fi
# Omit some files and directories from the kit.
#
# Some of these directories (doc/html, doc/man...) no longer
# contain any files and should therefore be absent in the
# checked-out tree, but they did exist at some point and
# we still delete them from releases just in case something
# gets accidentally resurrected.
rm -rf TODO EXCLUDED conftools util doc/design doc/dev doc/expired \
doc/html doc/todo doc/private bin/lwresd doc/man \
lib/lwres/man/resolver.5 \
bin/tests/system/relay lib/cfg
find . -name .cvsignore -print | xargs rm
# The following files should be executable.
chmod +x configure install-sh mkinstalldirs \
lib/bind/configure lib/bind/mkinstalldirs \
bin/tests/system/ifconfig.sh
# Fix files which should be using DOS style newlines
windirs=`find lib bin -type d -name win32`
windirs="$windirs win32utils"
winnames="-name *.mak -or -name *.dsp -or -name *.dsw -or -name *.txt -or -name *.bat"
for f in `find $windirs -type f \( $winnames \) -print`
do
awk '{sub("\r$", "", $0); printf("%s\r\n", $0);}' < $f > tmp
touch -r $f tmp
mv tmp $f
done
cd .. || exit 1
kit=$topdir.tar.gz
tar -c -f - $topdir | gzip > $kit
echo "done, kit is in `pwd`/$kit"