kit.sh revision 8a86c12ec245eb3838f48ffbc5a01fb9b7666a60
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley#!/bin/sh
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley#
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# Copyright (C) 2004, 2007-2009 Internet Systems Consortium, Inc. ("ISC")
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# Copyright (C) 2000-2003 Internet Software Consortium.
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley#
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# Permission to use, copy, modify, and/or distribute this software for any
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# purpose with or without fee is hereby granted, provided that the above
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# copyright notice and this permission notice appear in all copies.
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley#
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
c46bcd7c6908745e19b0b1fe18a23bbaaee553edBob Halley# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley# PERFORMANCE OF THIS SOFTWARE.
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# $Id: kit.sh,v 1.37 2009/09/08 03:39:30 each Exp $
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# Make a release kit
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley#
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# Usage: sh kit.sh tag tmpdir
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley#
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# (e.g., sh kit.sh v9_0_0b5 /tmp/bindkit
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff#
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff# To build a snapshot release, use the pseudo-tag "snapshot".
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff#
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff# (e.g., sh kit.sh snapshot /tmp/bindkit
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff#
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffarg=-r
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffcase $# in
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff 3)
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff case "$1" in
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff snapshot) ;;
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence *) echo "usage: sh kit.sh [snapshot] cvstag tmpdir" >&2
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence exit 1
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence ;;
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence esac
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence snapshot=true;
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff releasetag=$2
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff tag=$2
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff tmpdir=$3
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff ;;
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff 2)
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff tag=$1
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff tmpdir=$2
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff case $tag in
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff snapshot) tag=HEAD; snapshot=true ; releasetag="" ;;
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff *) snapshot=false ;;
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff esac
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff ;;
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff *) echo "usage: sh kit.sh [snapshot] cvstag tmpdir" >&2
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff exit 1
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff ;;
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graffesac
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Grafftest -d $tmpdir ||
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graffmkdir $tmpdir || {
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff echo "$0: could not create directory $tmpdir" >&2
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff exit 1
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff}
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssoncd $tmpdir || exit 1
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssoncvs checkout -p -r $tag bind9/version >version.tmp
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson. ./version.tmp
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonif $snapshot
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonthen
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson set `date -u +'%Y%m%d%H%M%S %Y/%m/%d %H:%M:%S UTC'`
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson dstamp=$1
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson RELEASETYPE=s
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson RELEASEVER=${dstamp}${releasetag}
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson shift
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson tag="$@"
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson arg=-D
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonfi
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonecho "building release kit for BIND version $version, hold on..."
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssontopdir=bind-$version
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssontest ! -d $topdir || {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson echo "$0: directory `pwd`/$topdir already exists" >&2
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson exit 1
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson}
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssoncvs -Q export $arg "$tag" -d $topdir bind9
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssoncd $topdir || exit 1
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonif $snapshot
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonthen
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson cat <<EOF >version
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonMAJORVER=$MAJORVER
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonMINORVER=$MINORVER
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonPATCHVER=$PATCHVER
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonRELEASETYPE=$RELEASETYPE
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonRELEASEVER=$RELEASEVER
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonEOF
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonfi
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# Omit some files and directories from the kit.
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson#
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# Some of these directories (doc/html, doc/man...) no longer
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# contain any files and should therefore be absent in the
2c7e99b941c3f1ffa29f9034c710f358c09f13c9Michael Graff# checked-out tree, but they did exist at some point and
2c7e99b941c3f1ffa29f9034c710f358c09f13c9Michael Graff# we still delete them from releases just in case something
2c7e99b941c3f1ffa29f9034c710f358c09f13c9Michael Graff# gets accidentally resurrected.
2c7e99b941c3f1ffa29f9034c710f358c09f13c9Michael Graff
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonrm -rf TODO EXCLUDED conftools doc/design doc/dev doc/expired \
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson doc/html doc/todo doc/private bin/lwresd doc/man \
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson lib/lwres/man/resolver.5 \
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson bin/tests/system/relay lib/cfg
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# Remove everything but mksymtbl.pl from util
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonfind ./util -name mksymtbl.pl -prune -o -type f -print | xargs rm -rf
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# Remove all .cvsignore files
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonfind . -name .cvsignore -print | xargs rm
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# The following files should be executable.
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafssonchmod +x configure install-sh mkinstalldirs bin/tests/system/ifconfig.sh
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# Fix up releases with libbind.
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleyif test -f lib/bind/configure
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Bristerthen
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley chmod +x lib/bind/configure lib/bind/mkinstalldirs
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleyfi
5b36207657107b48295534c51d5f6f070d6f689eBob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# Fix files which should be using DOS style newlines
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleywindirs=`find lib bin -type d -name win32`
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleywindirs="$windirs win32utils"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleywinnames="-name *.mak -or -name *.dsp -or -name *.dsw -or -name *.txt -or -name *.bat"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleyfor f in `find $windirs -type f \( $winnames \) -print`
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleydo
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halley awk '{sub("\r$", "", $0); printf("%s\r\n", $0);}' < $f > tmp
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halley touch -r $f tmp
7c0876aa42e6abaa8779bcb83962ccf20a9f4da3Bob Halley mv tmp $f
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halleydone
491b48ec3f3ef014312688776ddbd4eab8a2c10cMichael Graff
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Brister# check that documentation has been updated properly; issue a warning
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Brister# if it hasn't
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Bristerok=
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halleyfor f in doc/arm/*.html
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Bristerdo
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Brister if test "$f" -nt doc/arm/Bv9ARM-book.xml
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Brister then
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley ok=ok
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley fi
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleydone
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleyif test "$ok" != ok
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleythen
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley echo "WARNING: ARM source is newer than the html version."
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleyfi
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleyif test doc/arm/Bv9ARM-book.xml -nt doc/arm/Bv9ARM.pdf
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleythen
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley echo "WARNING: ARM source is newer than the PDF version."
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleyfi
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleyfor f in `find . -name "*.docbook" -print`
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleydo
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley docbookfile=$f
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley htmlfile=${f%.docbook}.html
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley if test $docbookfile -nt $htmlfile
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley then
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley echo "WARNING: $docbookfile is newer than the html version."
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley fi
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halleydone
a829555ed724caa56b1ff7716d7eda2266491eafBob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley# build the tarball
a829555ed724caa56b1ff7716d7eda2266491eafBob Halleycd .. || exit 1
a829555ed724caa56b1ff7716d7eda2266491eafBob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleykit=$topdir.tar.gz
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleytar -c -f - $topdir | gzip > $kit
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halleyecho "done, kit is in `pwd`/$kit"
a829555ed724caa56b1ff7716d7eda2266491eafBob Halley