source: scripts/do-release @ 66a8cd6

release-1.10release-1.6release-1.7release-1.8release-1.9
Last change on this file since 66a8cd6 was d771d1b, checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
do-release: Refuse to build an update tarball if we haven't pulled.
  • Property mode set to 100755
File size: 1.9 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
35head=$(git symbolic-ref HEAD)
36head=${head#refs/heads/}
37
38git rev-parse --verify -q $head >/dev/null 2>&1
39git rev-parse --verify -q origin/$head >/dev/null 2>&1
40if [ -n "$(git rev-list $head..origin/$head)" ]; then
41    die "$head is not up to date. Aborting."
42fi
43
44if ! [ "$no_tag" ]; then
45    if git cat-file -t "$TAG" > /dev/null 2>&1; then
46        die "Error: Object $TAG already exists."
47    fi
48
49    git tag -s -m "BarnOwl $VERS" "$TAG"
50else
51    TAG=HEAD
52fi
53
54exittrap() { :; }
55for sig in 1 2 13 15; do trap "exit $(($sig + 128))" $sig; done
56trap 'exittrap' EXIT
57
58TMPDIR=$(mktemp -d /tmp/barnowl.XXXXXX)
59
60exittrap() { rm -rf "$TMPDIR"; }
61
62git archive --format=tar --prefix="$TGZ/" "$TAG" | tar -x -C "$TMPDIR"
63
64CODIR=$(pwd)
65cd "$TMPDIR/$TGZ"
66[ "$git" ] && perl -i -pe 's{^(AC_INIT\(\[[^\]]+\],\s*)\[([^\]]+)\]}{${1}['$VERS']}' configure.ac
67autoreconf -fvi
68cd "$TMPDIR"
69tar czvf "$TGZ.tgz" "$TGZ"
70cd "$CODIR"
71
72mv "$TMPDIR/$TGZ.tgz" .
73rm -rf "$TMPDIR"
74
75exittrap() { :; }
76
77echo "Created release tarball for BarnOwl $VERS in $(pwd)"
78echo "Remember to bump OWL_VERSION_STRING for future development."
79
80COMMIT=$(git rev-parse "$TAG")
81NOW=$(date +"%B %d, %Y")
82cat <<EOF
83 * '''$NOW''': BarnOwl $VERS Released. [wiki:Download] it here. or see the [/browser/ChangeLog?rev=$COMMIT ChangeLog]
84EOF
Note: See TracBrowser for help on using the repository browser.