source: scripts/do-release @ e2cbbbe

release-1.10release-1.6release-1.7release-1.8release-1.9
Last change on this file since e2cbbbe was 51dbfb5, checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
Add usage messages to everything in scripts/
  • Property mode set to 100755
File size: 2.2 KB
RevLine 
[5319565]1#!/bin/sh -e
2
3die() {
4    echo "$@" >&2
5    exit 1
6}
7
[51dbfb5]8usage() {
9    cat >&2 <<EOF
10Usage: %0 [options]
11Generate a barnowl release tarball.
12
13OPTIONS:
14  -f            Don't require a changelog entry for the new release.
15  --no-tag      Don't create and sign a git tag for the new release
16  --git         Do a beta release for the current git revision.
17EOF
18}
19
[b9df757]20force=
[168f8a9]21no_tag=
[01846ce]22git=
[b9df757]23
[168f8a9]24for arg; do
25    case $arg in
26        -f) force=1 ;;
27        --no-tag) no_tag=1 ;;
[01846ce]28        --git) git=1 ;;
[51dbfb5]29        -h|--help) usage ;;
[168f8a9]30    esac
31done
[b9df757]32
[01846ce]33if [ "$git" ]; then
34    force=1
35    no_tag=1
36    VERS=$(git describe --match='barnowl-*' HEAD | sed s,^barnowl-,,)
37else
38    VERS=$(perl -ne 'print $1 if m{^AC_INIT\(\[[^\]]+\],\s*\[([^\]]+)\]}' configure.ac) \
39        || die "Unable to parse barnowl version"
40fi
[5319565]41TAG=barnowl-$VERS
42TGZ="$TAG-src"
43
[b9df757]44if [ ! "$force" ] && [ "$VERS" != "$(head -1 ChangeLog)" ]; then
[bff8f9f]45    die "No ChangeLog entry for version $VERS, aborting."
46fi
47
[d771d1b]48head=$(git symbolic-ref HEAD)
49head=${head#refs/heads/}
50
51git rev-parse --verify -q $head >/dev/null 2>&1
52git rev-parse --verify -q origin/$head >/dev/null 2>&1
53if [ -n "$(git rev-list $head..origin/$head)" ]; then
54    die "$head is not up to date. Aborting."
55fi
56
[168f8a9]57if ! [ "$no_tag" ]; then
58    if git cat-file -t "$TAG" > /dev/null 2>&1; then
59        die "Error: Object $TAG already exists."
60    fi
61
62    git tag -s -m "BarnOwl $VERS" "$TAG"
63else
64    TAG=HEAD
[5319565]65fi
66
67exittrap() { :; }
68for sig in 1 2 13 15; do trap "exit $(($sig + 128))" $sig; done
69trap 'exittrap' EXIT
70
71TMPDIR=$(mktemp -d /tmp/barnowl.XXXXXX)
72
73exittrap() { rm -rf "$TMPDIR"; }
74
75git archive --format=tar --prefix="$TGZ/" "$TAG" | tar -x -C "$TMPDIR"
76
77CODIR=$(pwd)
78cd "$TMPDIR/$TGZ"
[01846ce]79[ "$git" ] && perl -i -pe 's{^(AC_INIT\(\[[^\]]+\],\s*)\[([^\]]+)\]}{${1}['$VERS']}' configure.ac
[db98968]80autoreconf -fvi
[5319565]81cd "$TMPDIR"
82tar czvf "$TGZ.tgz" "$TGZ"
83cd "$CODIR"
84
85mv "$TMPDIR/$TGZ.tgz" .
86rm -rf "$TMPDIR"
87
88exittrap() { :; }
89
90echo "Created release tarball for BarnOwl $VERS in $(pwd)"
91echo "Remember to bump OWL_VERSION_STRING for future development."
[11b9017]92
93COMMIT=$(git rev-parse "$TAG")
94NOW=$(date +"%B %d, %Y")
95cat <<EOF
96 * '''$NOW''': BarnOwl $VERS Released. [wiki:Download] it here. or see the [/browser/ChangeLog?rev=$COMMIT ChangeLog]
97EOF
Note: See TracBrowser for help on using the repository browser.