]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - do_release
Update to Standards-Version 3.9.5, no changes need
[mirror_smartmontools-debian.git] / do_release
CommitLineData
a23d5117
GI
1#!/bin/bash
2#
3# do a smartmontools release
cfbba5b9
GI
4# (C) 2003-11 Bruce Allen <ballen4705@users.sourceforge.net>,
5# Guido Guenther <agx@sigxcpu.org>
ee38a438
GI
6# (C) 2006-13 Christian Franke <smartmontools-support@lists.sourceforge.net>
7# $Id: do_release 3765 2013-02-05 17:17:13Z chrfranke $
a23d5117
GI
8
9# Notes on generating releases:
10# (1) update NEWS
ee38a438
GI
11# (2) update ChangeLog -- put in release number
12# (3) update release number in configure.ac
a23d5117
GI
13# (4) to test, run without '--commit'
14# (5) when satisfied, add option '--commit'
15
16set -e
17
ee38a438
GI
18# Smartmontools Signing Key (through 2014)
19KEYID=0x8F6ED8AA
cfbba5b9 20
a23d5117
GI
21inc_release()
22{
23 MINOR=`echo $VERSION | cut -d. -f2`
24 MAJOR=`echo $VERSION | cut -d. -f1`
25 PERL_OLD=$MAJOR\\.$MINOR
ee38a438 26 ((++MINOR))
a23d5117
GI
27 NEW_VERSION=$MAJOR.$MINOR
28 PERL_NEW=$MAJOR\\.$MINOR
29 NEW_RELEASE="RELEASE_${NEW_VERSION//\./_}"
30 echo "New Version: $NEW_VERSION"
31 echo "New Release: $NEW_RELEASE"
32}
33
34COMMIT=
35RC=
36
37case "$1" in
38 --commit) COMMIT=yes; shift ;;
39esac
40
41case "$*" in
42 RC[1-9]) RC="$1" ;;
43 FINAL) ;;
44 *) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;;
45esac
46
47# Check workdir
48case "`/bin/pwd`" in
49 */trunk/smartmontools) WDROOT="../.."; DIRPAT="trunk" ;;
50 */branches/*/smartmontools) WDROOT="../../.."; DIRPAT="branches/*" ;;
51 *) echo "`/bin/pwd`: no trunk or branch working dir"; exit 1 ;;
52esac
53
54if [ ! -d "$WDROOT/tags" ]; then
55 echo "tags directory missing"; exit 1
56fi
57
58REVX="`(cd $WDROOT && svnversion)`" || exit 1
59REV="${REVX/%[PM]/}"; REV="${REV/%[PM]/}"
60if [ -n "${REV//[0-9]/}" ]; then
61 echo "Working directory not clean: $REVX"; exit 1
62fi
63
64(cd $WDROOT && svn status) | while read s; do
cfbba5b9 65 case "`echo $s | tr -s ' '`" in
ee38a438 66 "M "$DIRPAT/smartmontools/ChangeLog) echo "$s: OK";;
cfbba5b9 67 "M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";;
ee38a438 68 "M "$DIRPAT/smartmontools/configure.ac) echo "$s: OK";;
a23d5117
GI
69 *) echo "$s: not allowed"; exit 1;;
70 esac
71done
72if [ $? -ne 0 ]; then
73 exit 1
74fi
75
76# Get release number
ee38a438 77VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.ac`
a23d5117 78if [ -z "$VERSION" ]; then
ee38a438 79 echo "AC_INIT not found in configure.ac"; exit 1
a23d5117
GI
80fi
81VERSIONRC="$VERSION"
82RELEASE="RELEASE_${VERSION//\./_}"
83
84if [ "$RC" ]; then
85 VERSIONRC="${VERSION}-${RC/#RC/rc}"
86 RELEASE="${RELEASE}_${RC}"
87fi
88
89if [ -e "$WDROOT/tags/$RELEASE" ]; then
90 echo "tags/$RELEASE exists"; exit 1
91fi
92
93echo "r$REV: Release $VERSIONRC $RELEASE"
94
95# Update timestamp
96smartmontools_release_date=`date -u +"%Y-%m-%d"`
97smartmontools_release_time=`date -u +"%T %Z"`
ee38a438
GI
98cat configure.ac | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
99cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.ac
a23d5117
GI
100rm -f configure.tmp
101
102# Review changes
103svn diff
104echo "==================================================================="
105echo ">>> Continuing in 20 seconds ..."
106sleep 20
107set -v
108
109# Create tag and commit
110if [ "$COMMIT" = "yes" ]; then
111 svn mkdir $WDROOT/tags/$RELEASE
112 svn copy ../smartmontools $WDROOT/tags/$RELEASE/smartmontools
113 svn commit -m "Release $VERSIONRC $RELEASE" $WDROOT
114fi
115
116# Build
117./autogen.sh
118
119mkdir build
120cd build
121../configure
122make distcheck || exit 1
123make maintainer-clean
124cd ..
125
126TARFILE=smartmontools-$VERSIONRC.tar.gz
127
128mv -f build/smartmontools-$VERSION.tar.gz $TARFILE
129rm -rvf build
130
131md5sum $TARFILE > $TARFILE.md5
a23d5117
GI
132
133# Increase release number
134if [ -z "$RC" -a "$DIRPAT" = "trunk" ]; then
135 inc_release
136 if [ "$COMMIT" = "yes" ]; then
ee38a438
GI
137 perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.ac
138 # svn commit -m "Bump release number to $NEW_VERSION" configure.ac
a23d5117
GI
139 fi
140fi
141
cfbba5b9
GI
142# Sign tarball
143if [ -n "$KEYID" ] && gpg --list-secret-keys $KEYID >/dev/null 2>/dev/null; then
144 gpg --default-key $KEYID --armor --detach-sign ./smartmontools-$VERSIONRC.tar.gz
145fi
146