]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
makedist.sh
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 31 Jan 2007 06:58:25 +0000 (06:58 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 31 Jan 2007 06:58:25 +0000 (06:58 +0000)
git-svn-id: file:///svn/unbound/trunk@44 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
doc/README
doc/unbound.8
makedist.sh [new file with mode: 0755]

index 7a22eebadf7a81edebbae939c3b09943365c8a71..01273603e2640d54cdb91414ea05156bcfccc1dd 100644 (file)
@@ -1,3 +1,6 @@
+31 January 2007: Wouter
+       - Added makedist.sh script to make release tarball.
+
 30 January 2007: Wouter
        - links in example/ldns-testpkts.c and .h for premade packet support.
        - added callback argument to listen_dnsport and daemon/worker.
index 7c1105e8b5712ba241a8a496d5a761c11b5e8af8..9abf16c505b61ab2f3c092ea0560c7abccd061cd 100644 (file)
@@ -1,4 +1,4 @@
-README for Unbound
+README for Unbound @version@
 Copyright 2007 NLnet Labs
 http://unbound.net
 
index c54092581386267b98da8f648b795ae704525da5..afd8db47a196e2b026ef88766e353b7fbf0e1acf 100644 (file)
@@ -33,11 +33,11 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 
 ..
-.Dd January 29, 2007
+.Dd @date@
 .Dt unbound 8
 .Sh NAME
 unbound
-.Nd Unbound DNS validating resolver.
+.Nd Unbound DNS validating resolver @version@.
 .Sh SYNOPSIS
 .Nm unbound
 .Op Fl h
diff --git a/makedist.sh b/makedist.sh
new file mode 100755 (executable)
index 0000000..17c94bb
--- /dev/null
@@ -0,0 +1,242 @@
+#!/bin/sh
+
+# Build unbound distribution tar from the SVN repository.
+# 
+# Copyright (c) 2007, NLnet Labs. All rights reserved.
+# 
+# This software is open source.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# 
+# Neither the name of the NLNET LABS nor the names of its contributors may
+# be used to endorse or promote products derived from this software without
+# specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Abort script on unexpected errors.
+set -e
+
+# Remember the current working directory.
+cwd=`pwd`
+
+# Utility functions.
+usage () {
+    cat >&2 <<EOF
+Usage $0: [-h] [-s] [-d SVN_root] [-l ldns_path]
+Generate a distribution tar file for NSD.
+
+    -h           This usage information.
+    -s           Build a snapshot distribution file.  The current date is
+                 automatically appended to the current NSD version number.
+    -d SVN_root  Retrieve the NSD source from the specified repository.
+                 Detected from svn working copy if not specified.
+    -l ldnsdir   Directory where ldns resides. Detected from Makefile.
+EOF
+    exit 1
+}
+
+info () {
+    echo "$0: info: $1"
+}
+
+error () {
+    echo "$0: error: $1" >&2
+    exit 1
+}
+
+question () {
+    printf "%s (y/n) " "$*"
+    read answer
+    case "$answer" in
+        [Yy]|[Yy][Ee][Ss])
+            return 0
+            ;;
+        *)
+            return 1
+            ;;
+    esac
+}
+
+# Only use cleanup and error_cleanup after generating the temporary
+# working directory.
+cleanup () {
+    info "Deleting temporary working directory."
+    cd $cwd && rm -rf $temp_dir
+}
+
+error_cleanup () {
+    echo "$0: error: $1" >&2
+    cleanup
+    exit 1
+}
+
+replace_text () {
+    (cp "$1" "$1".orig && \
+        sed -e "s/$2/$3/g" < "$1".orig > "$1" && \
+        rm "$1".orig) || error_cleanup "Replacement for $1 failed."
+}
+
+replace_all () {
+    info "Updating '$1' with the version number."
+    replace_text "$1" "@version@" "$version"
+    info "Updating '$1' with today's date."
+    replace_text "$1" "@date@" "`date +'%b %e, %Y'`"
+}
+    
+
+SNAPSHOT="no"
+LDNSDIR=""
+
+# Parse the command line arguments.
+while [ "$1" ]; do
+    case "$1" in
+        "-h")
+            usage
+            ;;
+        "-d")
+            SVNROOT="$2"
+            shift
+            ;;
+        "-s")
+            SNAPSHOT="yes"
+            ;;
+        "-l")
+            LDNSDIR="$2"
+            shift
+            ;;
+        *)
+            error "Unrecognized argument -- $1"
+            ;;
+    esac
+    shift
+done
+
+# Check if SVNROOT is specified.
+if [ -z "$SVNROOT" ]; then
+    if test -f .svn/entries; then
+         eval `grep 'url=' .svn/entries`
+         SVNROOT="$url"
+    fi
+    if test -z "$SVNROOT"; then
+       error "SVNROOT must be specified (using -d)"
+    fi
+fi
+# Check if LDNSDIR is specified.
+if test -z "$LDNSDIR"; then
+    # try to autodetect from Makefile (if present)
+    if test -f Makefile; then
+         eval `grep 'ldnsdir=' Makefile`
+         LDNSDIR="$ldnsdir"
+    fi
+    if test -z "$LDNSDIR"; then
+       error "LDNSDIR not detected in Makefile, specify manually (using -l)"
+    fi
+fi
+
+# Start the packaging process.
+info "SVNROOT  is $SVNROOT"
+info "SNAPSHOT is $SNAPSHOT"
+info "LDNSDIR  is $LDNSDIR"
+
+#question "Do you wish to continue with these settings?" || error "User abort."
+
+
+# Creating temp directory
+info "Creating temporary working directory"
+temp_dir=`mktemp -d unbound-dist-XXXXXX`
+info "Directory '$temp_dir' created."
+cd $temp_dir
+
+info "Exporting source from SVN."
+svn export "$SVNROOT" unbound || error_cleanup "SVN command failed"
+
+cd unbound || error_cleanup "Unbound not exported correctly from SVN"
+
+info "Adding libtool utils (libtoolize)."
+libtoolize -c || error_cleanup "libtoolize failed"
+
+info "Building configure script (autoconf)."
+autoconf || error_cleanup "Autoconf failed."
+
+info "Building config.h.in (autoheader)."
+autoheader || error_cleanup "Autoheader failed."
+
+rm -r autom4te* || error_cleanup "Failed to remove autoconf cache directory."
+
+# info "Building lexer and parser."
+
+# copy ldns-testpkts from ldns examples
+cp $LDNSDIR/examples/ldns-testpkts.c testcode/ldns-testpkts.c || error_cleanup "copy ldns/examples/.. failed"
+cp $LDNSDIR/examples/ldns-testpkts.h testcode/ldns-testpkts.h || error_cleanup "copy ldns/examples/.. failed"
+
+find . -name .c-mode-rc.el -exec rm {} \;
+find . -name .cvsignore -exec rm {} \;
+rm makedist.sh || error_cleanup "Failed to remove makedist.sh."
+
+info "Determining Unbound version."
+version=`./configure --version | head -1 | awk '{ print $3 }'` || \
+    error_cleanup "Cannot determine version number."
+
+info "Unbound version: $version"
+
+if [ "$SNAPSHOT" = "yes" ]; then
+    info "Building Unbound snapshot."
+    version="$version-`date +%Y%m%d`"
+    info "Snapshot version number: $version"
+fi
+
+replace_all doc/README
+replace_all doc/unbound.8
+
+info "Renaming Unbound directory to unbound-$version."
+cd ..
+mv unbound unbound-$version || error_cleanup "Failed to rename unbound directory."
+
+tarfile="../unbound-$version.tar.gz"
+
+if [ -f $tarfile ]; then
+    (question "The file $tarfile already exists.  Overwrite?" \
+        && rm -f $tarfile) || error_cleanup "User abort."
+fi
+
+info "Creating tar unbound-$version.tar.gz"
+tar czf ../unbound-$version.tar.gz unbound-$version || error_cleanup "Failed to create tar file."
+
+cleanup
+
+case $OSTYPE in
+        linux*)
+                sha=`sha1sum unbound-$version.tar.gz |  awk '{ print $1 }'`
+                ;;
+        freebsd*)
+                sha=`sha1  unbound-$version.tar.gz |  awk '{ print $5 }'`
+                ;;
+       *)
+                sha=`sha1sum unbound-$version.tar.gz |  awk '{ print $1 }'`
+                ;;
+esac
+echo $sha > unbound-$version.tar.gz.sha1
+
+info "Unbound distribution created successfully."
+info "SHA1sum: $sha"
+