source: scripts/do-release @ 01846ce

release-1.10release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 01846ce was 01846ce, checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
do-release: Support release tarballs from random git revisions.
  • Property mode set to 100755
File size: 1.6 KB
Line 
1#!/bin/sh -e
2
3die() {
4    echo "$@" >&2
5    exit 1
6}
7
8force=
9no_tag=
10git=
11
12for arg; do
13    case $arg in
14        -f) force=1 ;;
15        --no-tag) no_tag=1 ;;
16        --git) git=1 ;;
17    esac
18done
19
20if [ "$git" ]; then
21    force=1
22    no_tag=1
23    VERS=$(git describe --match='barnowl-*' HEAD | sed s,^barnowl-,,)
24else
25    VERS=$(perl -ne 'print $1 if m{^AC_INIT\(\[[^\]]+\],\s*\[([^\]]+)\]}' configure.ac) \
26        || die "Unable to parse barnowl version"
27fi
28TAG=barnowl-$VERS
29TGZ="$TAG-src"
30
31if [ ! "$force" ] && [ "$VERS" != "$(head -1 ChangeLog)" ]; then
32    die "No ChangeLog entry for version $VERS, aborting."
33fi
34
35if ! [ "$no_tag" ]; then
36    if git cat-file -t "$TAG" > /dev/null 2>&1; then
37        die "Error: Object $TAG already exists."
38    fi
39
40    git tag -s -m "BarnOwl $VERS" "$TAG"
41else
42    TAG=HEAD
43fi
44
45exittrap() { :; }
46for sig in 1 2 13 15; do trap "exit $(($sig + 128))" $sig; done
47trap 'exittrap' EXIT
48
49TMPDIR=$(mktemp -d /tmp/barnowl.XXXXXX)
50
51exittrap() { rm -rf "$TMPDIR"; }
52
53git archive --format=tar --prefix="$TGZ/" "$TAG" | tar -x -C "$TMPDIR"
54
55CODIR=$(pwd)
56cd "$TMPDIR/$TGZ"
57[ "$git" ] && perl -i -pe 's{^(AC_INIT\(\[[^\]]+\],\s*)\[([^\]]+)\]}{${1}['$VERS']}' configure.ac
58autoreconf -fvi
59cd "$TMPDIR"
60tar czvf "$TGZ.tgz" "$TGZ"
61cd "$CODIR"
62
63mv "$TMPDIR/$TGZ.tgz" .
64rm -rf "$TMPDIR"
65
66exittrap() { :; }
67
68echo "Created release tarball for BarnOwl $VERS in $(pwd)"
69echo "Remember to bump OWL_VERSION_STRING for future development."
70
71COMMIT=$(git rev-parse "$TAG")
72NOW=$(date +"%B %d, %Y")
73cat <<EOF
74 * '''$NOW''': BarnOwl $VERS Released. [wiki:Download] it here. or see the [/browser/ChangeLog?rev=$COMMIT ChangeLog]
75EOF
Note: See TracBrowser for help on using the repository browser.