File: do-release

package info (click to toggle)
barnowl 1.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 5,472 kB
  • sloc: ansic: 36,670; perl: 20,938; sh: 1,598; makefile: 181
file content (90 lines) | stat: -rwxr-xr-x 2,226 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
set -eu

die() {
    echo "$@" >&2
    exit 1
}

usage() {
    cat >&2 <<EOF
Usage: $0 [options]
Generate a BarnOwl release tarball.

OPTIONS:
  -f            Don't require a changelog entry for the new release.
  --no-tag      Don't create and sign a git tag for the new release
  --git         Do a beta release for the current git revision.
EOF
}

force=
no_tag=
git=

for arg; do
    case $arg in
        -f) force=1 ;;
        --no-tag) no_tag=1 ;;
        --git) git=1 ;;
        -h|--help) usage ;;
    esac
done

if [ "$git" ]; then
    force=1
    no_tag=1
    VERS=$(git describe --match='barnowl-*' HEAD | sed s,^barnowl-,,)
else
    VERS=$(perl -ne 'print $1 if m{^AC_INIT\(\[[^\]]+\],\s*\[([^\]]+)\]}' configure.ac) \
        || die "Unable to parse BarnOwl version"
fi
TAG=barnowl-$VERS
TGZ="$TAG-src"

if [ ! "$force" ] && [ "$VERS" != "$(head -1 ChangeLog)" ]; then
    die "No ChangeLog entry for version $VERS, aborting."
fi

head=$(git symbolic-ref HEAD)
head=${head#refs/heads/}

git rev-parse --verify -q $head >/dev/null 2>&1
git rev-parse --verify -q origin/$head >/dev/null 2>&1
if [ -n "$(git rev-list $head..origin/$head)" ]; then
    die "$head is not up to date. Aborting."
fi

[ -e Makefile.in ] || autoreconf -fvi
[ -e config.status ] || ./configure
make -j4 distcheck VERSION="$VERS"

echo 'Checking distributed files against Git:'
if comm -3 <(tar -tzf "$TAG.tar.gz" | grep -v '/$' | sed "s%^$TAG/%%" | sort) \
    <(git ls-files | sort) | grep -vxf scripts/dist-ignore; then
    echo
    echo 'Error: Please fix Makefile.am and/or scripts/dist-ignore.'
    exit 1
fi
echo 'ok'

mv "$TAG.tar.gz" "$TGZ.tgz"

if ! [ "$no_tag" ]; then
    if git cat-file -t "$TAG" > /dev/null 2>&1; then
        die "Error: Object $TAG already exists."
    fi

    git tag -s -m "BarnOwl $VERS" "$TAG"
else
    TAG=HEAD
fi

echo "Created release tarball for BarnOwl $VERS at $(pwd)/$TGZ.tgz"
echo "Remember to bump OWL_VERSION_STRING for future development."

COMMIT=$(git rev-parse "$TAG")
NOW=$(date +"%B %d, %Y")
cat <<EOF
 * '''$NOW''': BarnOwl $VERS released. [wiki:Download] it here, or read the [wiki:release-notes/$VERS release notes] or [/browser/ChangeLog?rev=barnowl-$VERS ChangeLog].
EOF