source: scripts/do-release @ ee6b30f

release-1.10
Last change on this file since ee6b30f was bc308eb, checked in by Anders Kaseorg <andersk@mit.edu>, 9 years ago
scripts/do-release: Build distribution with ‘make distcheck’ This has many advantages: ‘make distcheck’ automatically verifies that the release builds, tests, installs, uninstalls, and cleans successfully. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Property mode set to 100755
File size: 2.2 KB
Line 
1#!/bin/bash
2set -eu
3
4die() {
5    echo "$@" >&2
6    exit 1
7}
8
9usage() {
10    cat >&2 <<EOF
11Usage: $0 [options]
12Generate a BarnOwl release tarball.
13
14OPTIONS:
15  -f            Don't require a changelog entry for the new release.
16  --no-tag      Don't create and sign a git tag for the new release
17  --git         Do a beta release for the current git revision.
18EOF
19}
20
21force=
22no_tag=
23git=
24
25for arg; do
26    case $arg in
27        -f) force=1 ;;
28        --no-tag) no_tag=1 ;;
29        --git) git=1 ;;
30        -h|--help) usage ;;
31    esac
32done
33
34if [ "$git" ]; then
35    force=1
36    no_tag=1
37    VERS=$(git describe --match='barnowl-*' HEAD | sed s,^barnowl-,,)
38else
39    VERS=$(perl -ne 'print $1 if m{^AC_INIT\(\[[^\]]+\],\s*\[([^\]]+)\]}' configure.ac) \
40        || die "Unable to parse BarnOwl version"
41fi
42TAG=barnowl-$VERS
43TGZ="$TAG-src"
44
45if [ ! "$force" ] && [ "$VERS" != "$(head -1 ChangeLog)" ]; then
46    die "No ChangeLog entry for version $VERS, aborting."
47fi
48
49head=$(git symbolic-ref HEAD)
50head=${head#refs/heads/}
51
52git rev-parse --verify -q $head >/dev/null 2>&1
53git rev-parse --verify -q origin/$head >/dev/null 2>&1
54if [ -n "$(git rev-list $head..origin/$head)" ]; then
55    die "$head is not up to date. Aborting."
56fi
57
58[ -e Makefile.in ] || autoreconf -fvi
59[ -e config.status ] || ./configure
60make -j4 distcheck VERSION="$VERS"
61
62echo 'Checking distributed files against Git:'
63if comm -3 <(tar -tzf "$TAG.tar.gz" | grep -v '/$' | sed "s%^$TAG/%%" | sort) \
64    <(git ls-files | sort) | grep -vxf scripts/dist-ignore; then
65    echo
66    echo 'Error: Please fix Makefile.am and/or scripts/dist-ignore.'
67    exit 1
68fi
69echo 'ok'
70
71mv "$TAG.tar.gz" "$TGZ.tgz"
72
73if ! [ "$no_tag" ]; then
74    if git cat-file -t "$TAG" > /dev/null 2>&1; then
75        die "Error: Object $TAG already exists."
76    fi
77
78    git tag -s -m "BarnOwl $VERS" "$TAG"
79else
80    TAG=HEAD
81fi
82
83echo "Created release tarball for BarnOwl $VERS at $(pwd)/$TGZ.tgz"
84echo "Remember to bump OWL_VERSION_STRING for future development."
85
86COMMIT=$(git rev-parse "$TAG")
87NOW=$(date +"%B %d, %Y")
88cat <<EOF
89 * '''$NOW''': BarnOwl $VERS released. [wiki:Download] it here, or read the [wiki:release-notes/$VERS release notes] or [/browser/ChangeLog?rev=barnowl-$VERS ChangeLog].
90EOF
Note: See TracBrowser for help on using the repository browser.