-
Notifications
You must be signed in to change notification settings - Fork 7
/
release
executable file
·106 lines (95 loc) · 3.87 KB
/
release
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh -e
#
# release - convenient script for "releasing" an upstream project for Ubuntu
#
# Copyright (C) 2008-2010 Dustin Kirkland <[email protected]>
#
# Authors:
# Dustin Kirkland <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG=$(head -n1 debian/changelog | awk '{print $1}')
LATEST=$(distro-info --devel || echo "experimental")
VER=$(head -n 1 debian/changelog | sed 's/^.*(//' | sed 's/).*//' | sed 's/-.*//')
MAJOR=$(echo "$VER" | awk -F. '{print $1}')
MINOR=$(head -n1 debian/changelog | sed -e "s/^.*($MAJOR.//" -e "s/).*$//")
error() {
echo "ERROR: $@" >&2
exit 1
}
# Check for "UNRELEASED" messages in our changes file
grep -qsi "unreleased" ../${PKG}_${MAJOR}.${MINOR}-0ubuntu1_source.changes && error "'UNRELEASED' appears in ../${PKG}_${MAJOR}.${MINOR}-0ubuntu1_source.changes" || true
# Ensure that we don't have uncommitted changes
bzr_stat="$(bzr stat)" || error "Cannot 'bzr stat'"
if "$bzr_stat" | grep -v "bzr shelve"; then
error "'bzr stat' is dirty... \n$bzr_stat"
fi
# Append our packaging to the version in the changelog
sed -i "s/) unreleased;/-0ubuntu1) $LATEST;/i" debian/changelog
(head -n1 debian/changelog | grep "$LATEST") || error "This version must be ready for release"
# Tag the release in bzr
dch --release
bzr tag --delete $MAJOR.$MINOR-0ubuntu1 || true
debcommit --release --message="releasing $MAJOR.$MINOR"
changelog=$(mktemp ../changelog-XXXXXXX)
grep -B 10000 -m1 '^ \-\- ' debian/changelog > "$changelog"
# Open the next release for development
nextminor=`expr $MINOR + 1`
if [ -r "usr/bin/$PKG" ]; then
sed -i "s/^VERSION=.*$/VERSION=$MAJOR.$nextminor/" usr/bin/$PKG
elif [ -r "usr/bin/${PKG}.in" ]; then
sed -i "s/^VERSION=.*$/VERSION=$MAJOR.$nextminor/" usr/bin/${PKG}.in
fi
dch -v "$MAJOR.$nextminor" "UNRELEASED"
sed -i "s/$MAJOR.$nextminor) .*;/$MAJOR.$nextminor) unreleased;/" debian/changelog
if [ -f setup.py ]; then
sed -i "s/version='$MAJOR.$MINOR'/version='$MAJOR.$nextminor'/" setup.py
fi
if [ -f */__init__.py ]; then
sed -i "s/__version__ = '$MAJOR.$MINOR'/__version__ = '$MAJOR.$nextminor'/" */__init__.py
fi
if [ -r snapcraft.yaml ]; then
sed -i "s/^version:.*$/version: \"$MAJOR.$nextminor\"/" snapcraft.yaml
fi
bzr commit -m "opening $MAJOR.$nextminor"
echo
echo "# Changes:"
echo
cat "$changelog"
echo
echo "# To push:"
if [ -d "../${PKG}.git" ] && command -v multi-push >/dev/null; then
echo " multi-push lp:$PKG"
else
echo " bzr push lp:$PKG"
fi
echo
echo "# Publish tarball to https://launchpad.net/$PKG/trunk/+addrelease"
echo " lp-project-upload ${PKG} ${MAJOR}.${MINOR} ../"$PKG"_${MAJOR}.${MINOR}.orig.tar.gz ${MAJOR}.${nextminor}" "$changelog" /dev/null
echo
if [ -f "setup.py" ]; then
echo "# To push to PyPI:"
echo " cd ../${PKG}-${MAJOR}.${MINOR}/ && ./setup.py sdist upload && cd -"
echo
fi
echo "# To upload packages:"
echo " dput ppa:$PKG/ppa ../${PKG}_${MAJOR}.${MINOR}-0ubuntu1~*_source.changes"
echo " dput ../${PKG}_${MAJOR}.${MINOR}-0ubuntu1_source.changes"
echo " dupload --to anonymous-ftp-master ../${PKG}_${MAJOR}.${MINOR}-1_source.changes"
echo
if [ -n "$DEBIAN_STAGING" ]; then
echo "# To upload for Debian sponsoring:"
echo " ssh ${DEBIAN_STAGING%%:*} rm -f ${DEBIAN_STAGING##*:}/${PKG}/*"
echo " rsync -aP ../${PKG}_${MAJOR}.${MINOR}-1* ../"$PKG"_${MAJOR}.${MINOR}.orig.tar.gz* ${DEBIAN_STAGING}/${PKG}/"
echo
fi