File: do-release

package info (click to toggle)
linaro-image-tools 2016.05-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,180 kB
  • sloc: python: 15,832; sh: 393; makefile: 6
file content (89 lines) | stat: -rwxr-xr-x 1,911 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
#!/bin/sh
# tag tree, generate ChangeLog and roll a release tarball

set -e

self="$(basename "$0")"

usage() {
    echo "Usage: $self <version> [<old_version>]"
}

log() {
    echo "$*" >&2
}

log_i() {
    log "I:" "$@"
}

die() {
    log "E:" "$@"
    exit 1
}

set_version() {
    log_i "Setting version to $1 in __version__.py"
    sed -i "s/^__version__ =.*/__version__ = \"$1\"/" linaro_image_tools/__version__.py
}

version="$1"
old_version="$2"

if [ -z "$version" ]; then
    usage >&2
    exit 1
fi

log_i "Checking tree status"
status=`git status --short`
if [ -n "$status" ]; then
    die "Tree is dirty according to git status"
fi

log_i "Running tests"
if ! python -m testtools.run linaro_image_tools.tests.test_suite; then
    die "Testsuite doesn't pass"
fi

log_i "Removing test repository data"
rm -rf .testrepository/

if git tag | awk '{print $1}' | grep -qFx "$version"; then
    die "Tag $version already exists"
fi

set_version $version

log_i "Committing $version"
git commit -a -m "Release $version."

log_i "Creating tag $version"
git tag "$version"

log_i "Pushing changes and tag"
git push origin master
git push --tags

log_i "Generating ChangeLog"
if [ -z "$old_version"]; then
    git log --date=short --no-merges --format=format:"%ad %aN <%aE>%n%n  %s%n" >ChangeLog
else
    # If we have also the old revision, we can generate changelog only for
    # those tags, instead of a full changelog since the beginning of time.
    git log --date=short --no-merges --format=format:"%ad %aN <%aE>%n%n  %s%n" >ChangeLog "$old_version".."$version"
fi

log_i "Creating release tarball in parent directory"
./setup.py sdist -d ..

log_i "Cleaning up"
rm -f ChangeLog MANIFEST

log_i "Signing tarball"
gpg --armor --sign --detach-sig "../linaro-image-tools-$version.tar.gz"

set_version "$version.1"

log_i "Committing $version.1"
git commit -a -m "Post-release version bump to $version.1."