source: scripts/do-release @ 0572abcf

release-1.10release-1.6release-1.7release-1.8release-1.9
Last change on this file since 0572abcf 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
RevLine 
[5319565]1#!/bin/sh -e
2
3die() {
4    echo "$@" >&2
5    exit 1
6}
7
[b9df757]8force=
[168f8a9]9no_tag=
[01846ce]10git=
[b9df757]11
[168f8a9]12for arg; do
13    case $arg in
14        -f) force=1 ;;
15        --no-tag) no_tag=1 ;;
[01846ce]16        --git) git=1 ;;
[168f8a9]17    esac
18done
[b9df757]19
[01846ce]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
[5319565]28TAG=barnowl-$VERS
29TGZ="$TAG-src"
30
[b9df757]31if [ ! "$force" ] && [ "$VERS" != "$(head -1 ChangeLog)" ]; then
[bff8f9f]32    die "No ChangeLog entry for version $VERS, aborting."
33fi
34
[d771d1b]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
[168f8a9]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
[5319565]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"
[01846ce]66[ "$git" ] && perl -i -pe 's{^(AC_INIT\(\[[^\]]+\],\s*)\[([^\]]+)\]}{${1}['$VERS']}' configure.ac
[db98968]67autoreconf -fvi
[5319565]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."
[11b9017]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.