0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2000-2004, 2007-2010, 2012-2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
d49d75f5073294d798aa500728116309398bb535Andreas Gustafsson# Make a release kit
eefe56c8b367d1e54361b0c55f9db9d9468a0d6aAndreas Gustafsson# Usage: sh kit.sh tag tmpdir
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas Gustafsson# (e.g., sh kit.sh v9_0_0b5 /tmp/bindkit
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas Gustafsson# To build a snapshot release, use the pseudo-tag "snapshot".
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas Gustafsson# (e.g., sh kit.sh snapshot /tmp/bindkit
11d37bfa8d5650edf5c36e618fa673a84180f5c9Mark Andrewsremote=--remote=repo.isc.org:/proj/git/prod/bind9.git
978c8d59cf84b7c8bd22b20a3cb3c2934bb670f5Mark Andrewsrepo=`expr "X${remote}X" : '^X--remote=\(.*\)X$'`
38bcbbf947f0611bcae2e127d004dab761770c64Mark Andrews *) echo "usage: sh kit.sh [snapshot] gittag tmpdir" >&2
a26e1cacef2047b1048febd5e8d756060b4bddb1Evan Hunt snapshot) tag=master; snapshot=true ; releasetag="" ;;
38bcbbf947f0611bcae2e127d004dab761770c64Mark Andrews *) echo "usage: sh kit.sh [snapshot] gittag tmpdir" >&2
a26e1cacef2047b1048febd5e8d756060b4bddb1Evan Hunt# create tmpdir
d49d75f5073294d798aa500728116309398bb535Andreas Gustafsson echo "$0: could not create directory $tmpdir" >&2
ad7312bf186989f16d3b168b73c88bbee3d19ba0Mark Andrewshash=`git ls-remote $repo refs/heads/$tag | awk '{print $1}'`
ad7312bf186989f16d3b168b73c88bbee3d19ba0Mark Andrewsif [ -z "$hash" ]; then
ad7312bf186989f16d3b168b73c88bbee3d19ba0Mark Andrews hash=`git ls-remote $repo refs/tags/$tag | awk '{print $1}'`
ad7312bf186989f16d3b168b73c88bbee3d19ba0Mark Andrewsif [ -z "$hash" ]; then
3a88873c5bd11ce50d2c0f8e2d74a933b58d16c4Mark Andrews echo "Unable to determine hash for $tag, aborting."
38bcbbf947f0611bcae2e127d004dab761770c64Mark Andrews echo "$0: could not create directory $tmpdir/$verdir" >&2
ad7312bf186989f16d3b168b73c88bbee3d19ba0Mark Andrewsgit archive --format=tar $remote $hash version | ( cd $verdir ;tar xf - )
fd63f3110fe9a20d6188bc30ebf4b44595bac8eeMark Andrewsversion=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas Gustafssonecho "building release kit for BIND version $version, hold on..."
a26e1cacef2047b1048febd5e8d756060b4bddb1Evan Hunt echo "$0: directory $tmpdir/$topdir already exists" >&2
ad7312bf186989f16d3b168b73c88bbee3d19ba0Mark Andrewsgit archive --format=tar $remote $hash | ( cd $topdir; tar xf -)
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas GustafssonMAJORVER=$MAJORVER
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas GustafssonMINORVER=$MINORVER
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas GustafssonPATCHVER=$PATCHVER
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas GustafssonRELEASETYPE=$RELEASETYPE
c4213ed935163b25bde9273a7c1a79a6296a0662Andreas GustafssonRELEASEVER=$RELEASEVER
fd63f3110fe9a20d6188bc30ebf4b44595bac8eeMark AndrewsEXTENSIONS=$EXTENSIONS
d49d75f5073294d798aa500728116309398bb535Andreas Gustafsson# Omit some files and directories from the kit.
6e8a02d5d3a845ca1768e92c88bdc0a4da47f95bAndreas Gustafsson# Some of these directories (doc/html, doc/man...) no longer
6e8a02d5d3a845ca1768e92c88bdc0a4da47f95bAndreas Gustafsson# contain any files and should therefore be absent in the
6e8a02d5d3a845ca1768e92c88bdc0a4da47f95bAndreas Gustafsson# checked-out tree, but they did exist at some point and
6e8a02d5d3a845ca1768e92c88bdc0a4da47f95bAndreas Gustafsson# we still delete them from releases just in case something
6e8a02d5d3a845ca1768e92c88bdc0a4da47f95bAndreas Gustafsson# gets accidentally resurrected.
7d97663b2ca5b7b057276fc9d239025da80e4756Mark Andrewsrm -rf TODO EXCLUDED conftools doc/design doc/dev doc/draft doc/expired \
6306dd073e0eba562491222821c4d3b39f440718Evan Hunt doc/html doc/rfc doc/todo doc/private bin/lwresd doc/man doc/markdown \
3aab1703a5594e64b75d629427f1f1dd717cf5abScott Mann lib/lwres/man/resolver.5 contrib/zkt/doc/rfc5011.txt \
1d761cb453c76353deb8423c78e98d00c5f86ffaEvan Hunt# Remove everything but mksymtbl.pl and bindkeys.pl from util
1d761cb453c76353deb8423c78e98d00c5f86ffaEvan Huntfind util -name bindkeys.pl -o -name mksymtbl.pl -prune -o -type f -print | xargs rm -f
05398561e0221fe1fef1457627a50c60bddbb022Mark Andrewsfind util -depth -type d -print | xargs rmdir 2>/dev/null
a26e1cacef2047b1048febd5e8d756060b4bddb1Evan Hunt# Remove all .gitignore files
92e80317ea556ab5b9f90260b3799b35493daeddEvan Hunt# Remove branchsync.dat, if present
bcf966e6146943ebcac1603a52468f5292612b18Evan Hunt# populate srcid file
2e286ac71f3621c11a3409f35a859488026b5fb5Mark Andrews# The following files should be executable.
61d7ab455fe6c2c1be112e7f48a768b9db1f65bbMark Andrewschmod +x configure install-sh mkinstalldirs bin/tests/system/ifconfig.sh
61d7ab455fe6c2c1be112e7f48a768b9db1f65bbMark Andrews# Fix up releases with libbind.
61d7ab455fe6c2c1be112e7f48a768b9db1f65bbMark Andrews chmod +x lib/bind/configure lib/bind/mkinstalldirs
c85ffa76df4b94e0c44b2924f7a7f2e875a1ea86Mark Andrews# Fix files which should be using DOS style newlines
c85ffa76df4b94e0c44b2924f7a7f2e875a1ea86Mark Andrewswinnames="-name *.mak -or -name *.dsp -or -name *.dsw -or -name *.txt -or -name *.bat"
c85ffa76df4b94e0c44b2924f7a7f2e875a1ea86Mark Andrewsfor f in `find $windirs -type f \( $winnames \) -print`
c85ffa76df4b94e0c44b2924f7a7f2e875a1ea86Mark Andrews awk '{sub("\r$", "", $0); printf("%s\r\n", $0);}' < $f > tmp
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrews# check that documentation has been updated properly; issue a warning
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrews# if it hasn't
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrews echo "WARNING: ARM source is newer than the html version."
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrewsif test doc/arm/Bv9ARM-book.xml -nt doc/arm/Bv9ARM.pdf
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrews echo "WARNING: ARM source is newer than the PDF version."
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrews echo "WARNING: $docbookfile is newer than the html version."
4347f7ac1286aaa114935823c3cd59151de0166bMark Andrews# build the tarball
d49d75f5073294d798aa500728116309398bb535Andreas Gustafssoncd .. || exit 1