source: scripts/do-release @ b84feab

release-1.10release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since b84feab 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
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
[168f8a9]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
[5319565]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"
[01846ce]57[ "$git" ] && perl -i -pe 's{^(AC_INIT\(\[[^\]]+\],\s*)\[([^\]]+)\]}{${1}['$VERS']}' configure.ac
[db98968]58autoreconf -fvi
[5319565]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."
[11b9017]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.