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