(metux) gitignore update
[mirror-ossqm-expat.git] / make-release.sh
bloba6ff386e3faf1c7746763eabb0e15054eea7787d
1 #! /bin/bash
3 # make-release.sh: make an Expat release
5 # USAGE: make-release.sh tagname
7 # Note: tagname may be HEAD to just grab the head revision (e.g. for testing)
10 #CVSROOT=':ext:cvs.libexpat.org:/cvsroot/expat'
11 CVSROOT=':pserver:anonymous@expat.cvs.sourceforge.net:/cvsroot/expat'
13 if test $# != 1; then
14 echo "USAGE: $0 tagname"
15 exit 1
18 tmpdir=expat-release.$$
19 if test -e $tmpdir; then
20 echo "ERROR: oops. chose the $tmpdir subdir, but it exists."
21 exit 1
24 echo "Checking out into temporary area: $tmpdir"
25 cvs -fq -d "$CVSROOT" export -r "$1" -d $tmpdir expat || exit 1
27 echo ""
28 echo "----------------------------------------------------------------------"
29 echo "Preparing $tmpdir for release (running buildconf.sh)"
30 (cd $tmpdir && ./buildconf.sh) || exit 1
32 # figure out the release version
33 vsn="`$tmpdir/conftools/get-version.sh $tmpdir/lib/expat.h`"
35 echo ""
36 echo "Release version: $vsn"
38 if test "$1" = HEAD ; then
39 distdir=expat-`date '+%Y-%m-%d'`
40 else
41 distdir=expat-$vsn
43 if test -e $distdir; then
44 echo "ERROR: for safety, you must manually remove $distdir."
45 rm -rf $tmpdir
46 exit 1
48 mkdir $distdir || exit 1
50 CPOPTS=-Pp
51 if (cp --version 2>/dev/null | grep -q 'Free Software Foundation') ; then
52 # If we're using GNU cp, we can avoid the warnings about forward
53 # compatibility of the options.
54 CPOPTS='--parents --preserve'
57 echo ""
58 echo "----------------------------------------------------------------------"
59 echo "Building $distdir based on the MANIFEST:"
60 files="`sed -e 's/[ ]:.*$//' $tmpdir/MANIFEST`"
61 for file in $files; do
62 echo "Copying $file..."
63 (cd $tmpdir && cp $CPOPTS $file ../$distdir) || exit 1
64 done
66 echo ""
67 echo "----------------------------------------------------------------------"
68 echo "Removing (temporary) checkout directory..."
69 rm -rf $tmpdir
71 tarball=$distdir.tar.gz
72 echo "Constructing $tarball..."
73 tar cf - $distdir | gzip -9 > $tarball || exit $?
74 rm -r $distdir
76 echo "Done."